Exemple #1
0
def main():
    print('Running config verification...')
    opts = parse_args()
    update = opts.update
    replace = opts.replace_ext
    global CONF_FILE
    global OUTFILE
    if update:
        CONF_FILE = _get_config_file()
        if opts.output:
            OUTFILE = open(opts.output, 'w+')
    os = clients.ComputeAdminManager(interface='json')
    services = check_service_availability(os, update)
    results = {}
    for service in ['nova', 'nova_v3', 'cinder', 'neutron', 'swift']:
        if service == 'nova_v3' and 'nova' not in services:
            continue
        elif service not in services:
            continue
        results = verify_extensions(os, service, results)
    verify_keystone_api_versions(os, update)
    verify_glance_api_versions(os, update)
    verify_nova_api_versions(os, update)
    verify_cinder_api_versions(os, update)
    display_results(results, update, replace)
    if CONF_FILE:
        CONF_FILE.close()
    OUTFILE.close()
Exemple #2
0
    def setUpClass(cls):
        super(BaseComputeAdminTest, cls).setUpClass()
        if (CONF.compute.allow_tenant_isolation
                or cls.force_tenant_isolation is True):
            creds = cls.isolated_creds.get_admin_creds()
            cls.os_adm = clients.Manager(credentials=creds,
                                         interface=cls._interface)
        else:
            try:
                cls.os_adm = clients.ComputeAdminManager(
                    interface=cls._interface)
            except exceptions.InvalidCredentials:
                msg = ("Missing Compute Admin API credentials "
                       "in configuration.")
                raise cls.skipException(msg)
        if cls._api_version == 2:
            cls.availability_zone_admin_client = (
                cls.os_adm.availability_zone_client)

        else:
            cls.servers_admin_client = cls.os_adm.servers_v3_client
            cls.services_admin_client = cls.os_adm.services_v3_client
            cls.availability_zone_admin_client = \
                cls.os_adm.availability_zone_v3_client
            cls.hypervisor_admin_client = cls.os_adm.hypervisor_v3_client
            cls.flavors_admin_client = cls.os_adm.flavors_v3_client
            cls.aggregates_admin_client = cls.os_adm.aggregates_v3_client
            cls.hosts_admin_client = cls.os_adm.hosts_v3_client
            cls.quotas_admin_client = cls.os_adm.quotas_v3_client
            cls.agents_admin_client = cls.os_adm.agents_v3_client
            cls.migrations_admin_client = cls.os_adm.migrations_v3_client
def main():
    print('Running config verification...')
    opts = parse_args()
    update = opts.update
    replace = opts.replace_ext
    global CONF_PARSER

    outfile = sys.stdout
    if update:
        conf_file = _get_config_file()
        if opts.output:
            outfile = open(opts.output, 'w+')
        CONF_PARSER = moves.configparser.SafeConfigParser()
        CONF_PARSER.optionxform = str
        CONF_PARSER.readfp(conf_file)
    os = clients.ComputeAdminManager(interface='json')
    services = check_service_availability(os, update)
    results = {}
    for service in ['nova', 'nova_v3', 'cinder', 'neutron', 'swift']:
        if service == 'nova_v3' and 'nova' not in services:
            continue
        elif service not in services:
            continue
        results = verify_extensions(os, service, results)
    verify_keystone_api_versions(os, update)
    verify_glance_api_versions(os, update)
    verify_nova_api_versions(os, update)
    verify_cinder_api_versions(os, update)
    display_results(results, update, replace)
    if update:
        conf_file.close()
        CONF_PARSER.write(outfile)
    outfile.close()
Exemple #4
0
    def setUpClass(cls):
        super(BaseV3ComputeAdminTest, cls).setUpClass()
        admin_username = CONF.compute_admin.username
        admin_password = CONF.compute_admin.password
        admin_tenant = CONF.compute_admin.tenant_name
        if not (admin_username and admin_password and admin_tenant):
            msg = ("Missing Compute Admin API credentials "
                   "in configuration.")
            raise cls.skipException(msg)
        if CONF.compute.allow_tenant_isolation:
            creds = cls.isolated_creds.get_admin_creds()
            admin_username, admin_tenant_name, admin_password = creds
            os_adm = clients.Manager(username=admin_username,
                                     password=admin_password,
                                     tenant_name=admin_tenant_name,
                                     interface=cls._interface)
        else:
            os_adm = clients.ComputeAdminManager(interface=cls._interface)

        cls.os_adm = os_adm
        cls.servers_admin_client = cls.os_adm.servers_v3_client
        cls.services_admin_client = cls.os_adm.services_v3_client
        cls.availability_zone_admin_client = \
            cls.os_adm.availability_zone_v3_client
        cls.hypervisor_admin_client = cls.os_adm.hypervisor_v3_client
        cls.flavors_admin_client = cls.os_adm.flavors_v3_client
        cls.aggregates_admin_client = cls.os_adm.aggregates_v3_client
        cls.hosts_admin_client = cls.os_adm.hosts_v3_client
        cls.quotas_admin_client = cls.os_adm.quotas_v3_client
    def setUpClass(cls):
        super(VolumesTransfersTest, cls).setUpClass()

        # Add another tenant to test volume-transfer
        if CONF.compute.allow_tenant_isolation:
            creds = cls.isolated_creds.get_alt_creds()
            username, tenant_name, password = creds
            cls.os_alt = clients.Manager(username=username,
                                         password=password,
                                         tenant_name=tenant_name,
                                         interface=cls._interface)
            cls.alt_tenant_id = cls.isolated_creds.get_alt_tenant()['id']

            # Add admin tenant to cleanup resources
            adm_creds = cls.isolated_creds.get_admin_creds()
            admin_username, admin_tenant_name, admin_password = adm_creds
            cls.os_adm = clients.Manager(username=admin_username,
                                         password=admin_password,
                                         tenant_name=admin_tenant_name,
                                         interface=cls._interface)
        else:
            cls.os_alt = clients.AltManager()
            alt_tenant_name = cls.os_alt.credentials['tenant_name']
            identity_client = cls._get_identity_admin_client()
            _, tenants = identity_client.list_tenants()
            cls.alt_tenant_id = [tnt['id'] for tnt in tenants
                                 if tnt['name'] == alt_tenant_name][0]
            cls.os_adm = clients.ComputeAdminManager(interface=cls._interface)

        cls.client = cls.volumes_client
        cls.alt_client = cls.os_alt.volumes_client
        cls.adm_client = cls.os_adm.volumes_client
Exemple #6
0
    def setUpClass(cls):
        super(BaseComputeAdminTest, cls).setUpClass()
        admin_username = cls.config.compute_admin.username
        admin_password = cls.config.compute_admin.password
        admin_tenant = cls.config.compute_admin.tenant_name

        if not (admin_username and admin_password and admin_tenant):
            msg = ("Missing Compute Admin API credentials "
                   "in configuration.")
            raise cls.skipException(msg)

        cls.os_adm = clients.ComputeAdminManager(interface=cls._interface)
Exemple #7
0
def main(argv):
    print('Running config verification...')
    os = clients.ComputeAdminManager(interface='json')
    results = {}
    for service in ['nova', 'nova_v3', 'cinder', 'neutron']:
        # TODO(mtreinish) make this a keystone endpoint check for available
        # services
        if not check_service_availability(service):
            print("%s is not available" % service)
            continue
        results = verify_extensions(os, service, results)
    verify_glance_api_versions(os)
    verify_nova_api_versions(os)
    display_results(results)
Exemple #8
0
def main(argv):
    print('Running config verification...')
    os = clients.ComputeAdminManager(interface='json')
    services = check_service_availability(os)
    results = {}
    for service in ['nova', 'nova_v3', 'cinder', 'neutron', 'swift']:
        if service == 'nova_v3' and 'nova' not in services:
            continue
        elif service not in services:
            continue
        results = verify_extensions(os, service, results)
    verify_keystone_api_versions(os)
    verify_glance_api_versions(os)
    verify_nova_api_versions(os)
    display_results(results)
Exemple #9
0
 def setUpClass(cls):
     super(BaseAdminNetworkTest, cls).setUpClass()
     admin_username = CONF.compute_admin.username
     admin_password = CONF.compute_admin.password
     admin_tenant = CONF.compute_admin.tenant_name
     if not (admin_username and admin_password and admin_tenant):
         msg = ("Missing Administrative Network API credentials "
                "in configuration.")
         raise cls.skipException(msg)
     if (CONF.compute.allow_tenant_isolation
             or cls.force_tenant_isolation is True):
         cls.os_adm = clients.Manager(cls.isolated_creds.get_admin_creds(),
                                      interface=cls._interface)
     else:
         cls.os_adm = clients.ComputeAdminManager(interface=cls._interface)
     cls.admin_client = cls.os_adm.network_client
Exemple #10
0
 def setUpClass(cls):
     super(BaseComputeAdminTest, cls).setUpClass()
     admin_username = cls.config.compute_admin.username
     admin_password = cls.config.compute_admin.password
     admin_tenant = cls.config.compute_admin.tenant_name
     if not (admin_username and admin_password and admin_tenant):
         msg = ("Missing Compute Admin API credentials "
                "in configuration.")
         raise cls.skipException(msg)
     if cls.config.compute.allow_tenant_isolation:
         creds = cls._get_isolated_creds(admin=True)
         admin_username, admin_tenant_name, admin_password = creds
         cls.os_adm = clients.Manager(username=admin_username,
                                      password=admin_password,
                                      tenant_name=admin_tenant_name,
                                      interface=cls._interface)
     else:
         cls.os_adm = clients.ComputeAdminManager(interface=cls._interface)
Exemple #11
0
    def resource_setup(cls):
        super(VolumesV2TransfersTest, cls).resource_setup()

        # Add another tenant to test volume-transfer
        if CONF.compute.allow_tenant_isolation:
            cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds(),
                                         interface=cls._interface)
            # Add admin tenant to cleanup resources
            cls.os_adm = clients.Manager(cls.isolated_creds.get_admin_creds(),
                                         interface=cls._interface)
        else:
            cls.os_alt = clients.AltManager()
            cls.os_adm = clients.ComputeAdminManager(interface=cls._interface)

        cls.client = cls.volumes_client
        cls.alt_client = cls.os_alt.volumes_client
        cls.alt_tenant_id = cls.alt_client.tenant_id
        cls.adm_client = cls.os_adm.volumes_client
Exemple #12
0
 def _get_identity_admin_client(cls):
     """
     Returns an instance of the Identity Admin API client
     """
     os = clients.ComputeAdminManager()
     return os.identity_client