Revision 56e7640c
b/daemons/ganeti-noded | ||
---|---|---|
391 | 391 |
return backend.GetInstanceInfo(params[0], params[1]) |
392 | 392 |
|
393 | 393 |
@staticmethod |
394 |
def perspective_instance_migratable(params): |
|
395 |
"""Query whether the specified instance can be migrated. |
|
396 |
|
|
397 |
""" |
|
398 |
instance = objects.Instance.FromDict(params[0]) |
|
399 |
return backend.GetInstanceMigratable(instance) |
|
400 |
|
|
401 |
@staticmethod |
|
394 | 402 |
def perspective_all_instances_info(params): |
395 | 403 |
"""Query information about all instances. |
396 | 404 |
|
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 |
|
b/lib/rpc.py | ||
---|---|---|
468 | 468 |
""" |
469 | 469 |
return self._SingleNodeCall(node, "instance_info", [instance, hname]) |
470 | 470 |
|
471 |
def call_instance_migratable(self, node, instance): |
|
472 |
"""Checks whether the given instance can be migrated. |
|
473 |
|
|
474 |
This is a single-node call. |
|
475 |
|
|
476 |
@param node: the node to query |
|
477 |
@type instance: L{objects.Instance} |
|
478 |
@param instance: the instance to check |
|
479 |
|
|
480 |
|
|
481 |
""" |
|
482 |
return self._SingleNodeCall(node, "instance_migratable", |
|
483 |
[self._InstDict(instance)]) |
|
484 |
|
|
471 | 485 |
def call_all_instances_info(self, node_list, hypervisor_list): |
472 | 486 |
"""Returns information about all instances on the given nodes. |
473 | 487 |
|
Also available in: Unified diff