Revision 58d38b02 lib/hypervisor/hv_xen.py
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
392 | 392 |
The migration will not be attempted if the instance is not |
393 | 393 |
currently running. |
394 | 394 |
|
395 |
@type instance: string
|
|
396 |
@param instance: instance name
|
|
395 |
@type instance: L{objects.Instance}
|
|
396 |
@param instance: the instance to be migrated
|
|
397 | 397 |
@type target: string |
398 | 398 |
@param target: ip address of the target node |
399 | 399 |
@type live: boolean |
400 | 400 |
@param live: perform a live migration |
401 | 401 |
|
402 | 402 |
""" |
403 |
if self.GetInstanceInfo(instance) is None: |
|
403 |
if self.GetInstanceInfo(instance.name) is None:
|
|
404 | 404 |
raise errors.HypervisorError("Instance not running, cannot migrate") |
405 | 405 |
args = ["xm", "migrate"] |
406 | 406 |
if live: |
407 | 407 |
args.append("-l") |
408 |
args.extend([instance, target]) |
|
408 |
args.extend([instance.name, target])
|
|
409 | 409 |
result = utils.RunCmd(args) |
410 | 410 |
if result.failed: |
411 | 411 |
raise errors.HypervisorError("Failed to migrate instance %s: %s" % |
412 |
(instance, result.output)) |
|
412 |
(instance.name, result.output))
|
|
413 | 413 |
# remove old xen file after migration succeeded |
414 | 414 |
try: |
415 |
self._RemoveConfigFile(instance) |
|
415 |
self._RemoveConfigFile(instance.name)
|
|
416 | 416 |
except EnvironmentError: |
417 | 417 |
logging.exception("Failure while removing instance config file") |
418 | 418 |
|
Also available in: Unified diff