Commit f0b5b879 authored by Thibault VINCENT's avatar Thibault VINCENT
Browse files

fix wrong import and nohv option

parent c0d1111b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ DEFAULT_CONFIGURATION = {

MAX_AUTH_TIMEOUT = 10

def run_node(options):
def run_node(options, hypervisor=True):

    # Setup logging facility:
    level = logging.ERROR
@@ -60,7 +60,8 @@ def run_node(options):
    logging.debug('Connecting to server')
    
    try:
        node = CCNode(options['address'], int(options['port']))
        node = CCNode(options['address'], int(options['port']),
                      hypervisor)
    except Exception as err:
        logging.critical('Starting fail: %s' % err)
        return
@@ -138,6 +139,6 @@ if __name__ == '__main__':
                options[opt] = default

    while True:
       run_node(options)
       run_node(options, hypervisor=not bool(cliopts.skip_hypervisor))
       logging.warning('Critical error, restarting node')
       sleep(2)
+2 −2
Original line number Diff line number Diff line
@@ -12,9 +12,9 @@ class CCNode(object):
    '''
    This class handles node initialization and connection and authentication
    '''
    def __init__(self, server, port, cert=None):
    def __init__(self, server, port, hypervisor, cert=None):
        self.manager = SimpleRpcClient.from_addr(server, port, enable_ssl=True,
                                        default_handler=NodeHandler(self))        
                                default_handler=NodeHandler(self, hypervisor))
        self.server = ConnectionProxy(self.manager)

    def run(self):
+3 −3
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#TODO: catch livbirt disconnection errors and handle it 


from interface import Node
from interface import Host
from kvm import *
from sjrpc.utils import RpcHandler
from sjrpc.utils import pure
@@ -57,11 +57,11 @@ class NodeHandler(RpcHandler):
    the node interface to the server.
    '''

    def __init__(self, connection):
    def __init__(self, connection, hypervisor):
        super(RpcHandler, self).__init__()
        self._connection = connection
        #do not detect hypervisor if connection is disable in configuration
        if config[skip_hypervisor]:
        if not hypervisor:
            logging.debug('Hypervisor detection disabled, running as regular'
              ' node')
            self.hv_handle = Host()