Do not search for VM details like 'ID={vm_id}'

Query takes a long time and not ideal
This commit is contained in:
PCoder 2019-05-08 22:43:23 +02:00
parent f837e2b206
commit 927d4a029c
1 changed files with 2 additions and 7 deletions

View File

@ -168,17 +168,12 @@ class OpenNebulaManager():
raise
return user_pool
def _get_vm_pool(self, vm_id=None, infoextended=True):
"""
vm_id: int - the id of the VM that needs to looked up in the vm pool;
when set to None, looks for everything in the infoextended
"""
def _get_vm_pool(self, infoextended=True):
try:
vm_pool = oca.VirtualMachinePool(self.client)
if infoextended:
vm_pool.infoextended(
filter_key_value_str='ID={vm_id}'.format(vm_id=vm_id) if
vm_id is not None else '',
filter=-1,
vm_state=-1 # Look for VMs in any state, except DONE
)
else: