mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-11 05:17:55 +03:00
Merge remote-tracking branch 'origin/v2.1'
This commit is contained in:
commit
5037fd2bd4
@ -39,7 +39,7 @@ from . import on
|
|||||||
import pickle
|
import pickle
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
__updated__ = '2017-02-28'
|
__updated__ = '2017-03-27'
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -229,7 +229,7 @@ class LiveDeployment(UserDeployment):
|
|||||||
|
|
||||||
ret = State.RUNNING
|
ret = State.RUNNING
|
||||||
|
|
||||||
if type(chkState) is list:
|
if isinstance(chkState, (list, tuple)):
|
||||||
if state in chkState:
|
if state in chkState:
|
||||||
ret = State.FINISHED
|
ret = State.FINISHED
|
||||||
else:
|
else:
|
||||||
|
@ -34,11 +34,13 @@
|
|||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from uds.core.services import Publication
|
from uds.core.services import Publication
|
||||||
from uds.core.util.State import State
|
from uds.core.util.State import State
|
||||||
from datetime import datetime
|
|
||||||
|
import six
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
__updated__ = '2016-07-22'
|
__updated__ = '2017-03-27'
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -93,7 +95,7 @@ class LivePublication(Publication):
|
|||||||
self._templateId = self.service().makeTemplate(self._name)
|
self._templateId = self.service().makeTemplate(self._name)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._state = 'error'
|
self._state = 'error'
|
||||||
self._reason = str(e)
|
self._reason = six.text_type(e)
|
||||||
return State.ERROR
|
return State.ERROR
|
||||||
|
|
||||||
return State.RUNNING
|
return State.RUNNING
|
||||||
@ -103,9 +105,13 @@ class LivePublication(Publication):
|
|||||||
Checks state of publication creation
|
Checks state of publication creation
|
||||||
'''
|
'''
|
||||||
if self._state == 'running':
|
if self._state == 'running':
|
||||||
if self.service().checkTemplatePublished(self._templateId) is False:
|
try:
|
||||||
return
|
if self.service().checkTemplatePublished(self._templateId) is False:
|
||||||
self._state = 'ok'
|
return
|
||||||
|
self._state = 'ok'
|
||||||
|
except Exception as e:
|
||||||
|
self._state = 'error'
|
||||||
|
self._reason = six.text_type(e)
|
||||||
|
|
||||||
if self._state == 'error':
|
if self._state == 'error':
|
||||||
return State.ERROR
|
return State.ERROR
|
||||||
|
@ -43,7 +43,7 @@ import six
|
|||||||
import six
|
import six
|
||||||
from uds.core.util import xml2dict
|
from uds.core.util import xml2dict
|
||||||
|
|
||||||
__updated__ = '2016-11-10'
|
__updated__ = '2017-03-27'
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -300,6 +300,14 @@ class OpenNebulaClient(object):
|
|||||||
result = self.connection.one.vm.info(self.sessionString, int(vmId))
|
result = self.connection.one.vm.info(self.sessionString, int(vmId))
|
||||||
return int(checkResult(result)['VM']['STATE'])
|
return int(checkResult(result)['VM']['STATE'])
|
||||||
|
|
||||||
|
@ensureConnected
|
||||||
|
def getVMLCMState(self, vmId):
|
||||||
|
'''
|
||||||
|
Returns the VM State
|
||||||
|
'''
|
||||||
|
result = self.connection.one.vm.info(self.sessionString, int(vmId))
|
||||||
|
return int(checkResult(result)['VM']['LCM_STATE'])
|
||||||
|
|
||||||
@ensureConnected
|
@ensureConnected
|
||||||
def VMAction(self, vmId, action):
|
def VMAction(self, vmId, action):
|
||||||
result = self.connection.one.vm.action(self.sessionString, action, int(vmId))
|
result = self.connection.one.vm.action(self.sessionString, action, int(vmId))
|
||||||
|
@ -38,7 +38,7 @@ from defusedxml import minidom
|
|||||||
# Python bindings for OpenNebula
|
# Python bindings for OpenNebula
|
||||||
from .common import sanitizeName
|
from .common import sanitizeName
|
||||||
|
|
||||||
__updated__ = '2017-03-07'
|
__updated__ = '2017-03-27'
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -203,8 +203,11 @@ def checkPublished(api, templateId):
|
|||||||
|
|
||||||
logger.debug('Found {} for checking'.format(imgId))
|
logger.debug('Found {} for checking'.format(imgId))
|
||||||
|
|
||||||
if api.imageInfo(imgId)[0]['IMAGE']['STATE'] == '4':
|
state = api.imageInfo(imgId)[0]['IMAGE']['STATE']
|
||||||
|
if state in ('0', '4'):
|
||||||
return False
|
return False
|
||||||
|
elif state != '1': # If error is not READY
|
||||||
|
raise Exception('Error publishing. Image is in an invalid state. (Check it and delete it if not needed anymore)')
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception('Exception checking published')
|
logger.exception('Exception checking published')
|
||||||
raise
|
raise
|
||||||
|
Loading…
Reference in New Issue
Block a user