mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-23 17:34:17 +03:00
Merge remote-tracking branch 'origin/v2.1'
This commit is contained in:
commit
f531d338a0
@ -40,7 +40,7 @@ from uds.core.ui import gui
|
||||
|
||||
import logging
|
||||
|
||||
__updated__ = '2017-02-02'
|
||||
__updated__ = '2017-03-28'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -214,6 +214,13 @@ class LiveService(Service):
|
||||
'''
|
||||
return self.parent().getMachineState(machineId)
|
||||
|
||||
def getMachineSubState(self, machineId):
|
||||
'''
|
||||
On OpenNebula, the machine can be "active" but not "running".
|
||||
Any active machine will have a LCM_STATE, that is what we get here
|
||||
'''
|
||||
return self.parent().getMachineSubState(machineId)
|
||||
|
||||
def startMachine(self, machineId):
|
||||
'''
|
||||
Tries to start a machine. No check is done, it is simply requested to OpenNebula.
|
||||
|
@ -50,7 +50,7 @@ import six
|
||||
# Python bindings for OpenNebula
|
||||
# import oca
|
||||
|
||||
__updated__ = '2016-11-24'
|
||||
__updated__ = '2017-03-28'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -188,6 +188,12 @@ class Provider(ServiceProvider):
|
||||
'''
|
||||
return on.vm.getMachineState(self.api, machineId)
|
||||
|
||||
def getMachineSubState(self, machineId):
|
||||
'''
|
||||
Returns the LCM_STATE of a machine (must be ready)
|
||||
'''
|
||||
return on.vm.getMachineSubstate(self.api, machineId)
|
||||
|
||||
|
||||
def startMachine(self, machineId):
|
||||
'''
|
||||
|
@ -39,7 +39,7 @@ from defusedxml import minidom
|
||||
# Python bindings for OpenNebula
|
||||
from .common import VmState
|
||||
|
||||
__updated__ = '2017-03-03'
|
||||
__updated__ = '2017-03-28'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -66,6 +66,18 @@ def getMachineState(api, machineId):
|
||||
return VmState.UNKNOWN
|
||||
|
||||
|
||||
def getMachineSubstate(api, machineId):
|
||||
'''
|
||||
Returns the lcm_state
|
||||
'''
|
||||
try:
|
||||
return api.getVMSubState(machineId)
|
||||
except Exception as e:
|
||||
logger.error('Error obtaining machine state for {} on opennebula: {}'.format(machineId, e))
|
||||
|
||||
return VmState.UNKNOWN
|
||||
|
||||
|
||||
def startMachine(api, machineId):
|
||||
'''
|
||||
Tries to start a machine. No check is done, it is simply requested to OpenNebula.
|
||||
|
@ -44,7 +44,7 @@ from uds.services.OVirt.OVirtProvider import Provider as oVirtProvider
|
||||
import logging
|
||||
import os
|
||||
|
||||
__updated__ = '2017-02-21'
|
||||
__updated__ = '2017-03-28'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -99,8 +99,27 @@ class BaseSpiceTransport(Transport):
|
||||
Checks if the transport is available for the requested destination ip
|
||||
Override this in yours transports
|
||||
'''
|
||||
logger.debug('Checking availability for {0}'.format(ip))
|
||||
return True # Spice is available, no matter what IP machine has (even if it does not have one)
|
||||
ready = self.cache.get(ip)
|
||||
if ready is None:
|
||||
userServiceInstance = userService.getInstance()
|
||||
con = userServiceInstance.getConsoleConnection()
|
||||
|
||||
logger.debug('Connection data: {}'.format(con))
|
||||
|
||||
port, secure_port = con['port'], con['secure_port']
|
||||
port = -1 if port is None else port
|
||||
secure_port = -1 if secure_port is None else secure_port
|
||||
|
||||
# test ANY of the ports
|
||||
port_to_test = port if port != -1 else secure_port
|
||||
if port_to_test == -1:
|
||||
logger.info('SPICE didn\'t find has any port: {}'.format(con))
|
||||
return False
|
||||
|
||||
if connection.testServer(ip, port_to_test) is True:
|
||||
self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
|
||||
|
||||
return ready == 'Y'
|
||||
|
||||
def processedUser(self, userService, userName):
|
||||
v = self.processUserPassword(userService, userName, '')
|
||||
|
Loading…
Reference in New Issue
Block a user