1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +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
'''
if self.version[0] == '4':
result = self.VMAction(vmId, 'delete')
return self.VMAction(vmId, 'delete')
else:
# Version 5
result = self.VMAction(vmId, 'terminate-hard')
return self.VMAction(vmId, 'terminate-hard')
return checkResult(result, parseResult=False)
@ensureConnected
def getVMState(self, vmId):

View File

@ -190,8 +190,10 @@ def checkPublished(api, templateId):
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
except Exception:
logger.exception('Exception checking published')
raise
return True

View File

@ -39,7 +39,7 @@ from defusedxml import minidom
# Python bindings for OpenNebula
from .common import VmState
__updated__ = '2016-07-11'
__updated__ = '2016-07-22'
logger = logging.getLogger(__name__)
@ -126,7 +126,7 @@ def removeMachine(api, machineId):
# vm.delete()
api.deleteVM(machineId)
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):