# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 36e0159c001b72969c5c9a9bf8bb48d8cfa932fa
# Parent 60f7b567bb2b00d9dcf6ed86847feba4f9462177
This patch adds a boolean parameter 'network' to the save method of the
XendCheckpoint class to differentiate between network suspend/resume
(network=True) and local suspend/resume (network=False).
Instead of passing the 'live' parameter to the migration methods, this
'network' parameter is passed now. This ends up being merely a renaming
of the parameter.
A check with the xm-test suite against this change has resulted in no
additional errors.
Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
---
tools/python/xen/xend/XendCheckpoint.py | 8 ++++----
tools/python/xen/xend/XendDomain.py | 6 +++---
tools/python/xen/xend/XendDomainInfo.py | 24 ++++++++++++++----------
tools/python/xen/xend/server/DevController.py | 8 ++++----
tools/python/xen/xend/server/tpmif.py | 12 ++++++------
5 files changed, 31 insertions(+), 27 deletions(-)
diff -r 60f7b567bb2b -r 36e0159c001b tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py Wed May 10 16:47:00 2006 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py Wed May 10 16:52:55 2006 +0100
@@ -54,7 +54,7 @@ def read_exact(fd, size, errmsg):
-def save(fd, dominfo, live, dst):
+def save(fd, dominfo, network, live, dst):
write_exact(fd, SIGNATURE, "could not write guest state file: signature")
config = sxp.to_string(dominfo.sxpr())
@@ -66,7 +66,7 @@ def save(fd, dominfo, live, dst):
dominfo.setName('migrating-' + domain_name)
try:
- dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP1, domain_name)
+ dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP1, domain_name)
write_exact(fd, pack("!i", len(config)),
"could not write guest state file: config len")
@@ -88,10 +88,10 @@ def save(fd, dominfo, live, dst):
log.debug("Suspending %d ...", dominfo.getDomid())
dominfo.shutdown('suspend')
dominfo.waitForShutdown()
- dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP2,
+ dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2,
domain_name)
log.info("Domain %d suspended.", dominfo.getDomid())
- dominfo.migrateDevices(live, dst, DEV_MIGRATE_STEP3,
+ dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP3,
domain_name)
tochild.write("done\n")
tochild.flush()
diff -r 60f7b567bb2b -r 36e0159c001b tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed May 10 16:47:00 2006 +0100
+++ b/tools/python/xen/xend/XendDomain.py Wed May 10 16:52:55 2006 +0100
@@ -408,7 +408,7 @@ class XendDomain:
raise XendError("Cannot migrate privileged domain %i" % domid)
""" The following call may raise a XendError exception """
- dominfo.testMigrateDevices(live, dst)
+ dominfo.testMigrateDevices(True, dst)
if port == 0:
port = xroot.get_xend_relocation_port()
@@ -420,7 +420,7 @@ class XendDomain:
sock.send("receive\n")
sock.recv(80)
- XendCheckpoint.save(sock.fileno(), dominfo, live, dst)
+ XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst)
def domain_save(self, domid, dst):
@@ -440,7 +440,7 @@ class XendDomain:
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, dst)
+ return XendCheckpoint.save(fd, dominfo, False, False, dst)
finally:
os.close(fd)
except OSError, ex:
diff -r 60f7b567bb2b -r 36e0159c001b tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Wed May 10 16:47:00 2006 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py Wed May 10 16:52:55 2006 +0100
@@ -1443,36 +1443,40 @@ class XendDomainInfo:
## public:
- def testMigrateDevices(self, live, dst):
+ def testMigrateDevices(self, network, dst):
""" Notify all device about intention of migration
@raise: XendError for a device that cannot be migrated
"""
for (n, c) in self.info['device']:
- rc = self.migrateDevice(n, c, live, dst, DEV_MIGRATE_TEST)
+ rc = self.migrateDevice(n, c, network, dst, DEV_MIGRATE_TEST)
if rc != 0:
raise XendError("Device of type '%s' refuses migration." % n)
- def migrateDevices(self, live, dst, step, domName=''):
+ def migrateDevices(self, network, dst, step, domName=''):
"""Notify the devices about migration
"""
ctr = 0
try:
for (n, c) in self.info['device']:
- self.migrateDevice(n, c, live, dst, step, domName)
+ self.migrateDevice(n, c, network, dst, step, domName)
ctr = ctr + 1
except:
for (n, c) in self.info['device']:
if ctr == 0:
step = step - 1
ctr = ctr - 1
- self.recoverMigrateDevice(n, c, live, dst, step, domName)
+ self.recoverMigrateDevice(n, c, network, dst, step, domName)
raise
- def migrateDevice(self, deviceClass, deviceConfig, live, dst, step,
domName=''):
- return self.getDeviceController(deviceClass).migrate(deviceConfig,
live, dst, step, domName)
-
- def recoverMigrateDevice(self, deviceClass, deviceConfig, live, dst, step,
domName=''):
- return
self.getDeviceController(deviceClass).recover_migrate(deviceConfig, live, dst,
step, domName)
+ def migrateDevice(self, deviceClass, deviceConfig, network, dst,
+ step, domName=''):
+ return self.getDeviceController(deviceClass).migrate(deviceConfig,
+ network, dst, step, domName)
+
+ def recoverMigrateDevice(self, deviceClass, deviceConfig, network,
+ dst, step, domName=''):
+ return self.getDeviceController(deviceClass).recover_migrate(
+ deviceConfig, network, dst, step, domName)
def waitForDevices(self):
"""Wait for this domain's configured devices to connect.
diff -r 60f7b567bb2b -r 36e0159c001b
tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py Wed May 10 16:47:00
2006 +0100
+++ b/tools/python/xen/xend/server/DevController.py Wed May 10 16:52:55
2006 +0100
@@ -267,9 +267,9 @@ class DevController:
raise NotImplementedError()
- def migrate(self, deviceConfig, live, dst, step, domName):
- """ Migration of a device. The 'live' parameter indicates
- whether the device is live-migrated (live=1). 'dst' then gives
+ def migrate(self, deviceConfig, network, dst, step, domName):
+ """ Migration of a device. The 'network' parameter indicates
+ whether the device is network-migrated (True). 'dst' then gives
the hostname of the machine to migrate to.
This function is called for 4 steps:
If step == 0: Check whether the device is ready to be migrated
@@ -296,7 +296,7 @@ class DevController:
return 0
- def recover_migrate(self, deviceConfig, list, dst, step, domName):
+ def recover_migrate(self, deviceConfig, network, dst, step, domName):
""" Recover from device migration. The given step was the
last one that was successfully executed.
"""
diff -r 60f7b567bb2b -r 36e0159c001b tools/python/xen/xend/server/tpmif.py
--- a/tools/python/xen/xend/server/tpmif.py Wed May 10 16:47:00 2006 +0100
+++ b/tools/python/xen/xend/server/tpmif.py Wed May 10 16:52:55 2006 +0100
@@ -71,12 +71,12 @@ class TPMifController(DevController):
return result
- def migrate(self, deviceConfig, live, dst, step, domName):
+ def migrate(self, deviceConfig, network, dst, step, domName):
"""@see DevContoller.migrate"""
- if live:
+ if network:
tool = xroot.get_external_migration_tool()
if tool != '':
- log.info("Request to live-migrate device to %s. step=%d.",
+ log.info("Request to network-migrate device to %s. step=%d.",
dst, step)
if step == DEV_MIGRATE_TEST:
@@ -99,12 +99,12 @@ class TPMifController(DevController):
return -1
return 0
- def recover_migrate(self, deviceConfig, live, dst, step, domName):
+ def recover_migrate(self, deviceConfig, network, dst, step, domName):
"""@see DevContoller.recover_migrate"""
- if live:
+ if network:
tool = xroot.get_external_migration_tool()
if tool != '':
- log.info("Request to recover live-migrated device. last good
step=%d.",
+ log.info("Request to recover network-migrated device. last
good step=%d.",
step)
fd = os.popen("%s -type vtpm -step %d -host %s -domname %s
-recover" %
(tool, step, dst, domName),
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|