Beispiel #1
0
def get_state_dir(suffix=''):
    args = conf.get_args()
    state_dir = '/'.join((args.state_dir, ))
    if suffix not in DIR_INITED:
        cfgfile.ensure_path_exists(state_dir,
                                   owner=os.getuid(),
                                   group=os.getgid())
        DIR_INITED.add(suffix)
    return state_dir
Beispiel #2
0
def pre_flight():
    args = conf.get_args()
    state_dir = args.state_dir
    cfgfile.content_file(state_dir + '/admin-openrc.sh',
                         util.userrc_script('admin'), owner=os.getuid(), group=os.getgid())
    keystone = facility.get_component('keystone')
    keystone.register_project_in_domain('Default', 'demo', 'demo project')
    keystone.register_user_in_domain('Default', 'demo',
                                     password=util.get_keymgr()('keystone', 'demo@default'),
                                     email='*****@*****.**',
                                     project_roles={('Default', 'demo'): ['user']})

    cfgfile.content_file(state_dir + '/demo-openrc.sh',
                         util.userrc_script('demo'), owner=os.getuid(), group=os.getgid())
Beispiel #3
0
def init_transfer():
    global payload_size, payload_path
    location = __file__.split(os.path.sep)
    sl_dir = os.sep.join((location[0:-1]))  # speedling/control.py

    main_loc = __main__.__file__.split(os.path.sep)
    main_dir = os.sep.join(main_loc[0:-1])
    payload_size = -1
    temp_dir = tempfile.mkdtemp()
    # TODO: delete on exit
    payload_path = temp_dir + '/payload.tar.gz'
    extra = set(conf.get_args().extra_module)
    dirs = {main_dir, sl_dir}.union(extra)
    tar(payload_path, dirs)
    payload_size = os.path.getsize(payload_path)
    atexit.register(shutil.rmtree, temp_dir)
Beispiel #4
0
def create_inventory_and_glb():
    args = conf.get_args()
    gconf = conf.GLOBAL_CONFIG
    if args.all_in_one:
        invent = all_in_one_inv()
        # hack until not switching to the new form
        addr = list(invent['hosts'].values())[0]['ssh_address']
        gconf['vip'] = {'public': {'domain_name': addr, 'internal_address': addr},
                        'internal': {'domain_name': addr, 'internal_address': addr}}
    else:
        invent = invutil.parse_ansible_invetory_ini(args.inv_extend)
        # hack until not switching to the new form , also not ordered..
        controller = next(iter(invent['host_in_group']['controller']))
        addr = invent['hosts'][controller]['sl_ssh_address']
        gconf['vip'] = {'public': {'domain_name': addr, 'internal_address': addr},
                        'internal': {'domain_name': addr, 'internal_address': addr}}

    my_controller_services = {'haproxy', 'mariadb', 'rabbit', 'keystone', 'memcached',
                              'neutron-server', 'neutron-dhcp-agent', 'neutron-metadata-agent',
                              'neutron-l3-agent', 'glance-api', 'glance-registry', 'nova-api',
                              'nova-consoleauth', 'nova-scheduler', 'nova-conductor',
                              'nova-novncproxy', 'cinder-backup', 'cinder-api',
                              'cinder-scheduler', 'cinder-volume', 'ceph-osd',
                              'ceph-mgr', 'ceph-mon',  'placement-api', 'swift-object',
                              'swift-container', 'swift-account', 'swift-proxy',
                              'neutron-metering-agent', 'swift-container-sync',
                              'neutron-openvswitch-agent', 'openvswitch', 'neutron-metering-agent'}
    my_worker_services = {'nova-compute', 'neutron-openvswitch-agent', 'openvswitch', 'libvirtd'}

    inv_extend(invent, my_controller_services, my_worker_services)

    service_flags = set()
    EMPTY_SET = set()
    global_component_flags = set()
    gconf['global_service_flags'] = service_flags
    gconf['global_component_flags'] = global_component_flags
    for n, node in inv.INVENTORY.items():
        services = node.get('services', EMPTY_SET)
        service_flags.update(services)
        components = node.get('components', EMPTY_SET)
        global_component_flags.update(components)
Beispiel #5
0
def is_receiver():
    args = conf.get_args()
    return args.receiver
Beispiel #6
0
 def get_mariadb_state_dir(self):
     args = conf.get_args()
     state_dir = args.state_dir
     return state_dir + '/mariadb'