示例#1
0
def task_network_id(self):
    self.wait_for_components(self.neutron, self.osclient, self.keystone)
    tempest_nodes = self.hosts_with_component('tempest')
    netter = util.rand_pick(tempest_nodes)
    r = self.call_do(netter, self.do_network_id)
    self.network_id = r[next(iter(netter))]['return_value']
    assert self.network_id
示例#2
0
def task_mariadb_steps(self):
    h = self.hosts_with_service('mariadb')
    host_ips = []
    for n in h:
        i = self.get_node(n)['inv']
        addr = self.get_addr_for(i, 'listen')
        host_ips.append(addr)

    self.call_do(h, self.do_mariadb_cfg, c_kwargs={'nodes': host_ips})
    state_dir = self.get_mariadb_state_dir()
    self.file_path(state_dir,
                   owner=os.getuid(),
                   group=os.getgid())

    seed = util.rand_pick(h)
    self.call_do(seed, self.do_mariadb_galera_seed)
    self.mark_mariadb_boostrap()
    self.call_do(h, self.do_mariadb)
    while True:
        r = self.call_do(h, self.do_mariadb_query_state)
        wsrep_cluster_conf_id = set()
        for n, res in r.items():
            wsrep_cluster_conf_id.add(res['return_value']['wsrep_cluster_conf_id'])
            if res['return_value']['wsrep_cluster_size'] != len(h):
                LOG.info('Wating for mariadb cluster size to change')
                time.sleep(0.1)
                continue
        if len(wsrep_cluster_conf_id) != 1:
            LOG.info('Wating for mariadb cluster conf sync')
            time.sleep(0.1)
        else:
            break
    self.call_do(seed, self.do_create_clustr_user)
    self.call_do(seed, self.do_handle_schemas, c_kwargs={'schemas': self.schema_registry})
示例#3
0
def task_keystone_db(self):
    self.wait_for_components(self.sql)
    # TODO: change the function to near db and near key parts
    schema_node_candidate = self.hosts_with_service('keystone')
    schema_node = util.rand_pick(schema_node_candidate)
    sync_cmd = 'su -s /bin/sh -c "keystone-manage db_sync" keystone'
    self.call_do(schema_node,
                 facility.do_retrycmd_after_content,
                 c_args=(sync_cmd, ))
示例#4
0
def task_keystone_fernet(self):
    keystones = self.hosts_with_service('keystone')
    src_node = util.rand_pick(keystones)
    dst_nodes = keystones - src_node
    assert src_node
    self.call_do(src_node, self.do_fernet_init)
    if dst_nodes:
        ret = self.call_do(src_node, self.do_fetch_fernet_as_tar)
        fernet_tar = ret[next(iter(src_node))]['return_value']
        self.distribute_for_command(dst_nodes, fernet_tar, 'tar -C / -x')
示例#5
0
def task_glance_steps(self):
    schema_node_candidate = self.hosts_with_service('glance-api')
    schema_node = util.rand_pick(schema_node_candidate)
    self.wait_for_components(self.sql)
    sync_cmd = 'su -s /bin/sh -c "glance-manage db_sync && glance-manage db load_metadefs" glance'
    self.call_do(schema_node, facility.do_retrycmd_after_content, c_args=(sync_cmd, ))

    self.wait_for_components(self.messaging)
    # start services
    self.call_do(self.hosts_with_any_service(g_srv), self.do_local_glance_service_start)
    facility.task_wants(self.keystone.final_task, *set.union(*(s['component'].get_waits_for_glance_task() for s in self.backends)))
示例#6
0
def task_neutron_steps(self):
    self.wait_for_components(self.sql)
    schema_node_candidate = self.hosts_with_service('neutron-server')
    schema_node = util.rand_pick(schema_node_candidate)

    sync_cmd = 'su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron'
    self.call_do(schema_node,
                 facility.do_retrycmd_after_content,
                 c_args=(sync_cmd, ))
    facility.task_will_need(self.task_net_config)
    self.wait_for_components(self.messaging)
    facility.task_wants(self.task_net_config)

    q_srv = set(self.services.keys())
    self.call_do(self.hosts_with_any_service(q_srv),
                 self.do_local_neutron_service_start)
    self.wait_for_components(self.messaging)
    self.wait_for_components(self.osclient)
    self.call_do(util.rand_pick(self.hosts_with_service('neutron-server')),
                 self.do_dummy_public_net)
示例#7
0
def task_placement_steps(self):
    placements = self.hosts_with_service('placement-api')
    schema_node_candidate = placements
    schema_node = util.rand_pick(schema_node_candidate)
    self.wait_for_components(self.sql)

    sync_cmd = 'su -s /bin/sh -c "placement-manage db sync" placement'
    self.call_do(schema_node,
                 facility.do_retrycmd_after_content,
                 c_args=(sync_cmd, ))

    self.call_do(placements, self.do_local_placement_service_start)
示例#8
0
def task_cinder_steps(self):
    c_srv = set(self.services.keys())
    self.wait_for_components(self.sql)

    schema_node_candidate = self.hosts_with_service('cinder-api')
    schema_node = util.rand_pick(schema_node_candidate)
    sync_cmd = 'su -s /bin/sh -c "cinder-manage db sync" cinder'
    self.call_do(schema_node, facility.do_retrycmd_after_content, c_args=(sync_cmd, ))

    # start services
    self.call_do(self.hosts_with_any_service(c_srv), self.do_local_cinder_service_start)
    self.wait_for_components(self.messaging, self.keystone)
    facility.task_wants(self.keystone.final_task, self.messaging.final_task,
                        *set.union(*(s['component'].get_waits_for_cinder_task() for s in self.backends)))
示例#9
0
def task_tempest_steps(self):
    tempest_nodes = self.hosts_with_component('tempest')
    self.call_do(tempest_nodes, self.do_fetch_image)

    self.wait_for_components(self.glance, self.osclient, self.keystone)
    imager = util.rand_pick(tempest_nodes)
    r = self.call_do(imager, self.do_ensure_test_images)
    (image_ref, image_ref_alt) = r[next(iter(imager))]['return_value']
    facility.task_wants(self.task_network_id)
    self.call_do(tempest_nodes,
                 self.do_tempest_cfg,
                 c_kwargs={
                     'image_ref':
                     image_ref,
                     'image_ref_alt':
                     image_ref_alt,
                     'public_network_id':
                     self.network_id,
                     'min_compute_nodes':
                     len(self.hosts_with_service('nova-compute'))
                 })
    facility.task_wants(self.task_nova_flavors)
示例#10
0
def task_nova_steps(self):
    novas = self.hosts_with_service('nova-api')
    schema_node_candidate = novas
    schema_node = util.rand_pick(schema_node_candidate)
    self.wait_for_components(self.sql)

    sync_cmd = 'su -s /bin/sh -c "nova-manage api_db sync" nova'
    self.call_do(schema_node,
                 facility.do_retrycmd_after_content,
                 c_args=(sync_cmd, ))

    # actual cell sync is the nova db sync
    sync_cmd = 'su -s /bin/sh -c "nova-manage cell_v2 map_cell0 && (nova-manage cell_v2 list_cells | grep \'^| .*cell1\' -q || nova-manage cell_v2 create_cell --name=cell1 --verbose)"'
    self.call_do(schema_node,
                 facility.do_retrycmd_after_content,
                 c_args=(sync_cmd, ))

    sync_cmd = 'su -s /bin/sh -c "nova-manage db sync" nova'
    self.call_do(schema_node,
                 facility.do_retrycmd_after_content,
                 c_args=(sync_cmd, ))

    n_srv = set(self.services.keys())

    wait_list = [self.messaging]
    if self.novncweb:
        wait_list.append(self.novncweb)

    if self.spiceweb:
        wait_list.append(self.spiceweb)

    self.wait_for_components(*wait_list)
    # start services
    self.call_do(self.hosts_with_any_service(n_srv),
                 self.do_local_nova_service_start)

    self.wait_for_components(self.keystone, self.virtdriver)
    self.call_do(novas, self.do_cell_reg)
示例#11
0
def task_keystone_users(self):
    facility.task_wants(self.task_cfg_keystone_steps, self.task_cfg_httpd)
    self.call_do(util.rand_pick(self.hosts_with_service('keystone')),
                 self.do_keystone_user_sync,
                 c_args=(self.registered_user_dom, ))
示例#12
0
def task_cfg_keystone_steps(self):
    facility.task_will_need(self.task_cfg_httpd)
    facility.task_wants(self.task_keystone_db, self.task_keystone_fernet)
    keystones = self.hosts_with_service('keystone')
    self.call_do(util.rand_pick(keystones), self.do_keystone_init)
示例#13
0
 def step_keystone_endpoints(self):
     facility.task_wants(task_cfg_keystone_steps, self.task_cfg_httpd)
     self.call_do(util.rand_pick(self.hosts_with_service('keystone')),
                  self.do_keystone_endpoint_sync,
                  c_args=(self.registered_endpoints))
示例#14
0
def task_nova_flavors(self):
    self.wait_for_components(self.neutron, self.osclient, self.keystone)
    self.call_do(util.rand_pick(self.hosts_with_component('tempest')),
                 self.do_ensure_flavors)