oneclient: add get_vm_by_id function
parent
38d9e539fb
commit
b8b9dab77c
|
@ -12,3 +12,12 @@ class OneClient(object):
|
|||
def vms(self):
|
||||
self._vm_pool.info(filter=-1)
|
||||
return self._vm_pool
|
||||
|
||||
def get_vm_by_id(self, vm_id):
|
||||
if type(vm_id) != int or vm_id < 0:
|
||||
raise TypeError('vm_id must be an integer >= 0')
|
||||
self._vm_pool.info(filter=-1,
|
||||
range_start=vm_id,
|
||||
range_end=vm_id,
|
||||
vm_state=-2)
|
||||
return self._vm_pool[0] if self._vm_pool else None
|
||||
|
|
Loading…
Reference in New Issue