Пример #1
0
def rhev(bridge):
    rhev = {}
    rhev['rhev_url'] = settings.rhev.hostname
    rhev['rhev_password'] = settings.rhev.password
    rhev['rhev_username'] = settings.rhev.username
    rhev['rhev_datacenter'] = settings.rhev.datacenter
    rhev['rhev_img_name'] = settings.rhev.image_name
    rhev['rhev_img_arch'] = settings.rhev.image_arch
    rhev['rhev_img_os'] = settings.rhev.image_os
    rhev['rhev_img_user'] = settings.rhev.image_username
    rhev['rhev_img_pass'] = settings.rhev.image_password
    rhev['rhev_vm_name'] = settings.rhev.vm_name
    rhev['rhev_storage_domain'] = settings.rhev.storage_domain
    rhev['rhv_api'] = RHEVMSystem(
        hostname=rhev['rhev_url'].split('/')[2],
        username=rhev['rhev_username'],
        password=rhev['rhev_password'],
        version='4.0',
        verify=False,
    )
    rhev['cluster_id'] = rhev['rhv_api'].get_cluster(rhev['rhev_datacenter']).id
    rhev['storage_id'] = rhev['rhv_api'].get_storage_domain(rhev['rhev_storage_domain']).id
    rhev['network_id'] = (
        rhev['rhv_api'].api.system_service().networks_service().list(search=f'name={bridge}')[0].id
    )
    if is_open('BZ:1685949'):
        dc = rhev['rhv_api']._data_centers_service.list(search=f'name={rhev["rhev_datacenter"]}')[
            0
        ]
        dc = rhev['rhv_api']._data_centers_service.data_center_service(dc.id)
        rhev['quota'] = dc.quotas_service().list()[0].id
    else:
        rhev['quota'] = 'Default'
    return rhev
Пример #2
0
    def setUpClass(cls):
        super().setUpClass()
        bridge = settings.vlan_networking.bridge
        # RHV Settings
        cls.rhev_url = settings.rhev.hostname
        cls.rhev_password = settings.rhev.password
        cls.rhev_username = settings.rhev.username
        cls.rhev_datacenter = settings.rhev.datacenter
        cls.rhev_img_name = settings.rhev.image_name
        cls.rhev_img_arch = settings.rhev.image_arch
        cls.rhev_img_os = settings.rhev.image_os
        cls.rhev_img_user = settings.rhev.image_username
        cls.rhev_img_pass = settings.rhev.image_password
        cls.rhev_vm_name = settings.rhev.vm_name
        cls.rhev_storage_domain = settings.rhev.storage_domain
        cls.rhv_api = RHEVMSystem(
            hostname=cls.rhev_url.split('/')[2],
            username=cls.rhev_username,
            password=cls.rhev_password,
            version='4.0',
            verify=False,
        )
        cls.cluster_id = cls.rhv_api.get_cluster(cls.rhev_datacenter).id
        cls.storage_id = cls.rhv_api.get_storage_domain(cls.rhev_storage_domain).id
        cls.network_id = (
            cls.rhv_api.api.system_service().networks_service().list(search=f'name={bridge}')[0].id
        )
        if is_open('BZ:1685949'):
            dc = cls.rhv_api._data_centers_service.list(search=f'name={cls.rhev_datacenter}')[0]
            dc = cls.rhv_api._data_centers_service.data_center_service(dc.id)
            cls.quota = dc.quotas_service().list()[0].id
        else:
            cls.quota = 'Default'

        # Vmware Settings
        cls.vmware_server = settings.vmware.vcenter
        cls.vmware_password = settings.vmware.password
        cls.vmware_username = settings.vmware.username
        cls.vmware_datacenter = settings.vmware.datacenter
        cls.vmware_img_name = settings.vmware.image_name
        cls.vmware_img_arch = settings.vmware.image_arch
        cls.vmware_img_os = settings.vmware.image_os
        cls.vmware_img_user = settings.vmware.image_username
        cls.vmware_img_pass = settings.vmware.image_password
        cls.vmware_vm_name = settings.vmware.vm_name
        cls.current_interface = VMWARE_CONSTANTS.get('network_interfaces') % bridge
        cls.vmware_api = VMWareSystem(
            hostname=cls.vmware_server, username=cls.vmware_username, password=cls.vmware_password
        )
        cls.vmware_net_id = cls.vmware_api.get_network(cls.current_interface)._moId

        # Provisioning setup
        cls.org = entities.Organization(name=gen_string('alpha')).create()
        cls.org_name = cls.org.name
        cls.loc = entities.Location(name=gen_string('alpha'), organization=[cls.org]).create()
        cls.loc_name = cls.loc.name
        cls.config_env = configure_provisioning(
            compute=True, org=cls.org, loc=cls.loc, os=cls.rhev_img_os
        )
        cls.os_name = cls.config_env['os']
def rhev():
    bridge = settings.vlan_networking.bridge
    rhev = type("", (), {})()
    rhev.rhev_url = settings.rhev.hostname
    rhev.rhev_password = settings.rhev.password
    rhev.rhev_username = settings.rhev.username
    rhev.rhev_datacenter = settings.rhev.datacenter
    rhev.rhev_img_name = settings.rhev.image_name
    rhev.rhev_img_arch = settings.rhev.image_arch
    rhev.rhev_img_os = settings.rhev.image_os
    rhev.rhev_img_user = settings.rhev.image_username
    rhev.rhev_img_pass = settings.rhev.image_password
    rhev.rhev_vm_name = settings.rhev.vm_name
    rhev.rhev_storage_domain = settings.rhev.storage_domain
    rhev.rhv_api = RHEVMSystem(
        hostname=rhev.rhev_url.split('/')[2],
        username=rhev.rhev_username,
        password=rhev.rhev_password,
        version='4.0',
        verify=False,
    )
    rhev.cluster_id = rhev.rhv_api.get_cluster(rhev.rhev_datacenter).id
    rhev.storage_id = rhev.rhv_api.get_storage_domain(
        rhev.rhev_storage_domain).id
    rhev.network_id = (
        rhev.rhv_api.api.system_service().networks_service().list(
            search=f'name={bridge}')[0].id)
    if is_open('BZ:1685949'):
        dc = rhev.rhv_api._data_centers_service.list(
            search=f'name={rhev.rhev_datacenter}')[0]
        dc = rhev.rhv_api._data_centers_service.data_center_service(dc.id)
        rhev.quota = dc.quotas_service().list()[0].id
    else:
        rhev.quota = 'Default'
    return rhev
    def setUpClass(cls):
        super(ComputeResourceHostTestCase, cls).setUpClass()
        bridge = settings.vlan_networking.bridge
        # RHV Settings
        cls.rhev_url = settings.rhev.hostname
        cls.rhev_password = settings.rhev.password
        cls.rhev_username = settings.rhev.username
        cls.rhev_datacenter = settings.rhev.datacenter
        cls.rhev_img_name = settings.rhev.image_name
        cls.rhev_img_arch = settings.rhev.image_arch
        cls.rhev_img_os = settings.rhev.image_os
        cls.rhev_img_user = settings.rhev.image_username
        cls.rhev_img_pass = settings.rhev.image_password
        cls.rhev_vm_name = settings.rhev.vm_name
        cls.rhev_storage_domain = settings.rhev.storage_domain
        cls.rhv_api = RHEVMSystem(hostname=cls.rhev_url.split('/')[2],
                                  username=cls.rhev_username,
                                  password=cls.rhev_password,
                                  version='4.0',
                                  verify=False)
        cls.cluster_id = cls.rhv_api.get_cluster(cls.rhev_datacenter).id
        cls.storage_id = cls.rhv_api._get_storage_domain(
            cls.rhev_storage_domain).id
        cls.network_id = (
            cls.rhv_api.api.system_service().networks_service().list(
                search='name={0}'.format(bridge))[0].id)

        # Vmware Settings
        cls.vmware_server = settings.vmware.vcenter
        cls.vmware_password = settings.vmware.password
        cls.vmware_username = settings.vmware.username
        cls.vmware_datacenter = settings.vmware.datacenter
        cls.vmware_img_name = settings.vmware.image_name
        cls.vmware_img_arch = settings.vmware.image_arch
        cls.vmware_img_os = settings.vmware.image_os
        cls.vmware_img_user = settings.vmware.image_username
        cls.vmware_img_pass = settings.vmware.image_password
        cls.vmware_vm_name = settings.vmware.vm_name
        cls.current_interface = (VMWARE_CONSTANTS.get('network_interfaces') %
                                 bridge)
        cls.vmware_api = VMWareSystem(hostname=cls.vmware_server,
                                      username=cls.vmware_username,
                                      password=cls.vmware_password)
        cls.vmware_net_id = cls.vmware_api.get_obj(
            vimtype=vim.Network, name=cls.current_interface)._moId

        # Provisioning setup
        cls.org = entities.Organization(name=gen_string('alpha')).create()
        cls.org_name = cls.org.name
        cls.loc = entities.Location(
            name=gen_string('alpha'),
            organization=[cls.org],
        ).create()
        cls.loc_name = cls.loc.name
        cls.config_env = configure_provisioning(compute=True,
                                                org=cls.org,
                                                loc=cls.loc,
                                                os=cls.rhev_img_os)
        cls.os_name = cls.config_env['os']
Пример #5
0
def rhev():
    bridge = settings.vlan_networking.bridge
    rhev = settings.rhev.copy()
    rhev.rhv_api = RHEVMSystem(
        hostname=rhev.hostname.split('/')[2],
        username=rhev.username,
        password=rhev.password,
        version='4.0',
        verify=False,
    )
    rhev.cluster_id = rhev.rhv_api.get_cluster(rhev.datacenter).id
    rhev.storage_id = rhev.rhv_api.get_storage_domain(rhev.storage_domain).id
    if bridge:
        rhev.network_id = (
            rhev.rhv_api.api.system_service().networks_service().list(search=f'name={bridge}')[0].id
        )
    if is_open('BZ:1685949'):
        dc = rhev.rhv_api._data_centers_service.list(search=f'name={rhev.datacenter}')[0]
        dc = rhev.rhv_api._data_centers_service.data_center_service(dc.id)
        rhev.quota = dc.quotas_service().list()[0].id
    else:
        rhev.quota = 'Default'
    return rhev