Revision 60af751d
b/lib/hypervisor/hv_chroot.py | ||
---|---|---|
291 | 291 |
|
292 | 292 |
""" |
293 | 293 |
raise HypervisorError("Migration not supported by the chroot hypervisor") |
294 |
|
|
295 |
def GetMigrationStatus(self, instance): |
|
296 |
"""Get the migration status |
|
297 |
|
|
298 |
@type instance: L{objects.Instance} |
|
299 |
@param instance: the instance that is being migrated |
|
300 |
@rtype: L{objects.MigrationStatus} |
|
301 |
@return: the status of the current migration (one of |
|
302 |
L{constants.HV_MIGRATION_VALID_STATUSES}), plus any additional |
|
303 |
progress info that can be retrieved from the hypervisor |
|
304 |
|
|
305 |
""" |
|
306 |
raise HypervisorError("Migration not supported by the chroot hypervisor") |
b/lib/hypervisor/hv_fake.py | ||
---|---|---|
259 | 259 |
logging.debug("Fake hypervisor migrating %s to %s (live=%s)", |
260 | 260 |
instance, target, live) |
261 | 261 |
|
262 |
self._MarkDown(instance.name) |
|
263 |
|
|
264 |
def FinalizeMigration(self, instance, info, success): |
|
265 |
"""Finalize an instance migration. |
|
262 |
def FinalizeMigrationDst(self, instance, info, success): |
|
263 |
"""Finalize the instance migration on the target node. |
|
266 | 264 |
|
267 | 265 |
For the fake hv, this just marks the instance up. |
268 | 266 |
|
269 | 267 |
@type instance: L{objects.Instance} |
270 | 268 |
@param instance: instance whose migration is being finalized |
269 |
@type info: string/data (opaque) |
|
270 |
@param info: migration information, from the source node |
|
271 |
@type success: boolean |
|
272 |
@param success: whether the migration was a success or a failure |
|
271 | 273 |
|
272 | 274 |
""" |
273 | 275 |
if success: |
... | ... | |
275 | 277 |
else: |
276 | 278 |
# ensure it's down |
277 | 279 |
self._MarkDown(instance.name) |
280 |
|
|
281 |
def PostMigrationCleanup(self, instance): |
|
282 |
"""Clean-up after a migration. |
|
283 |
|
|
284 |
To be executed on the source node. |
|
285 |
|
|
286 |
@type instance: L{objects.Instance} |
|
287 |
@param instance: the instance that was migrated |
|
288 |
|
|
289 |
""" |
|
290 |
pass |
|
291 |
|
|
292 |
def FinalizeMigrationSource(self, instance, success, live): |
|
293 |
"""Finalize the instance migration on the source node. |
|
294 |
|
|
295 |
@type instance: L{objects.Instance} |
|
296 |
@param instance: the instance that was migrated |
|
297 |
@type success: bool |
|
298 |
@param success: whether the migration succeeded or not |
|
299 |
@type live: bool |
|
300 |
@param live: whether the user requested a live migration or not |
|
301 |
|
|
302 |
""" |
|
303 |
# pylint: disable=W0613 |
|
304 |
if success: |
|
305 |
self._MarkDown(instance.name) |
|
306 |
|
|
307 |
def GetMigrationStatus(self, instance): |
|
308 |
"""Get the migration status |
|
309 |
|
|
310 |
The fake hypervisor migration always succeeds. |
|
311 |
|
|
312 |
@type instance: L{objects.Instance} |
|
313 |
@param instance: the instance that is being migrated |
|
314 |
@rtype: L{objects.MigrationStatus} |
|
315 |
@return: the status of the current migration (one of |
|
316 |
L{constants.HV_MIGRATION_VALID_STATUSES}), plus any additional |
|
317 |
progress info that can be retrieved from the hypervisor |
|
318 |
|
|
319 |
""" |
|
320 |
return objects.MigrationStatus(status=constants.HV_MIGRATION_COMPLETED) |
b/lib/hypervisor/hv_lxc.py | ||
---|---|---|
413 | 413 |
|
414 | 414 |
""" |
415 | 415 |
raise HypervisorError("Migration is not supported by the LXC hypervisor") |
416 |
|
|
417 |
def GetMigrationStatus(self, instance): |
|
418 |
"""Get the migration status |
|
419 |
|
|
420 |
@type instance: L{objects.Instance} |
|
421 |
@param instance: the instance that is being migrated |
|
422 |
@rtype: L{objects.MigrationStatus} |
|
423 |
@return: the status of the current migration (one of |
|
424 |
L{constants.HV_MIGRATION_VALID_STATUSES}), plus any additional |
|
425 |
progress info that can be retrieved from the hypervisor |
|
426 |
|
|
427 |
""" |
|
428 |
raise HypervisorError("Migration is not supported by the LXC hypervisor") |
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
415 | 415 |
""" |
416 | 416 |
pass |
417 | 417 |
|
418 |
def FinalizeMigration(self, instance, info, success): |
|
418 |
def FinalizeMigrationDst(self, instance, info, success):
|
|
419 | 419 |
"""Finalize an instance migration. |
420 | 420 |
|
421 | 421 |
After a successful migration we write the xen config file. |
... | ... | |
463 | 463 |
if result.failed: |
464 | 464 |
raise errors.HypervisorError("Failed to migrate instance %s: %s" % |
465 | 465 |
(instance.name, result.output)) |
466 |
# remove old xen file after migration succeeded |
|
467 |
try: |
|
468 |
self._RemoveConfigFile(instance.name) |
|
469 |
except EnvironmentError: |
|
470 |
logging.exception("Failure while removing instance config file") |
|
466 |
|
|
467 |
def FinalizeMigrationSource(self, instance, success, live): |
|
468 |
"""Finalize the instance migration on the source node. |
|
469 |
|
|
470 |
@type instance: L{objects.Instance} |
|
471 |
@param instance: the instance that was migrated |
|
472 |
@type success: bool |
|
473 |
@param success: whether the migration succeeded or not |
|
474 |
@type live: bool |
|
475 |
@param live: whether the user requested a live migration or not |
|
476 |
|
|
477 |
""" |
|
478 |
# pylint: disable=W0613 |
|
479 |
if success: |
|
480 |
# remove old xen file after migration succeeded |
|
481 |
try: |
|
482 |
self._RemoveConfigFile(instance.name) |
|
483 |
except EnvironmentError: |
|
484 |
logging.exception("Failure while removing instance config file") |
|
485 |
|
|
486 |
def GetMigrationStatus(self, instance): |
|
487 |
"""Get the migration status |
|
488 |
|
|
489 |
As MigrateInstance for Xen is still blocking, if this method is called it |
|
490 |
means that MigrateInstance has completed successfully. So we can safely |
|
491 |
assume that the migration was successful and notify this fact to the client. |
|
492 |
|
|
493 |
@type instance: L{objects.Instance} |
|
494 |
@param instance: the instance that is being migrated |
|
495 |
@rtype: L{objects.MigrationStatus} |
|
496 |
@return: the status of the current migration (one of |
|
497 |
L{constants.HV_MIGRATION_VALID_STATUSES}), plus any additional |
|
498 |
progress info that can be retrieved from the hypervisor |
|
499 |
|
|
500 |
""" |
|
501 |
return objects.MigrationStatus(status=constants.HV_MIGRATION_COMPLETED) |
|
471 | 502 |
|
472 | 503 |
@classmethod |
473 | 504 |
def PowercycleNode(cls): |
Also available in: Unified diff