1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00

More Fixes for OpenNebula 4.x (for new API implementation)

This commit is contained in:
Adolfo Gómez García 2016-07-22 17:40:03 +02:00
parent 664418d4dc
commit 7a0c8aa977
3 changed files with 7 additions and 6 deletions

View File

@ -279,12 +279,11 @@ class OpenNebulaClient(object):
Deletes an vm Deletes an vm
''' '''
if self.version[0] == '4': if self.version[0] == '4':
result = self.VMAction(vmId, 'delete') return self.VMAction(vmId, 'delete')
else: else:
# Version 5 # Version 5
result = self.VMAction(vmId, 'terminate-hard') return self.VMAction(vmId, 'terminate-hard')
return checkResult(result, parseResult=False)
@ensureConnected @ensureConnected
def getVMState(self, vmId): def getVMState(self, vmId):

View File

@ -190,8 +190,10 @@ def checkPublished(api, templateId):
logger.debug('Found {} for checking'.format(imgId)) logger.debug('Found {} for checking'.format(imgId))
if api.getImageInfo(imgId)[0]['IMAGE']['STATE'] == '4': if api.imageInfo(imgId)[0]['IMAGE']['STATE'] == '4':
return False return False
except Exception: except Exception:
logger.exception('Exception checking published') logger.exception('Exception checking published')
raise raise
return True

View File

@ -39,7 +39,7 @@ from defusedxml import minidom
# Python bindings for OpenNebula # Python bindings for OpenNebula
from .common import VmState from .common import VmState
__updated__ = '2016-07-11' __updated__ = '2016-07-22'
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -126,7 +126,7 @@ def removeMachine(api, machineId):
# vm.delete() # vm.delete()
api.deleteVM(machineId) api.deleteVM(machineId)
except Exception as e: except Exception as e:
logger.error('Error obtaining machine state for {} on opennebula: {}'.format(machineId, e)) logger.error('Error removing machine {} on opennebula: {}'.format(machineId, e))
def enumerateMachines(api): def enumerateMachines(api):