[XEND] Activate a declared external device migration script for all devices and all save modes.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
This commit is contained in:
kfraser@localhost.localdomain committed 2006-12-14 10:00:56 +00:00
1 parent c1c2224094
commit 49f6907f34
1 file changed
+25 -1
+25 -1
View File
@@ -19,13 +19,15 @@
from threading import Event
import types
from xen.xend import sxp
from xen.xend import sxp, XendRoot
from xen.xend.XendError import VmError
from xen.xend.XendLogging import log
from xen.xend.xenstore.xstransact import xstransact, complete
from xen.xend.xenstore.xswatch import xswatch
import os
DEVICE_CREATE_TIMEOUT = 100
HOTPLUG_STATUS_NODE = "hotplug-status"
HOTPLUG_ERROR_NODE = "hotplug-error"
@@ -48,6 +50,8 @@ xenbusState = {
'Closed' : 6,
}
xroot = XendRoot.instance()
xenbusState.update(dict(zip(xenbusState.values(), xenbusState.keys())))
@@ -313,6 +317,16 @@ class DevController:
Make sure that the migration has finished and only
then return from the call.
"""
tool = xroot.get_external_migration_tool()
if tool:
log.info("Calling external migration tool for step %d" % step)
fd = os.popen("%s -type %s -step %d -host %s -domname %s" %
(tool, self.deviceClass, step, dst, domName))
for line in fd:
log.info(line.rstrip())
rc = fd.close()
if rc:
raise VmError('Migration tool returned %d' % (rc >> 8))
return 0
@@ -320,6 +334,16 @@ class DevController:
""" Recover from device migration. The given step was the
last one that was successfully executed.
"""
tool = xroot.get_external_migration_tool()
if tool:
log.info("Calling external migration tool")
fd = os.popen("%s -type %s -step %d -host %s -domname %s -recover" %
(tool, self.deviceClass, step, dst, domName))
for line in fd:
log.info(line.rstrip())
rc = fd.close()
if rc:
raise VmError('Migration tool returned %d' % (rc >> 8))
return 0
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.