mirror of
https://github.com/dkmstr/openuds.git
synced 2025-03-12 04:58:34 +03:00
Fixed for OpenNebula 5 (seems to work fine with 4 & 5 right now)
This commit is contained in:
parent
ec95f27ee6
commit
51c32a4350
@ -43,7 +43,7 @@ import six
|
||||
import xmlrpclib
|
||||
from uds.core.util import xml2dict
|
||||
|
||||
__updated__ = '2016-07-22'
|
||||
__updated__ = '2016-07-26'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -135,7 +135,10 @@ class OpenNebulaClient(object):
|
||||
result = self.connection.one.templatepool.info(self.sessionString, -3, -1, -1)
|
||||
result = checkResult(result)
|
||||
for ds in asList(result['VMTEMPLATE_POOL']['VMTEMPLATE']):
|
||||
yield(ds['ID'], ds['NAME'], ds['TEMPLATE']['MEMORY'])
|
||||
try:
|
||||
yield(ds['ID'], ds['NAME'], ds['TEMPLATE']['MEMORY'])
|
||||
except Exception: # Maybe no memory? (then template is not usable)
|
||||
pass
|
||||
|
||||
@ensureConnected
|
||||
def enumImages(self):
|
||||
|
@ -39,7 +39,7 @@ from defusedxml import minidom
|
||||
# Python bindings for OpenNebula
|
||||
from .common import VmState
|
||||
|
||||
__updated__ = '2016-07-22'
|
||||
__updated__ = '2016-07-26'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -165,7 +165,12 @@ def getNetInfo(api, machineId, networkId=None):
|
||||
|
||||
# Default, returns first MAC found (or raise an exception if there is no MAC)
|
||||
try:
|
||||
return (node.getElementsByTagName('MAC')[0].childNodes[0].data, node.getElementsByTagName('IP')[0].childNodes[0].data)
|
||||
try:
|
||||
ip = node.getElementsByTagName('IP')[0].childNodes[0].data
|
||||
except Exception:
|
||||
ip = ''
|
||||
|
||||
return (node.getElementsByTagName('MAC')[0].childNodes[0].data, ip)
|
||||
except Exception:
|
||||
raise Exception('No network interface found on template. Please, add a network and republish.')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user