Revision 56e7640c lib/backend.py
b/lib/backend.py | ||
---|---|---|
597 | 597 |
return output |
598 | 598 |
|
599 | 599 |
|
600 |
def GetInstanceMigratable(instance): |
|
601 |
"""Gives whether an instance can be migrated. |
|
602 |
|
|
603 |
@type instance: L{objects.Instance} |
|
604 |
@param instance: object representing the instance to be checked. |
|
605 |
|
|
606 |
@rtype: tuple |
|
607 |
@return: tuple of (result, description) where: |
|
608 |
- result: whether the instance can be migrated or not |
|
609 |
- description: a description of the issue, if relevant |
|
610 |
|
|
611 |
""" |
|
612 |
hyper = hypervisor.GetHypervisor(instance.hypervisor) |
|
613 |
if instance.name not in hyper.ListInstances(): |
|
614 |
return (False, 'not running') |
|
615 |
|
|
616 |
for idx in range(len(instance.disks)): |
|
617 |
link_name = _GetBlockDevSymlinkPath(instance.name, idx) |
|
618 |
if not os.path.islink(link_name): |
|
619 |
return (False, 'not restarted since ganeti 1.2.5') |
|
620 |
|
|
621 |
return (True, '') |
|
622 |
|
|
623 |
|
|
600 | 624 |
def GetAllInstancesInfo(hypervisor_list): |
601 | 625 |
"""Gather data about all instances. |
602 | 626 |
|
Also available in: Unified diff