forked from shaba/openuds
Fixed check due 2.0 just works only with opennebula 4.x due to api
changes on 5.x. 2.1 will cover both vversions
This commit is contained in:
parent
243cbbfd4b
commit
d0e0418ede
@ -50,7 +50,7 @@ import six
|
||||
# Python bindings for OpenNebula
|
||||
import oca
|
||||
|
||||
__updated__ = '2016-04-25'
|
||||
__updated__ = '2016-07-11'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -149,8 +149,9 @@ class Provider(ServiceProvider):
|
||||
'''
|
||||
|
||||
try:
|
||||
if self.api.version() < '4.1':
|
||||
return [False, 'OpenNebula version is not supported (required version 4.1 or newer)']
|
||||
ver = self.api.version()
|
||||
if ver < '4.1' or ver >= '5':
|
||||
return [False, 'OpenNebula version is not supported (required version 4.x)']
|
||||
except Exception as e:
|
||||
return [False, '{}'.format(e)]
|
||||
|
||||
|
@ -39,7 +39,7 @@ from defusedxml import minidom
|
||||
# Python bindings for OpenNebula
|
||||
from .common import VmState
|
||||
|
||||
__updated__ = '2016-02-09'
|
||||
__updated__ = '2016-07-11'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -161,7 +161,10 @@ def getNetInfo(api, machineId, networkId=None):
|
||||
break
|
||||
|
||||
# Default, returns first MAC found (or raise an exception if there is no MAC)
|
||||
return (node.getElementsByTagName('MAC')[0].childNodes[0].data, node.getElementsByTagName('IP')[0].childNodes[0].data)
|
||||
try:
|
||||
return (node.getElementsByTagName('MAC')[0].childNodes[0].data, node.getElementsByTagName('IP')[0].childNodes[0].data)
|
||||
except Exception:
|
||||
raise Exception('No network interface found on template. Please, add a network and republish.')
|
||||
|
||||
# Sample NIC Content (there will be as much as nics)
|
||||
# <NIC>
|
||||
|
Loading…
x
Reference in New Issue
Block a user