'Please make sure an Etcd proxy is available, pointing towards an OpenvStorage cluster.'])
        sys.exit(1)

    ServiceManager.add_service(service_name, local_client, params={'ASD_NODE_ID': alba_node_id,
                                                                   'PORT_NUMBER': str(api_port)})
    print '- Starting ASD manager service'
    try:
        ServiceManager.start_service(service_name, local_client)
    except Exception as ex:
        EtcdConfiguration.uninitialize(alba_node_id)
        print Interactive.boxed_message(['Starting asd-manager failed with error:', str(ex)])
        sys.exit(1)

    print Interactive.boxed_message(['ASD Manager setup completed'])

if __name__ == '__main__':
    if len(sys.argv) != 2:
        raise RuntimeError('Only the port number must be provided for the ASD manager')
    try:
        port = int(sys.argv[1])
    except:
        raise RuntimeError('Argument provided must be an integer (Port number for the ASD manager')
    if not 1024 < port <= 65535:
        raise RuntimeError('Port provided must be within range 1025 - 65535')

    from source.app import app
    app.run(host='0.0.0.0',
            port=int(sys.argv[1]),
            ssl_context=('server.crt', 'server.key'),
            threaded=True)
        asd_manager_config = Configuration.get('/ovs/alba/asdnodes/{0}/config/main'.format(node_id))
    except:
        raise RuntimeError('Configuration management unavailable')

    if 'ip' not in asd_manager_config or 'port' not in asd_manager_config:
        raise RuntimeError('IP and/or port not available in configuration for ALBA node {0}'.format(node_id))

    from source.app import app

    @app.before_first_request
    def setup_logging():
        """
        Configure logging
        :return: None
        """
        if app.debug is False:
            _logger = LogHandler.get('asd-manager', name='flask')
            app.logger.handlers = []
            app.logger.addHandler(_logger.handler)
            app.logger.propagate = False
            wz_logger = logging.getLogger('werkzeug')
            wz_logger.handlers = []
            wz_logger.addHandler(_logger.handler)
            wz_logger.propagate = False

    app.debug = False
    app.run(host=asd_manager_config['ip'],
            port=asd_manager_config['port'],
            ssl_context=('server.crt', 'server.key'),
            threaded=True)
Example #3
0
    except:
        raise RuntimeError('Configuration management unavailable')

    if 'ip' not in asd_manager_config or 'port' not in asd_manager_config:
        raise RuntimeError(
            'IP and/or port not available in configuration for ALBA node {0}'.
            format(node_id))

    from source.app import app

    @app.before_first_request
    def setup_logging():
        """
        Configure logging
        :return: None
        """
        for handler in app.logger.handlers:
            app.logger.removeHandler(handler)
        app.logger.addHandler(asd_manager_logger.handlers[0])
        wz_logger = logging.getLogger('werkzeug')
        wz_logger.handlers = []

    thread = Thread(target=_sync_disks, name='sync_disks')
    thread.start()

    app.debug = False
    app.run(host=asd_manager_config['ip'],
            port=asd_manager_config['port'],
            ssl_context=('../config/server.crt', '../config/server.key'),
            threaded=True)
Example #4
0
 def _run_web_app(self):
     app.run()
Example #5
0
#!/usr/bin/python2
# Copyright 2015 Open vStorage NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from source.app import app
from source.tools.configuration import Configuration

if __name__ == '__main__':
    context = ('server.crt', 'server.key')
    config = Configuration()
    config.migrate()
    app.run(host='0.0.0.0',
            port=8500,
            ssl_context=context,
            threaded=True)