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

Updated Phisical machine to allow same ip on a service more than once

Fixed comment on UserServiceCleaner
Fixed edition of services without cache
This commit is contained in:
Adolfo Gómez García 2015-07-07 11:58:34 +02:00
parent 1b232d1113
commit 1ef2c7303f
4 changed files with 50 additions and 40 deletions

View File

@ -74,7 +74,7 @@ class UserServiceRemover(Job):
super(UserServiceRemover, self).__init__(environment)
def run(self):
removeFrom = getSqlDatetime() - timedelta(seconds=10) # We keep at least 30 seconds the machine before removing it, so we avoid connections errors
removeFrom = getSqlDatetime() - timedelta(seconds=10) # We keep at least 10 seconds the machine before removing it, so we avoid connections errors
removables = UserService.objects.filter(state=State.REMOVABLE, state_date__lt=removeFrom,
deployed_service__service__provider__maintenance_mode=False)[0:UserServiceRemover.removeAtOnce]
for us in removables:

View File

@ -52,13 +52,13 @@ class IPMachineDeployed(AutoAttributes, services.UserDeployment):
logger.debug('Setting IP to %s (ignored)' % ip)
def getIp(self):
return self._ip
return self._ip.split('~')[0]
def getName(self):
return _("IP ") + self._ip
return _("IP ") + self._ip.replace('~', ':')
def getUniqueId(self):
return self._ip
return self._ip.replace('~', ':')
def setReady(self):
self._state = State.FINISHED

View File

@ -70,11 +70,13 @@ class IPMachinesService(services.Service):
if values is None or values.get('ipList', None) is None:
self._ips = []
else:
self._ips = list(values['ipList']) # Allow duplicates right now
self._ips = list('{}~{}'.format(ip, i) for i, ip in enumerate(values['ipList'])) # Allow duplicates right now
self._ips.sort()
def valuesDict(self):
return {'ipList': gui.convertToList(self._ips)}
ips = (i.split('~')[0] for i in self._ips)
return {'ipList': gui.convertToList(ips)}
def marshal(self):
self.storage().saveData('ips', cPickle.dumps(self._ips))

View File

@ -25,9 +25,8 @@ gui.servicesPools.link = (event) ->
prevTables = []
return
# On change base service
preFnc = (formId) ->
# Sets on change base service
serviceChangedFnc = (formId) ->
$fld = $(formId + " [name=\"service_id\"]")
$osmFld = $(formId + " [name=\"osmanager_id\"]")
selectors = []
@ -43,44 +42,53 @@ gui.servicesPools.link = (event) ->
$cacheFlds = $(selectors.join(","))
$cacheL2Fld = $(formId + " [name=\"cache_l2_srvs\"]")
$publishOnSaveFld = $(formId + " [name=\"publish_on_save\"]")
$fld.on "change", (event) ->
unless $fld.val() is -1
api.providers.service $fld.val(), (data) ->
gui.doLog "Onchange", data
if data.info.needs_manager is false
$osmFld.prop "disabled", "disabled"
else
$osmFld.prop "disabled", false
api.osmanagers.overview (osm) ->
$osmFld.empty()
for d in osm
for st in d.servicesTypes
if st in data.info.servicesTypeProvided
$osmFld.append('<option value="' + d.id + '">' + d.name + '</option>')
break
$osmFld.selectpicker "refresh" if $osmFld.hasClass("selectpicker")
return
unless $fld.val() is -1
api.providers.service $fld.val(), (data) ->
gui.doLog "Onchange", data
if data.info.needs_manager is false
$osmFld.prop "disabled", "disabled"
else
$osmFld.prop "disabled", false
if data.info.uses_cache is false
$cacheFlds.prop "disabled", "disabled"
api.osmanagers.overview (osm) ->
$osmFld.empty()
for d in osm
for st in d.servicesTypes
if st in data.info.servicesTypeProvided
$osmFld.append('<option value="' + d.id + '">' + d.name + '</option>')
break
$osmFld.selectpicker "refresh" if $osmFld.hasClass("selectpicker")
return
if data.info.uses_cache is false
$cacheFlds.prop "disabled", "disabled"
else
$cacheFlds.prop "disabled", false
if data.info.uses_cache_l2 is false
$cacheL2Fld.prop "disabled", "disabled"
else
$cacheFlds.prop "disabled", false
if data.info.uses_cache_l2 is false
$cacheL2Fld.prop "disabled", "disabled"
else
$cacheL2Fld.prop "disabled", false
gui.doLog "Needs publication?", data.info.needs_publication, $publishOnSaveFld
# if switch y not as required..
if $publishOnSaveFld.bootstrapSwitch("readonly") is data.info.needs_publication
$publishOnSaveFld.bootstrapSwitch "toggleReadonly", true
$osmFld.selectpicker "refresh" if $osmFld.hasClass("selectpicker")
return
$cacheL2Fld.prop "disabled", false
gui.doLog "Needs publication?", data.info.needs_publication, $publishOnSaveFld
# if switch y not as required..
if $publishOnSaveFld.bootstrapSwitch("readonly") is data.info.needs_publication
$publishOnSaveFld.bootstrapSwitch "toggleReadonly", true
$osmFld.selectpicker "refresh" if $osmFld.hasClass("selectpicker")
return
return
return
#
preFnc = (formId) ->
$fld = $(formId + " [name=\"service_id\"]")
$fld.on "change", (event) ->
serviceChangedFnc(formId)
editDataLoaded = (formId) ->
serviceChangedFnc(formId)
# Fill "State" for cached and assigned services
fillState = (data) ->
$.each data, (index, value) ->
@ -517,7 +525,7 @@ gui.servicesPools.link = (event) ->
preprocessor: preFnc
)
onEdit: gui.methods.typedEdit(gui.servicesPools, gettext("Edit") + " service pool", "Service pool " + gettext("saving error"))
onEdit: gui.methods.typedEdit(gui.servicesPools, gettext("Edit") + " service pool", "Service pool " + gettext("saving error"), { preprocessor: editDataLoaded})
onDelete: gui.methods.del(gui.servicesPools, gettext("Delete") + " service pool", "Service pool " + gettext("deletion error"))
)
return