"""
instance_name = instance.name
+ port = instance.hvparams[constants.HV_MIGRATION_PORT]
pidfile, pid, alive = self._InstancePidAlive(instance_name)
if not alive:
raise errors.HypervisorError("Instance not running, cannot migrate")
+ if not utils.TcpPing(target, port, live_port_needed=True):
+ raise errors.HypervisorError("Remote host %s not listening on port"
+ " %s, cannot migrate" % (target, port))
+
if not live:
self._CallMonitorCommand(instance_name, 'stop')
- port = instance.hvparams[constants.HV_MIGRATION_PORT]
migrate_command = 'migrate -d tcp:%s:%s' % (target, port)
self._CallMonitorCommand(instance_name, migrate_command)
"""
if self.GetInstanceInfo(instance.name) is None:
raise errors.HypervisorError("Instance not running, cannot migrate")
+
port = instance.hvparams[constants.HV_MIGRATION_PORT]
+
+ if not utils.TcpPing(target, port, live_port_needed=True):
+ raise errors.HypervisorError("Remote host %s not listening on port"
+ " %s, cannot migrate" % (target, port))
+
args = ["xm", "migrate", "-p", "%d" % port]
if live:
args.append("-l")