Merge branch 'opennebula-5.8.1/get-ips' into 'master'
Opennebula 5.8.1/get ips See merge request ungleich-public/dynamicweb!691
This commit is contained in:
commit
3ba37207d1
2 changed files with 16 additions and 3 deletions
|
@ -245,6 +245,8 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id):
|
|||
}
|
||||
email = EmailMessage(**email_data)
|
||||
email.send()
|
||||
else:
|
||||
logger.debug("VM's ipv6 is None. Hence not created VMDetail")
|
||||
except Exception as e:
|
||||
logger.error(str(e))
|
||||
try:
|
||||
|
|
|
@ -168,10 +168,21 @@ class OpenNebulaManager():
|
|||
raise
|
||||
return user_pool
|
||||
|
||||
def _get_vm_pool(self):
|
||||
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
|
||||
"""
|
||||
try:
|
||||
vm_pool = oca.VirtualMachinePool(self.client)
|
||||
vm_pool.info()
|
||||
if infoextended:
|
||||
vm_pool.infoextended(
|
||||
filter_key_value_str='ID={vm_id}'.format(vm_id=vm_id) if
|
||||
vm_id is not None else '',
|
||||
vm_state=-1 # Look for VMs in any state, except DONE
|
||||
)
|
||||
else:
|
||||
vm_pool.info()
|
||||
return vm_pool
|
||||
except AttributeError:
|
||||
logger.error('Could not connect via client, using oneadmin instead')
|
||||
|
@ -202,7 +213,7 @@ class OpenNebulaManager():
|
|||
def get_vm(self, vm_id):
|
||||
vm_id = int(vm_id)
|
||||
try:
|
||||
vm_pool = self._get_vm_pool()
|
||||
vm_pool = self._get_vm_pool(vm_id)
|
||||
return vm_pool.get_by_id(vm_id)
|
||||
except WrongIdError:
|
||||
raise WrongIdError
|
||||
|
|
Loading…
Reference in a new issue