Revision e69d05fd lib/rpc.py
b/lib/rpc.py | ||
---|---|---|
211 | 211 |
|
212 | 212 |
@type node: string |
213 | 213 |
@param node: the node on which the instance is currently running |
214 |
@type instance: instance object
|
|
214 |
@type instance: C{objects.Instance}
|
|
215 | 215 |
@param instance: the instance definition |
216 | 216 |
@type target: string |
217 | 217 |
@param target: the target node name |
... | ... | |
264 | 264 |
return c.getresult().get(node, False) |
265 | 265 |
|
266 | 266 |
|
267 |
def call_instance_info(node, instance): |
|
267 |
def call_instance_info(node, instance, hname):
|
|
268 | 268 |
"""Returns information about a single instance. |
269 | 269 |
|
270 | 270 |
This is a single-node call. |
271 | 271 |
|
272 |
@type node_list: list |
|
273 |
@param node_list: the list of nodes to query |
|
274 |
@type instance: string |
|
275 |
@param instance: the instance name |
|
276 |
@type hname: string |
|
277 |
@param hname: the hypervisor type of the instance |
|
278 |
|
|
272 | 279 |
""" |
273 | 280 |
c = Client("instance_info", [instance]) |
274 | 281 |
c.connect(node) |
... | ... | |
276 | 283 |
return c.getresult().get(node, False) |
277 | 284 |
|
278 | 285 |
|
279 |
def call_all_instances_info(node_list): |
|
280 |
"""Returns information about all instances on a given node.
|
|
286 |
def call_all_instances_info(node_list, hypervisor_list):
|
|
287 |
"""Returns information about all instances on the given nodes.
|
|
281 | 288 |
|
282 |
This is a single-node call. |
|
289 |
This is a multi-node call. |
|
290 |
|
|
291 |
@type node_list: list |
|
292 |
@param node_list: the list of nodes to query |
|
293 |
@type hypervisor_list: list |
|
294 |
@param hypervisor_list: the hypervisors to query for instances |
|
283 | 295 |
|
284 | 296 |
""" |
285 |
c = Client("all_instances_info", []) |
|
297 |
c = Client("all_instances_info", [hypervisor_list])
|
|
286 | 298 |
c.connect_list(node_list) |
287 | 299 |
c.run() |
288 | 300 |
return c.getresult() |
289 | 301 |
|
290 | 302 |
|
291 |
def call_instance_list(node_list): |
|
303 |
def call_instance_list(node_list, hypervisor_list):
|
|
292 | 304 |
"""Returns the list of running instances on a given node. |
293 | 305 |
|
294 |
This is a single-node call. |
|
306 |
This is a multi-node call. |
|
307 |
|
|
308 |
@type node_list: list |
|
309 |
@param node_list: the list of nodes to query |
|
310 |
@type hypervisor_list: list |
|
311 |
@param hypervisor_list: the hypervisors to query for instances |
|
295 | 312 |
|
296 | 313 |
""" |
297 |
c = Client("instance_list", []) |
|
314 |
c = Client("instance_list", [hypervisor_list])
|
|
298 | 315 |
c.connect_list(node_list) |
299 | 316 |
c.run() |
300 | 317 |
return c.getresult() |
... | ... | |
312 | 329 |
return c.getresult().get(node, False) |
313 | 330 |
|
314 | 331 |
|
315 |
def call_node_info(node_list, vg_name): |
|
332 |
def call_node_info(node_list, vg_name, hypervisor_type):
|
|
316 | 333 |
"""Return node information. |
317 | 334 |
|
318 | 335 |
This will return memory information and volume group size and free |
... | ... | |
320 | 337 |
|
321 | 338 |
This is a multi-node call. |
322 | 339 |
|
340 |
@type node_list: list |
|
341 |
@param node_list: the list of nodes to query |
|
342 |
@type vgname: C{string} |
|
343 |
@param vgname: the name of the volume group to ask for disk space information |
|
344 |
@type hypervisor_type: C{str} |
|
345 |
@param hypervisor_type: the name of the hypervisor to ask for |
|
346 |
memory information |
|
347 |
|
|
323 | 348 |
""" |
324 |
c = Client("node_info", [vg_name]) |
|
349 |
c = Client("node_info", [vg_name, hypervisor_type])
|
|
325 | 350 |
c.connect_list(node_list) |
326 | 351 |
c.run() |
327 | 352 |
retux = c.getresult() |
Also available in: Unified diff