mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-03 01:17:56 +03:00
* Fixed space visualization of storages for oVirt
* Fixed a deployed service removal bug
This commit is contained in:
parent
86318a66c3
commit
9a28e53045
@ -80,6 +80,23 @@ class DeployedServiceRemover(Job):
|
||||
ds.save()
|
||||
|
||||
def continueRemovalOf(self, ds):
|
||||
# Recheck that there is no publication created in "bad moment"
|
||||
try:
|
||||
publishing = ds.publications.filter(state=State.PREPARING)
|
||||
for p in publishing:
|
||||
p.cancel()
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
# Now all publishments are canceling, let's try to cancel cache and assigned
|
||||
uServices = ds.userServices.filter(state=State.PREPARING)
|
||||
for u in uServices:
|
||||
logger.debug('Canceling {0}'.format(u))
|
||||
u.cancel()
|
||||
except:
|
||||
pass
|
||||
|
||||
# First, we remove all publications and user services in "info_state"
|
||||
ds.userServices.select_for_update().filter(state__in=State.INFO_STATES).delete()
|
||||
# Mark usable user services as removable
|
||||
|
@ -32,7 +32,7 @@ class oVirtHelpers(object):
|
||||
# Get storages for that datacenter
|
||||
for storage in provider.getDatacenterInfo(ci['datacenter_id'])['storage']:
|
||||
if storage['type'] == 'data':
|
||||
space, free = storage['available'] / 1024 / 1024 / 1024, (storage['available'] - storage['used']) / 1024 / 1024 / 1024
|
||||
space, free = (storage['available'] + storage['used']) / 1024 / 1024 / 1024, storage['available'] / 1024 / 1024 / 1024
|
||||
|
||||
res.append({'id': storage['id'], 'text': "%s (%4.2f Gb/%4.2f Gb) %s" % (storage['name'], space, free, storage['active'] and '(ok)' or '(disabled)')})
|
||||
data = [
|
||||
|
@ -112,7 +112,6 @@ class OVirtLinkedService(Service):
|
||||
|
||||
minSpaceGB = gui.NumericField(length=3, label=_('Reserved Space'), defvalue='32', order=4, tooltip=_('Minimal free space in GB'), required=True)
|
||||
|
||||
|
||||
memory = gui.NumericField(label=_("Memory (Mb)"), length=4, defvalue=512, rdonly=False, order=5,
|
||||
tooltip=_('Memory assigned to machines'), required=True)
|
||||
|
||||
@ -182,7 +181,9 @@ class OVirtLinkedService(Service):
|
||||
|
||||
def datastoreHasSpace(self):
|
||||
# Get storages for that datacenter
|
||||
logger.debug('Checking datastore space for {0}'.format(self.datastore.value))
|
||||
info = self.parent().getStorageInfo(self.datastore.value)
|
||||
logger.debug('Datastore Info: {0}'.format(info))
|
||||
availableGB = info['available'] / (1024 * 1024 * 1024)
|
||||
if availableGB < self.minSpaceGB.num():
|
||||
raise Exception('Not enough free space available: (Needs at least {0} GB and there is only {1} GB '.format(self.minSpaceGB.num(), availableGB))
|
||||
|
@ -70,33 +70,24 @@ gui.servicesPools.link = (event) ->
|
||||
|
||||
return
|
||||
|
||||
|
||||
# Fill "State" for cached and assigned services
|
||||
fillState = (data) ->
|
||||
states = {
|
||||
'R': gettext("Waiting for removal")
|
||||
'M': gettext("Removing")
|
||||
'S': gettext("Removed")
|
||||
'E': gettext("Error")
|
||||
'P': gettext("Generating")
|
||||
'K': gettext("Cancelling")
|
||||
'C': gettext("Cancelled")
|
||||
}
|
||||
$.each data, (index, value) ->
|
||||
if value.state is "U"
|
||||
value.state = if value.os_state isnt "" and value.os_state isnt "U" then gettext("Waiting OS") else value.state = gettext("Ready")
|
||||
return
|
||||
if value.state is "R"
|
||||
value.state = gettext("Waiting for removal")
|
||||
if states[value.state]?
|
||||
value.state = states[value.state]
|
||||
return
|
||||
if value.state is "M"
|
||||
value.state = gettext("Removing")
|
||||
return
|
||||
if value.state is "S"
|
||||
value.state = gettext("Removed")
|
||||
return
|
||||
if value.state is "E"
|
||||
value.state = gettext("Error")
|
||||
return
|
||||
if value.state is "P"
|
||||
value.state = gettext("Generating")
|
||||
return
|
||||
if value.state is "K"
|
||||
value.state = gettext("Cancelling")
|
||||
return
|
||||
if value.state is "C"
|
||||
value.state = gettext("Cancelled")
|
||||
value.state = gettext("Unknown")
|
||||
return
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user