forked from shaba/openuds
Fixed Timings on uds Actor
Fixed oVirt to allow USB Configuration on service (for spice). Defaults to not allow.
This commit is contained in:
parent
8585d10623
commit
4196883bfb
@ -242,7 +242,7 @@ class UDSSystemTray(QtGui.QSystemTrayIcon):
|
||||
idleTime = operations.getIdleDuration()
|
||||
remainingTime = self.maxIdleTime - idleTime
|
||||
|
||||
if remainingTime > 300: # Reset show Warning dialog if we have more than 5 minutes left
|
||||
if remainingTime > 120: # Reset show Warning dialog if we have more than 5 minutes left
|
||||
self.showIdleWarn = True
|
||||
|
||||
logger.debug('User has been idle for: {}'.format(idleTime))
|
||||
|
@ -41,7 +41,7 @@ from uds.core.ui import gui
|
||||
|
||||
import logging
|
||||
|
||||
__updated__ = '2016-03-09'
|
||||
__updated__ = '2016-06-04'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -163,10 +163,23 @@ class OVirtLinkedService(Service):
|
||||
required=True
|
||||
)
|
||||
|
||||
usb = gui.ChoiceField(
|
||||
label=_('USB'),
|
||||
rdonly=False,
|
||||
order=9,
|
||||
tooltip=_('Enable usb redirection for SPICE'),
|
||||
values=[
|
||||
gui.choiceItem('disabled', 'disabled'),
|
||||
gui.choiceItem('native', 'native'),
|
||||
gui.choiceItem('legacy', 'legacy')
|
||||
],
|
||||
defvalue='1' # Default value is the ID of the choicefield
|
||||
)
|
||||
|
||||
display = gui.ChoiceField(
|
||||
label=_('Display'),
|
||||
rdonly=False,
|
||||
order=8,
|
||||
order=9,
|
||||
tooltip=_('Display type (only for administration purposes)'),
|
||||
values=[
|
||||
gui.choiceItem('spice', 'Spice'),
|
||||
@ -290,7 +303,7 @@ class OVirtLinkedService(Service):
|
||||
logger.debug('Deploying from template {0} machine {1}'.format(templateId, name))
|
||||
self.datastoreHasSpace()
|
||||
return self.parent().deployFromTemplate(name, comments, templateId, self.cluster.value,
|
||||
self.display.value, int(self.memory.value), int(self.memoryGuaranteed.value))
|
||||
self.display.value, self.usb.value, int(self.memory.value), int(self.memoryGuaranteed.value))
|
||||
|
||||
def removeTemplate(self, templateId):
|
||||
'''
|
||||
|
@ -45,7 +45,7 @@ from .client import oVirtClient
|
||||
|
||||
import logging
|
||||
|
||||
__updated__ = '2016-04-25'
|
||||
__updated__ = '2016-06-04'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -310,7 +310,7 @@ class Provider(ServiceProvider):
|
||||
'''
|
||||
return self.__getApi().removeTemplate(templateId)
|
||||
|
||||
def deployFromTemplate(self, name, comments, templateId, clusterId, displayType, memoryMB, guaranteedMB):
|
||||
def deployFromTemplate(self, name, comments, templateId, clusterId, displayType, usbType, memoryMB, guaranteedMB):
|
||||
'''
|
||||
Deploys a virtual machine on selected cluster from selected template
|
||||
|
||||
@ -326,7 +326,7 @@ class Provider(ServiceProvider):
|
||||
Returns:
|
||||
Id of the machine being created form template
|
||||
'''
|
||||
return self.__getApi().deployFromTemplate(name, comments, templateId, clusterId, displayType, memoryMB, guaranteedMB)
|
||||
return self.__getApi().deployFromTemplate(name, comments, templateId, clusterId, displayType, usbType, memoryMB, guaranteedMB)
|
||||
|
||||
def startMachine(self, machineId):
|
||||
'''
|
||||
|
@ -11,7 +11,7 @@ import threading
|
||||
import logging
|
||||
import re
|
||||
|
||||
__updated__ = '2016-04-07'
|
||||
__updated__ = '2016-06-04'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -142,7 +142,7 @@ class Client(object):
|
||||
res = []
|
||||
|
||||
for vm in vms:
|
||||
res.append({'name': vm.get_name(), 'id': vm.get_id(), 'cluster_id': vm.get_cluster().get_id()})
|
||||
res.append({'name': vm.get_name(), 'id': vm.get_id(), 'cluster_id': vm.get_cluster().get_id(), 'usb': (vm.get_usb().get_enabled(), vm.get_usb().get_type()) })
|
||||
|
||||
self._cache.put(vmsKey, res, Client.CACHE_TIME_LOW)
|
||||
|
||||
@ -444,7 +444,7 @@ class Client(object):
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
def deployFromTemplate(self, name, comments, templateId, clusterId, displayType, memoryMB, guaranteedMB):
|
||||
def deployFromTemplate(self, name, comments, templateId, clusterId, displayType, usbType, memoryMB, guaranteedMB):
|
||||
'''
|
||||
Deploys a virtual machine on selected cluster from selected template
|
||||
|
||||
@ -460,8 +460,8 @@ class Client(object):
|
||||
Returns:
|
||||
Id of the machine being created form template
|
||||
'''
|
||||
logger.debug('Deploying machine with name "{0}" from template {1} at cluster {2} with display {3}, memory {4} and guaranteed {5}'.format(
|
||||
name, templateId, clusterId, displayType, memoryMB, guaranteedMB))
|
||||
logger.debug('Deploying machine with name "{0}" from template {1} at cluster {2} with display {3} and usb {4}, memory {5} and guaranteed {6}'.format(
|
||||
name, templateId, clusterId, displayType, usbType, memoryMB, guaranteedMB))
|
||||
try:
|
||||
lock.acquire(True)
|
||||
|
||||
@ -472,10 +472,15 @@ class Client(object):
|
||||
cluster = params.Cluster(id=clusterId)
|
||||
template = params.Template(id=templateId)
|
||||
display = params.Display(type_=displayType)
|
||||
if usbType in ('native', 'legacy'):
|
||||
usb = params.Usb(enabled=True, type_=usbType)
|
||||
else:
|
||||
usb = params.Usb(enabled=False)
|
||||
|
||||
memoryPolicy = params.MemoryPolicy(guaranteed=guaranteedMB * 1024 * 1024)
|
||||
par = params.VM(name=name, cluster=cluster, template=template, description=comments,
|
||||
type_='desktop', memory=memoryMB * 1024 * 1024, memory_policy=memoryPolicy) # display=display,
|
||||
type_='desktop', memory=memoryMB * 1024 * 1024, memory_policy=memoryPolicy,
|
||||
usb=usb) # display=display,
|
||||
|
||||
return api.vms.add(par).get_id()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user