From mboxrd@z Thu Jan 1 00:00:00 1970 From: tgh Subject: Re: migration and restore? Date: Wed, 27 Feb 2008 09:36:52 +0800 Message-ID: <47C4BEB4.8010501@sina.com.cn> References: <20080102151826296.00000000500@djm-pc> <200801030151.05435.mark.williamson@cl.cam.ac.uk> <477DEAA4.3040204@sina.com.cn> <4783699F.20201@amd.com> <1199797076.11398.25.camel@cube.lrr.in.tum.de> Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1199797076.11398.25.camel@cube.lrr.in.tum.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Daniel Stodden , Andre Przywara Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org thank both of you and how to debug python, i could debug c program with gdb ,and how to debug python program? and ,does the code of xc_domain_save.c and xc_domain_restore.c do the same job as the xend "xm save " and "xm restore"? and what are the valid parameter for it ? i look through the code ,it seems to be able to save VM in a live way ,and i try for some parameter , but failed , and how to do it? [root@vt-0 ~]# cd /root/xen-build-tree/xen-3.1.0-src/tools/xcutils/ [root@vt-0 xcutils]# ls Makefile readnotes.c xc_restore xc_restore.o xc_save.c readnotes readnotes.o xc_restore.c xc_save xc_save.o [root@vt-0 xcutils]# ./xc_save /tmp xc_save: usage: ./xc_save iofd domid maxit maxf flags [root@vt-0 xcutils]# ./xc_save /tmp/dom-1 dom-1 2 2 1 ERROR Internal error: Couldn't map live_shinfo Warning - couldn't disable shadow modeSave exit rc=3D1 [root@vt-0 xcutils]# ./xc_save /tmp/dom-1 dom-1 1 1 1 ERROR Internal error: Couldn't map live_shinfo Warning - couldn't disable shadow modeSave exit rc=3D1 [root@vt-0 xcutils]# ./xc_save /tmp/dom-1 dom-1 1 1 0 ERROR Internal error: Couldn't map live_shinfo Save exit rc=3D1 [root@vt-0 xcutils]# Thanks Daniel Stodden =D0=B4=B5=C0: > On Tue, 2008-01-08 at 13:16 +0100, Andre Przywara wrote: > =20 >>> i read the code of migration, and i fail to find the counterpart code= of=20 >>> migration , which deal with the restoration of VM in the destination=20 >>> node, and i read the code of /tools/libxc/xc_domain_restore.c ,but th= e=20 >>> function of xc_domain_restore() seems not to be the one for the=20 >>> migration, it seems not support the restore of the iterative copy of = the=20 >>> VM memory state ,is it? or how does it deal with the work? >>> =20 >> Maybe the missing pieces you are looking for are in the xend (Python)=20 >> code? In line 205 (or so) in tools/pyhton/xen/xend/XendDomainInfo.py y= ou=20 >> will find the high level function "restore". This method calls=20 >> XendDomainInfo.resume (line 446) and triggers the necessary actions=20 >> here. Another file to look in is XendCheckpoint.py, here you'll find t= he=20 >> method "restore" (line 154). Some Migration code is also in XendDomain= .py. >> You can get more info if you enable debugging, do a live migration (to= =20 >> localhost) and look in xend.log for "Saving memory pages" or "Reloadin= g=20 >> memory pages". From here you will find the corresponding code (maybe b= y=20 >> just grepping for the log message text). >> I found line 427 in xc_domain_restore.c, the code following this line=20 >> deals with the restoring of the frames. From my perspective there is=20 >> everything needed in there. >> =20 > > this is correct, the iteration is definitely done in > xc_domain_restore(). > > the for loop as described above follows iteration as dictated by the > source machine. each interation generates a number of batches, each > batch comprising a number of pages, either first try or (later) resent > due to being dirtied. each batch is dispatched in several passes. the > second pass generates the machine frame list into which the batch is > read. the most interesting part where that memory is mapped and filled > with frame contents starts in line 533 (xc_map_foreign_range) and the > subsequent for-loop in line 544 resp. > > complete enough to follow without the addtional setup done by xend. > tools/xcutils/ contains C programs calling into the library for save an= d > restore. should be easy to call from the command line once the paramete= r > meanings are understood; i'd suggest to build with debug output enabled > and follow the stderr messages to see how it works. > > regards, > daniel > > > =20