- c.ConnectList(node_list, address_list=address_list)
- return c.GetResults()
-
- @classmethod
- def _StaticMultiNodeCall(cls, node_list, procedure, args,
- address_list=None):
- """Helper for making a multi-node static call
-
- """
- body = serializer.DumpJson(args, indent=False)
- c = Client(procedure, body, utils.GetNodeDaemonPort())
- c.ConnectList(node_list, address_list=address_list)
- return c.GetResults()
-
- def _SingleNodeCall(self, node, procedure, args):
- """Helper for making a single-node call
-
- """
- body = serializer.DumpJson(args, indent=False)
- c = Client(procedure, body, self.port)
- self._ConnectNode(c, node)
- return c.GetResults().get(node, False)
-
- @classmethod
- def _StaticSingleNodeCall(cls, node, procedure, args):
- """Helper for making a single-node static call
-
- """
- body = serializer.DumpJson(args, indent=False)
- c = Client(procedure, body, utils.GetNodeDaemonPort())
- c.ConnectNode(node)
- return c.GetResults().get(node, False)
-
- #
- # Begin RPC calls
- #
-
- def call_volume_list(self, node_list, vg_name):
- """Gets the logical volumes present in a given volume group.
-
- This is a multi-node call.
-
- """
- return self._MultiNodeCall(node_list, "volume_list", [vg_name])
-
- def call_vg_list(self, node_list):
- """Gets the volume group list.
-
- This is a multi-node call.
-
- """
- return self._MultiNodeCall(node_list, "vg_list", [])
-
- def call_bridges_exist(self, node, bridges_list):
- """Checks if a node has all the bridges given.
-
- This method checks if all bridges given in the bridges_list are
- present on the remote node, so that an instance that uses interfaces
- on those bridges can be started.
-
- This is a single-node call.
-
- """
- return self._SingleNodeCall(node, "bridges_exist", [bridges_list])
-
- def call_instance_start(self, node, instance, extra_args):
- """Starts an instance.
-
- This is a single-node call.
-
- """
- return self._SingleNodeCall(node, "instance_start",
- [self._InstDict(instance), extra_args])
-
- def call_instance_shutdown(self, node, instance):
- """Stops an instance.
-
- This is a single-node call.
-
- """
- return self._SingleNodeCall(node, "instance_shutdown",
- [self._InstDict(instance)])
-
- def call_instance_migrate(self, node, instance, target, live):
- """Migrate an instance.
-
- This is a single-node call.
-
- @type node: string
- @param node: the node on which the instance is currently running
- @type instance: C{objects.Instance}
- @param instance: the instance definition
- @type target: string
- @param target: the target node name
- @type live: boolean
- @param live: whether the migration should be done live or not (the
- interpretation of this parameter is left to the hypervisor)
-
- """
- return self._SingleNodeCall(node, "instance_migrate",
- [self._InstDict(instance), target, live])
-
- def call_instance_reboot(self, node, instance, reboot_type, extra_args):
- """Reboots an instance.
-
- This is a single-node call.
-
- """
- return self._SingleNodeCall(node, "instance_reboot",
- [self._InstDict(instance), reboot_type,
- extra_args])
-
- def call_instance_os_add(self, node, inst):
- """Installs an OS on the given instance.
-
- This is a single-node call.
-
- """
- return self._SingleNodeCall(node, "instance_os_add",
- [self._InstDict(inst)])
-
- def call_instance_run_rename(self, node, inst, old_name):
- """Run the OS rename script for an instance.
-
- This is a single-node call.
-
- """
- return self._SingleNodeCall(node, "instance_run_rename",
- [self._InstDict(inst), old_name])
-
- def call_instance_info(self, node, instance, hname):
- """Returns information about a single instance.
-
- This is a single-node call.
-
- @type node: list
- @param node: the list of nodes to query
- @type instance: string
- @param instance: the instance name
- @type hname: string
- @param hname: the hypervisor type of the instance
-
- """
- return self._SingleNodeCall(node, "instance_info", [instance, hname])
-
- def call_all_instances_info(self, node_list, hypervisor_list):
- """Returns information about all instances on the given nodes.
-
- This is a multi-node call.
-
- @type node_list: list
- @param node_list: the list of nodes to query
- @type hypervisor_list: list
- @param hypervisor_list: the hypervisors to query for instances
-
- """
- return self._MultiNodeCall(node_list, "all_instances_info",
- [hypervisor_list])