~chris.macnaughton/openstack-mojo-specs/ceph-test

« back to all changes in this revision

Viewing changes to helper/utils/mojo_os_utils.py

  • Committer: Liam Young
  • Date: 2017-02-10 09:53:59 UTC
  • mfrom: (287.2.4 tempest-stable-spec)
  • Revision ID: liam.young@canonical.com-20170210095359-7u1belqxyuewbef8
[gnuoy, r=ajkavanagh] Add tempest and action support

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
                                                   endpoint_type='publicURL')
129
129
    else:
130
130
        keystone_creds = get_ks_creds(novarc_creds, scope='PROJECT')
 
131
        logging.info(keystone_creds)
131
132
        kc = keystoneclient_v3.Client(**keystone_creds)
132
133
        glance_svc_id = kc.services.find(name='glance').id
133
134
        ep = kc.endpoints.find(service_id=glance_svc_id, interface='public')
262
263
                                            tenant_id)
263
264
 
264
265
 
265
 
def get_tenant_id(ks_client, tenant_name, api_version=2):
 
266
def get_tenant_id(ks_client, tenant_name, api_version=2, domain_name=None):
 
267
    domain_id = None
 
268
    if domain_name:
 
269
        domain_id = ks_client.domains.list(name=domain_name)[0].id
266
270
    if api_version == 2:
267
271
        all_tenants = ks_client.tenants.list()
268
272
    else:
269
 
        all_tenants = ks_client.projects.list()
 
273
        all_tenants = ks_client.projects.list(domain=domain_id)
270
274
    for t in all_tenants:
271
275
        if t._info['name'] == tenant_name:
272
276
            return t._info['id']
574
578
    nics = [{'net-id': net.id}]
575
579
    # Obviously time may not produce a unique name
576
580
    vm_name = time.strftime("%Y%m%d%H%M%S")
577
 
    logging.info('Creating %s %s '
578
 
                 'instance %s' % (flavor_name, image_name, vm_name))
 
581
    logging.info('Creating %s %s %s'
 
582
                 'instance %s' % (flavor_name, image_name, nics, vm_name))
579
583
    instance = nova_client.servers.create(name=vm_name,
580
584
                                          image=image,
581
585
                                          flavor=flavor,