def domain_save(self, domid, dst): """Start saving a domain to file. @param dst: destination file """ try: dominfo = self.domain_lookup_by_name_or_id_nr(domid) if not dominfo: raise XendInvalidDomain(str(domid)) if dominfo.getDomid() == PRIV_DOMAIN: raise XendError("Cannot save privileged domain %i" % domid) fd = os.open(dst, os.O_WRONLY | os.O_CREAT | os.O_TRUNC) try: # For now we don't support 'live checkpoint' return XendCheckpoint.save(fd, dominfo, False) finally: os.close(fd) except OSError, ex: raise XendError("can't write guest state file %s: %s" % (dst, ex[1]))
raise XendInvalidDomain(str(domid)) if dominfo.getDomid() == PRIV_DOMAIN: raise XendError("Cannot migrate privileged domain %i" % domid) if port == 0: port = xroot.get_xend_relocation_port() try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((dst, port)) except socket.error, err: raise XendError("can't connect: %s" % err[1]) sock.send("receive\n") sock.recv(80) XendCheckpoint.save(sock.fileno(), dominfo, live) def domain_save(self, domid, dst): """Start saving a domain to file. @param dst: destination file """ try: dominfo = self.domain_lookup_by_name_or_id_nr(domid) if not dominfo: raise XendInvalidDomain(str(domid)) if dominfo.getDomid() == PRIV_DOMAIN: raise XendError("Cannot save privileged domain %i" % domid)