=== xm migrate : 1) [./tools/python/xen/xm/migrate.py] calls server.xend.domain.migrate(dom, dst, opts.vals.live, opts.vals.resource, opts.vals.port) (server <-- import from xen.xend.XendClient import server) xen.xend.XendClient from xen.util.xmlrpclib2 import ServerProxy server = ServerProxy('httpu:///var/run/xend/xmlrpc.sock') 2) [./tools/python/xen/xend/XendDomain.py] (def) domain_migrate() (called supposedly as per #1) a) create a TCP connection with the destn b) send a 'receive' packet on port 8002 RECEIVING SIDE: =============== - this is received in dataReceived() method of web/connection.py & delegates to next step - dataReceived() method of /tools/python/xen/xend/server/relocate.py is invoked - op_receive() method in relocate.py calls XendDomain.domain_restore_fd() - XendDomain.py calls XendCheckpoint.restore(self, fd) - XendCheckpoint.restore(self, fd) validate SIGNATURE validate config file dominfo = xd.restore_(vmconfig) (xd = XendDomain) dominfo = XendDomainInfo.restore(config) self._add_domain(dominfo) return dominfo validate pfn_count calls xc_restore executable dominfo.unpause() dominfo.completeRestore(...) f) XendDomain.py calls save() method of (3) XendCheckpoint.save(sock.fileno(), dominfo, live) //sock.fileno() is the file opened on the other side. [for xm save, this is just a file opend locally] < == fd = os.open(dst, os.O_WRONLY | os.O_CREAT | os.O_TRUNC) write_exact(fd, SIGNATURE, "could not write guest state file: signature") [/tools/python/xen/xend/XendCheckpoint.py] write_exact(fd, pack("!i", len(config)), "could not write guest state file: config len"); write_exact(fd, config, "could not write guest state file: config") 3) [./tools/python/xen/xend/XendCheckpoint.py] (def) save(fd, dominfo, live) (called as per #2) ==>starts writing out stuff into the file!! [<=====NOTE LinuxGuestRecord] ==> calls /usr/lib64/xen/bin/xc_save executable in a thread [built from tools/xcutils/xc_save.c] ==>calls xc_linux_save (xc_fd, io_fd, domid, maxit, max_f, flags, &suspend); 4) [./tools/libxc/xc_linux_save.c] (def) xc_linux_save ====== Image file structure: write_exact(fd, SIGNATURE, "could not write guest state file: signature") [/tools/python/xen/xend/XendCheckpoint.py] write_exact(fd, pack("!i", len(config)), "could not write guest state file: config len"); write_exact(fd, config, "could not write guest state file: config") max_pfn: write_exact(io_fd, &max_pfn, sizeof(unsigned long)) p2m_frame_list: write_exact(io_fd, p2m_frame_list, P2M_FL_SIZE /*Now write out each data page, canonicalising page tables as we go... */