示例#1
0
    def setUpClass(cls):
        cls.testClient = super(TestAttachVolumeISO, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.pod = get_pod(cls.api_client, cls.zone.id)
        cls.services['mode'] = cls.zone.networktype
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() == 'lxc':
            if not find_storage_pool_type(cls.api_client, storagetype='rbd'):
                raise unittest.SkipTest(
                    "RBD storage type is required for data volumes for LXC")
        cls.disk_offering = DiskOffering.create(cls.api_client,
                                                cls.services["disk_offering"])
        template = get_template(cls.api_client, cls.zone.id,
                                cls.services["ostype"])
        cls.services["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["iso"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = template.id
        # get max data volumes limit based on the hypervisor type and version
        listHost = Host.list(
            cls.api_client,
            type='Routing',
            zoneid=cls.zone.id,
            podid=cls.pod.id,
        )
        ver = listHost[0].hypervisorversion
        hv = listHost[0].hypervisor
        cmd = listHypervisorCapabilities.listHypervisorCapabilitiesCmd()
        cmd.hypervisor = hv
        res = cls.api_client.listHypervisorCapabilities(cmd)
        cls.debug('Hypervisor Capabilities: {}'.format(res))
        for i in range(len(res)):
            if res[i].hypervisorversion == ver:
                break
        cls.max_data_volumes = int(res[i].maxdatavolumeslimit)
        cls.debug('max data volumes:{}'.format(cls.max_data_volumes))
        cls.services["volume"]["max"] = cls.max_data_volumes
        # Create VMs, NAT Rules etc
        cls.account = Account.create(cls.api_client,
                                     cls.services["account"],
                                     domainid=cls.domain.id)

        cls.service_offering = ServiceOffering.create(
            cls.api_client, cls.services["service_offering"])
        cls.virtual_machine = VirtualMachine.create(
            cls.api_client,
            cls.services["virtual_machine"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
        )
        cls._cleanup = [cls.service_offering, cls.disk_offering, cls.account]
示例#2
0
    def setUpClass(cls):
        testClient = super(TestVmSnapshot, cls).getClsTestClient()

        hypervisor = testClient.getHypervisorInfo()
        if hypervisor.lower() in (KVM.lower(), "hyperv", "lxc"):
            raise unittest.SkipTest(
                "VM snapshot feature is not supported on KVM, Hyper-V or LXC")

        cls.apiclient = testClient.getApiClient()
        cls.services = testClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())

        template = get_template(
            cls.apiclient,
            cls.zone.id,
            cls.services["ostype"]
        )
        if template == FAILED:
            assert False, "get_template() failed to return template\
                    with description %s" % cls.services["ostype"]

        cls.services["domainid"] = cls.domain.id
        cls.services["server"]["zoneid"] = cls.zone.id
        cls.services["templates"]["ostypeid"] = template.ostypeid
        cls.services["zoneid"] = cls.zone.id

        # Create VMs, NAT Rules etc
        cls.account = Account.create(
            cls.apiclient,
            cls.services["account"],
            domainid=cls.domain.id
        )

        cls.service_offering = ServiceOffering.create(
            cls.apiclient,
            cls.services["service_offerings"]
        )
        cls.virtual_machine = VirtualMachine.create(
            cls.apiclient,
            cls.services["server"],
            templateid=template.id,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            mode=cls.zone.networktype
        )
        cls.random_data_0 = random_gen(size=100)
        cls.test_dir = "/tmp"
        cls.random_data = "random.data"
        cls._cleanup = [
            cls.service_offering,
            cls.account,
        ]
        return
示例#3
0
    def setUpClass(cls):
        testClient = super(TestISO, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.services = testClient.getParsedTestDataConfig()

        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())

        cls.services["domainid"] = cls.domain.id
        cls.services["iso1"]["zoneid"] = cls.zone.id
        cls.services["iso2"]["zoneid"] = cls.zone.id
        cls.services["sourcezoneid"] = cls.zone.id
        # populate second zone id for iso copy
        cmd = listZones.listZonesCmd()
        cls.zones = cls.apiclient.listZones(cmd)
        if not isinstance(cls.zones, list):
            raise Exception("Failed to find zones.")

        # Create an account, ISOs etc.
        cls.account = Account.create(cls.apiclient,
                                     cls.services["account"],
                                     domainid=cls.domain.id)
        # Finding the OsTypeId from Ostype
        ostypes = list_os_types(cls.apiclient,
                                description=cls.services["ostype"])
        if not isinstance(ostypes, list):
            raise unittest.SkipTest("OSTypeId for given description not found")

        cls.services["iso1"]["ostypeid"] = ostypes[0].id
        cls.services["iso2"]["ostypeid"] = ostypes[0].id
        cls.services["ostypeid"] = ostypes[0].id

        cls.iso_1 = Iso.create(cls.apiclient,
                               cls.services["iso1"],
                               account=cls.account.name,
                               domainid=cls.account.domainid)
        try:
            cls.iso_1.download(cls.apiclient)
        except Exception as e:
            raise Exception("Exception while downloading ISO %s: %s" %
                            (cls.iso_1.id, e))

        cls.iso_2 = Iso.create(cls.apiclient,
                               cls.services["iso2"],
                               account=cls.account.name,
                               domainid=cls.account.domainid)
        try:
            cls.iso_2.download(cls.apiclient)
        except Exception as e:
            raise Exception("Exception while downloading ISO %s: %s" %
                            (cls.iso_2.id, e))

        cls._cleanup = [cls.account]
        return
示例#4
0
    def setUpClass(cls):
        cls.testClient = super(TestHosts, cls).getClsTestClient()
        cls.testdata = cls.testClient.getParsedTestDataConfig()
        cls.apiclient = cls.testClient.getApiClient()
        cls.dbclient = cls.testClient.getDbConnection()
        cls._cleanup = []

        # get zone, domain etc
        cls.zone = Zone(get_zone(cls.apiclient, cls.testClient.getZoneForTests()).__dict__)
        cls.domain = get_domain(cls.apiclient)
        cls.pod = get_pod(cls.apiclient, cls.zone.id)

        cls.logger = logging.getLogger('TestHosts')
        cls.stream_handler = logging.StreamHandler()
        cls.logger.setLevel(logging.DEBUG)
        cls.logger.addHandler(cls.stream_handler)

        cls.storage_pool_db_id = None
        # list hosts
        hosts = list_hosts(cls.apiclient, type="Routing")
        i = 0
        while (i < len(hosts)):
            host_id = hosts[i].id
            cls.logger.debug("Trying host id : %s" % host_id)
            host_db_id = cls.dbclient.execute(
                "select id from host where uuid='%s';" %
                host_id)

            if host_db_id and host_db_id[0]:
                cls.logger.debug("found host db id : %s" % host_db_id)
                storage_pool_db_id = cls.dbclient.execute(
                    "select id from storage_pool where id='%s' and removed is null;" %
                    host_db_id[0][0])

                if storage_pool_db_id and storage_pool_db_id[0]:
                    cls.logger.debug("Found storage_pool_db_id  : %s" % storage_pool_db_id[0][0])
                    capacity_state = cls.dbclient.execute(
                        "select count(capacity_state) from op_host_capacity where host_id='%s' and capacity_type in (0,1,3) and capacity_state = 'Enabled'" %
                        host_db_id[0][0])

                    if capacity_state and capacity_state[0]:
                        cls.logger.debug("Check capacity count  : %s" % capacity_state[0][0])

                        if capacity_state[0][0] == 3:
                            cls.logger.debug("found host id : %s, can be used for this test" % host_id)
                            cls.my_host_id = host_id
                            cls.host_db_id = host_db_id
                            cls.storage_pool_db_id = storage_pool_db_id
                            break
            if not cls.storage_pool_db_id:
                i = i + 1


        if cls.storage_pool_db_id is None:
            raise unittest.SkipTest("There is no host and storage pool available in the setup to run this test")
示例#5
0
    def setUpClass(cls):

        cls.testClient = super(TestTemplates, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.domain = get_domain(cls.api_client)

        cls.services['mode'] = cls.zone.networktype

        template = get_template(cls.api_client, cls.zone.id,
                                cls.services["ostype"])
        cls.templateSupported = True
        cls._cleanup = []
        if cls.hypervisor.lower() in ['lxc']:
            cls.templateSupported = False
            return
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        try:
            cls.account = Account.create(cls.api_client,
                                         cls.services["account"],
                                         domainid=cls.domain.id)
            cls._cleanup.append(cls.account)

            cls.services["account"] = cls.account.name
            cls.service_offering = ServiceOffering.create(
                cls.api_client,
                cls.services["service_offering"],
            )
            cls._cleanup.append(cls.service_offering)

            # create virtual machine
            cls.virtual_machine = VirtualMachine.create(
                cls.api_client,
                cls.services["virtual_machine"],
                templateid=template.id,
                accountid=cls.account.name,
                domainid=cls.account.domainid,
                serviceofferingid=cls.service_offering.id,
            )
            #Stop virtual machine
            cls.virtual_machine.stop(cls.api_client)

            listvolumes = Volume.list(cls.api_client,
                                      virtualmachineid=cls.virtual_machine.id,
                                      type='ROOT',
                                      listall=True)
            assert validateList(
                listvolumes)[0] == PASS, "volumes list is empty"
            cls.volume = listvolumes[0]
        except Exception as e:
            cls.tearDownClass()
            raise unittest.SkipTest("Exception in setUpClass: %s" % e)
示例#6
0
    def setUpClass(self):
        testClient = super(TestDeployvGPUenabledVM, self).getClsTestClient()
        self.apiclient = testClient.getApiClient()
        self.testdata = self.testClient.getParsedTestDataConfig()
        #Need to add check whether zone containing the xen hypervisor or not as well
        hosts = list_hosts(self.apiclient, hypervisor="XenServer")
        if hosts is None:
            raise unittest.SkipTest(
                "There are no XenServers available. GPU feature is supported only on XenServer.Check listhosts response"
            )
        else:
            gpuhosts = 0
            for ghost in hosts:
                if ghost.hypervisorversion >= "6.2.0":
                    sshClient = SshClient(
                        host=ghost.ipaddress,
                        port=22,
                        user='******',
                        passwd=self.testdata["host_password"])
                    if ghost.hypervisorversion == "6.2.0":
                        res = sshClient.execute(
                            "xe patch-list uuid=0850b186-4d47-11e3-a720-001b2151a503"
                        )
                        if len(res) == 0:
                            continue
                    res = sshClient.execute(
                        "xe vgpu-type-list model-name=\"GRID K120Q\"")
                    if len(res) != 0:
                        gpuhosts = gpuhosts + 1
                    else:
                        continue
        if gpuhosts == 0:
            raise unittest.SkipTest(
                "No XenServer available with GPU Drivers installed")

        self.domain = get_domain(self.apiclient)
        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
        #Creating Account
        self.account = Account.create(self.apiclient,
                                      self.testdata["account"],
                                      domainid=self.domain.id)
        self._cleanup = [self.account]
    def get_ssh_client(self, ip, username, password, retries=10):
        """ Setup ssh client connection and return connection """
        try:
            ssh_client = SshClient(ip, 22, username, password, retries)
        except Exception as e:
            raise unittest.SkipTest("Unable to create ssh connection: " % e)

        self.assertIsNotNone(ssh_client,
                             "Failed to setup ssh connection to ip=%s" % ip)

        return ssh_client
    def test_01_create_deploy_windows_vm_with_k100_vgpu_service_offering(self):
        """Test to create and deploy vm with K100 vGPU service offering"""

        if (self.k100gpuhosts == 0):
            raise unittest.SkipTest(
                "No XenServer available with K100 vGPU Drivers installed")
        else:
            self.vgpuoffering = self.vgpu_serviceoffering_creation(
                "GRID K100",
                "Group of NVIDIA Corporation GK107GL [GRID K1] GPUs")
            self.deploy_vGPU_windows_vm(self.vgpuoffering[0].id)
            self.delete_vgpu_service_offering(self.vgpuoffering)
示例#9
0
    def setUpClass(cls):
        cls.testClient = super(TestAccountSnapshotClean,
                               cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.services['mode'] = cls.zone.networktype

        template = get_template(cls.api_client, cls.zone.id,
                                cls.services["ostype"])
        cls.services["server"]["zoneid"] = cls.zone.id

        cls.services["template"] = template.id
        cls._cleanup = []

        try:
            # Create VMs, NAT Rules etc
            cls.account = Account.create(cls.api_client,
                                         cls.services["account"],
                                         domainid=cls.domain.id)

            cls.services["account"] = cls.account.name

            if cls.zone.localstorageenabled:
                cls.services["service_offering"]["storagetype"] = "local"
            cls.service_offering = ServiceOffering.create(
                cls.api_client, cls.services["service_offering"])

            cls.virtual_machine = VirtualMachine.create(
                cls.api_client,
                cls.services["server"],
                templateid=template.id,
                accountid=cls.account.name,
                domainid=cls.account.domainid,
                serviceofferingid=cls.service_offering.id)

            # Get the Root disk of VM
            volumes = list_volumes(cls.api_client,
                                   virtualmachineid=cls.virtual_machine.id,
                                   type='ROOT',
                                   listall=True)
            volume = volumes[0]

            # Create a snapshot from the ROOTDISK
            cls.snapshot = Snapshot.create(cls.api_client, volume.id)
        except Exception, e:
            cls.tearDownClass()
            unittest.SkipTest("setupClass fails for %s" % cls.__name__)
            raise e
示例#10
0
    def setUpClass(cls):
        cloudstackTestClient = super(TestResizeVolume, cls).getClsTestClient()
        cls.api_client = cloudstackTestClient.getApiClient()
        cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
        # Fill services from the external config file
        cls.services = cloudstackTestClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client,
                            cloudstackTestClient.getZoneForTests())
        cls.services["mode"] = cls.zone.networktype
        cls._cleanup = []
        cls.unsupportedStorageType = False
        if cls.hypervisor.lower() == 'lxc':
            if not find_storage_pool_type(cls.api_client, storagetype='rbd'):
                cls.unsupportedStorageType = True
                return
        cls.resourcetypemapping = {
            RESOURCE_PRIMARY_STORAGE: 10,
            RESOURCE_SECONDARY_STORAGE: 11
        }

        cls.template = get_template(cls.api_client, cls.zone.id,
                                    cls.services["ostype"])

        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = cls.template.id
        cls.services["volume"]["zoneid"] = cls.zone.id

        try:
            cls.hypervisor = str(get_hypervisor_type(cls.api_client)).lower()

            # Creating service offering with normal config
            cls.service_offering = ServiceOffering.create(
                cls.api_client, cls.services["service_offering"])
            cls._cleanup.append(cls.service_offering)

            cls.services["disk_offering"]["disksize"] = 5
            cls.disk_offering_5_GB = DiskOffering.create(
                cls.api_client, cls.services["disk_offering"])
            cls._cleanup.append(cls.disk_offering_5_GB)

            cls.services["disk_offering"]["disksize"] = 20
            cls.disk_offering_20_GB = DiskOffering.create(
                cls.api_client, cls.services["disk_offering"])
            cls._cleanup.append(cls.disk_offering_20_GB)
        except Exception as e:
            cls.tearDownClass()
            raise unittest.SkipTest(
                "Failure while creating disk offering: %s" % e)
        return
示例#11
0
    def setUpClass(cls):
        cls.testClient = super(TestNetworkMigration, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()
        cls.test_data = cls.testClient.getParsedTestDataConfig()
        cls.services = Services().services

        hypervisor = get_hypervisor_type(cls.api_client)
        if hypervisor.lower() not in ["vmware", "kvm"]:
            raise unittest.SkipTest("This feature is supported "
                                    "only on Vmware and KVM")

    # Get Domain, Zone, Template
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.template = get_template(cls.api_client, cls.zone.id,
                                    cls.test_data["ostype"])
        cls.services["virtual_machine"]["template"] = cls.template.id
        if cls.zone.localstorageenabled:
            cls.storagetype = 'local'
            cls.test_data["service_offerings"]["tiny"]["storagetype"] = 'local'
        else:
            cls.storagetype = 'shared'
            cls.test_data["service_offerings"]["tiny"][
                "storagetype"] = 'shared'

        cls.service_offering = ServiceOffering.create(
            cls.api_client, cls.test_data["service_offerings"]["tiny"])

        # Create Network offering without userdata
        cls.network_offering_nouserdata = NetworkOffering.create(
            cls.api_client, cls.test_data["network_offering"])
        # Enable Network offering
        cls.network_offering_nouserdata.update(cls.api_client, state='Enabled')

        # Create Network Offering with all the serices
        cls.network_offering_all = NetworkOffering.create(
            cls.api_client, cls.test_data["isolated_network_offering"])
        # Enable Network offering
        cls.network_offering_all.update(cls.api_client, state='Enabled')

        cls.native_vpc_network_offering = NetworkOffering.create(
            cls.api_client,
            cls.test_data["nw_offering_isolated_vpc"],
            conservemode=False)
        cls.native_vpc_network_offering.update(cls.api_client, state='Enabled')

        cls._cleanup = [
            cls.service_offering, cls.network_offering_nouserdata,
            cls.network_offering_all, cls.native_vpc_network_offering
        ]
    def setUpClass(cls):
        cls.testClient = super(TestVPCHostMaintenance, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()
        cls._cleanup = []
        cls.hosts = []
        cls.vpcSupported = True
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        cls.services = cls.testClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.template = get_template(cls.api_client, cls.zone.id,
                                    cls.services["ostype"])
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = cls.template.id
        cls.services["mode"] = cls.zone.networktype

        cls.vpc_off = VpcOffering.create(cls.api_client,
                                         cls.services["vpc_offering"])
        cls.vpc_off.update(cls.api_client, state='Enabled')
        cls.hosts = Host.list(cls.api_client,
                              zoneid=cls.zone.id,
                              listall=True,
                              type='Routing')

        if isinstance(cls.hosts, list):
            for host in cls.hosts:
                Host.enableMaintenance(cls.api_client, id=host.id)

                timeout = cls.services["timeout"]
                while True:
                    time.sleep(cls.services["sleep"])
                    hosts_states = Host.list(cls.api_client,
                                             id=host.id,
                                             listall=True)
                    if hosts_states[
                            0].resourcestate == 'PrepareForMaintenance':
                        # Wait for sometimetill host goes in maintenance state
                        time.sleep(cls.services["sleep"])
                    elif hosts_states[0].resourcestate == 'Maintenance':
                        time.sleep(cls.services["sleep"])
                        break
                    elif timeout == 0:
                        raise unittest.SkipTest(
                            "Failed to enable maintenance mode on %s" %
                            host.name)
                    timeout = timeout - 1

        cls._cleanup.append(cls.vpc_off)
        return
示例#13
0
    def setUpClass(cls):
        try:
            cls._cleanup = []
            cls.testClient = super(TestSnapshots, cls).getClsTestClient()
            cls.api_client = cls.testClient.getApiClient()
            cls.services = cls.testClient.getParsedTestDataConfig()
            cls.hypervisor = cls.testClient.getHypervisorInfo()
            if cls.hypervisor.lower() in (KVM.lower(), "hyperv", "lxc"):
                raise unittest.SkipTest(
                    "VM snapshot feature is not supported on KVM, Hyper-V or LXC")
            # Get Domain, Zone, Template
            cls.domain = get_domain(cls.api_client)
            cls.zone = get_zone(
                cls.api_client,
                cls.testClient.getZoneForTests())
            cls.template = get_template(
                cls.api_client,
                cls.zone.id,
                cls.services["ostype"]
            )
            if cls.zone.localstorageenabled:
                cls.storagetype = 'local'
                cls.services["service_offerings"][
                    "tiny"]["storagetype"] = 'local'
            else:
                cls.storagetype = 'shared'
                cls.services["service_offerings"][
                    "tiny"]["storagetype"] = 'shared'

            cls.services['mode'] = cls.zone.networktype
            cls.services["virtual_machine"]["hypervisor"] = cls.hypervisor
            cls.services["virtual_machine"]["zoneid"] = cls.zone.id
            cls.services["virtual_machine"]["template"] = cls.template.id
            cls.services["custom_volume"]["zoneid"] = cls.zone.id
            # Creating Disk offering, Service Offering and Account
            cls.service_offering = ServiceOffering.create(
                cls.api_client,
                cls.services["service_offerings"]["tiny"]
            )
            cls._cleanup.append(cls.service_offering)
            cls.account = Account.create(
                cls.api_client,
                cls.services["account"],
                domainid=cls.domain.id
            )
            cls._cleanup.append(cls.account)
        except Exception as e:
            cls.tearDownClass()
            raise Exception("Warning: Exception in setup : %s" % e)
        return
示例#14
0
    def setUpClass(cls):

        cls.testClient = super(TestDataPersistency, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = cls.testClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.domain = get_domain(cls.api_client)
        cls.services['mode'] = cls.zone.networktype
        template = get_template(
                            cls.api_client,
                            cls.zone.id,
                            cls.services["ostype"]
                            )
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ['lxc']:
            raise unittest.SkipTest("Template creation from root volume is not supported in LXC")
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id

        #Create an account, network, VM and IP addresses
        cls.account = Account.create(
                                     cls.api_client,
                                     cls.services["account"],
                                     domainid=cls.domain.id
                                     )

        cls.userapiclient = cls.testClient.getUserApiClient(
                            UserName=cls.account.name,
                            DomainName=cls.account.domain)

        cls.service_offering = ServiceOffering.create(
                                            cls.api_client,
                                            cls.services["service_offering"]
                                            )
        cls.virtual_machine = VirtualMachine.create(
                                    cls.api_client,
                                    cls.services["virtual_machine"],
                                    templateid=template.id,
                                    accountid=cls.account.name,
                                    domainid=cls.account.domainid,
                                    serviceofferingid=cls.service_offering.id,
                                    mode=cls.services["mode"]
                                    )
        cls.cleanup = [
                       cls.account,
                       cls.service_offering
                       ]
        return
示例#15
0
    def setUpClass(cls):
        testClient = super(TestCreateVolume, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.services = testClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
        cls.hypervisor = testClient.getHypervisorInfo()
        cls.services['mode'] = cls.zone.networktype
        #for LXC if the storage pool of type 'rbd' ex: ceph is not available, skip the test
        if cls.hypervisor.lower() == 'lxc':
            if not find_storage_pool_type(cls.apiclient, storagetype='rbd'):
                raise unittest.SkipTest(
                    "RBD storage type is required for data volumes for LXC")
        cls.disk_offering = DiskOffering.create(cls.apiclient,
                                                cls.services["disk_offering"])
        cls.sparse_disk_offering = DiskOffering.create(
            cls.apiclient, cls.services["sparse_disk_offering"])
        cls.custom_disk_offering = DiskOffering.create(
            cls.apiclient, cls.services["disk_offering"], custom=True)
        template = get_template(cls.apiclient, cls.zone.id,
                                cls.services["ostype"])
        if template == FAILED:
            assert False, "get_template() failed to return template with description %s" % cls.services[
                "ostype"]

        cls.services["domainid"] = cls.domain.id
        cls.services["zoneid"] = cls.zone.id
        cls.services["template"] = template.id
        cls.services["customdiskofferingid"] = cls.custom_disk_offering.id
        cls.services["diskname"] = cls.services["volume"]["diskname"]
        # Create VMs, NAT Rules etc
        cls.account = Account.create(cls.apiclient,
                                     cls.services["account"],
                                     domainid=cls.domain.id)
        cls.service_offering = ServiceOffering.create(
            cls.apiclient, cls.services["service_offerings"])
        cls.virtual_machine = VirtualMachine.create(
            cls.apiclient,
            cls.services,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            mode=cls.services["mode"])
        cls._cleanup = [
            cls.service_offering, cls.disk_offering, cls.custom_disk_offering,
            cls.account
        ]
    def test_04_create_deploy_windows_vm_with_k1_passthrough_vgpu_service_offering(
            self):
        """Test to create and deploy vm with K1 passthrough vGPU service offering"""

        if (self.k1passthroughgpuhosts == 0):
            raise unittest.SkipTest(
                "No XenServer available with K1 passthrough installed")
        else:
            self.vgpuoffering = self.vgpu_serviceoffering_creation(
                "passthrough",
                "Group of NVIDIA Corporation GK107GL [GRID K1] GPUs")
            if self.vgpuoffering is not None:
                self.deploy_vGPU_windows_vm(self.vgpuoffering.id)
                self.delete_vgpu_service_offering(self.vgpuoffering)
                self.destroy_vm()
                self.delete_vgpu_service_offering(self.vgpuoffering)
    def test_09_create_deploy_windows_vm_with_k200_vgpu_service_offering(self):
        """   Test to create and deploy vm with K200 vGPU service offering  """

        if (self.k200gpuhosts == 0):
            raise unittest.SkipTest(
                "No XenServer available with K200 vGPU Drivers installed")
        else:
            self.vgpuoffering = self.vgpu_serviceoffering_creation(
                "GRID K200",
                "Group of NVIDIA Corporation GK104GL [GRID K2] GPUs")
            if self.vgpuoffering is not None:
                res = self.deploy_vGPU_windows_vm(self.vgpuoffering.id)
                self.delete_vgpu_service_offering(self.vgpuoffering)
                self.destroy_vm()
            if res is not None:
                self.delete_vgpu_service_offering(self.vgpuoffering)
示例#18
0
    def setUpClass(cls):
        cls.testClient = super(
            TestInstanceNameFlagTrue,
            cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.hypervisor = (get_hypervisor_type(cls.api_client)).lower()
        if cls.hypervisor != "vmware":
            raise unittest.SkipTest("Instance name configuration value\
                    is effective only on vmware hypervisor")

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client,
                            cls.testClient.getZoneForTests())
        cls.services["mode"] = cls.zone.networktype
        cls.template = get_template(
            cls.api_client,
            cls.zone.id,
            cls.services["ostype"]
        )

        # Create account
        cls.account = Account.create(
            cls.api_client,
            cls.services["account"],
            admin=True,
            domainid=cls.domain.id
        )
        cls.account_2 = Account.create(
            cls.api_client,
            cls.services["account_2"],
            admin=True,
            domainid=cls.domain.id
        )

        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = cls.template.id

        cls.service_offering = ServiceOffering.create(
            cls.api_client,
            cls.services["service_offering"]
        )
        cls._cleanup = [cls.account,
                        cls.account_2]
        return
示例#19
0
    def setUpClass(cls):
        cls.testClient = super(TestVolumes, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.services['mode'] = cls.zone.networktype
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() == 'lxc':
            if not find_storage_pool_type(cls.api_client, storagetype='rbd'):
                raise unittest.SkipTest(
                    "RBD storage type is required for data volumes for LXC")
        cls.disk_offering = DiskOffering.create(cls.api_client,
                                                cls.services["disk_offering"])
        template = get_template(cls.api_client, cls.zone.id,
                                cls.services["ostype"])
        cls.services["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = template.id
        cls.services["virtual_machine"][
            "diskofferingid"] = cls.disk_offering.id

        # Create VMs, VMs etc
        cls.account = Account.create(cls.api_client,
                                     cls.services["account"],
                                     domainid=cls.domain.id)

        cls.service_offering = ServiceOffering.create(
            cls.api_client, cls.services["service_offering"])
        cls.virtual_machine = VirtualMachine.create(
            cls.api_client,
            cls.services["virtual_machine"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
        )

        cls.volume = Volume.create(cls.api_client,
                                   cls.services["volume"],
                                   zoneid=cls.zone.id,
                                   account=cls.account.name,
                                   domainid=cls.account.domainid,
                                   diskofferingid=cls.disk_offering.id)
        cls._cleanup = [cls.service_offering, cls.disk_offering, cls.account]
    def setUpClass(cls):
        cls.testClient = super(TestSnapshotLimit, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.services['mode'] = cls.zone.networktype
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        cls._cleanup = []

        try:
            template = get_template(cls.api_client, cls.zone.id,
                                    cls.services["ostype"])
            cls.services["server"]["zoneid"] = cls.zone.id

            cls.services["template"] = template.id

            # Create VMs, NAT Rules etc
            cls.account = Account.create(cls.api_client,
                                         cls.services["account"],
                                         domainid=cls.domain.id)
            cls._cleanup.append(cls.account)

            cls.services["account"] = cls.account.name

            if cls.zone.localstorageenabled:
                cls.services["service_offering"]["storagetype"] = "local"
            cls.service_offering = ServiceOffering.create(
                cls.api_client, cls.services["service_offering"])
            cls._cleanup.append(cls.service_offering)
            cls.virtual_machine = VirtualMachine.create(
                cls.api_client,
                cls.services["server"],
                templateid=template.id,
                accountid=cls.account.name,
                domainid=cls.account.domainid,
                serviceofferingid=cls.service_offering.id)
            cls._cleanup.append(cls.virtual_machine)
        except Exception, e:
            cls.tearDownClass()
            unittest.SkipTest("setupClass fails for %s" % cls.__name__)
            raise e
示例#21
0
    def setUpClass(cls):
        testClient = super(TestScaleVm, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.services = testClient.getParsedTestDataConfig()
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ('kvm', 'hyperv', 'lxc'):
            raise unittest.SkipTest(
                "ScaleVM is not supported on KVM, Hyper-V or LXC.\
                        Hence, skipping the test")

        # Get Zone, Domain and templates
        domain = get_domain(cls.apiclient)
        zone = get_zone(cls.apiclient, testClient.getZoneForTests())
        cls.services['mode'] = zone.networktype

        template = get_template(cls.apiclient, zone.id, cls.services["ostype"])
        if template == FAILED:
            assert False, "get_template() failed to return template\
                    with description %s" % cls.services["ostype"]

        # Set Zones and disk offerings ??
        cls.services["small"]["zoneid"] = zone.id
        cls.services["small"]["template"] = template.id

        # Create account, service offerings, vm.
        cls.account = Account.create(cls.apiclient,
                                     cls.services["account"],
                                     domainid=domain.id)

        cls.small_offering = ServiceOffering.create(
            cls.apiclient, cls.services["service_offerings"]["small"])

        cls.big_offering = ServiceOffering.create(
            cls.apiclient, cls.services["service_offerings"]["big"])

        # create a virtual machine
        cls.virtual_machine = VirtualMachine.create(
            cls.apiclient,
            cls.services["small"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.small_offering.id,
            mode=cls.services["mode"])
        cls._cleanup = [cls.small_offering, cls.account]
    def setUpClass(cls):
        cls.testClient = super(TestHostsForMigration, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())

        cls.template = get_template(
            cls.api_client,
            cls.zone.id,
            cls.services["ostype"]
        )


        clusterWithSufficientHosts = None
        clusters = Cluster.list(cls.api_client, zoneid=cls.zone.id)
        for cluster in clusters:
            cls.hosts = Host.list(cls.api_client, clusterid=cluster.id, type="Routing")
            if len(cls.hosts) >= 2:
                clusterWithSufficientHosts = cluster
                break

        if clusterWithSufficientHosts is None:
            raise unittest.SkipTest("No Cluster with 2 hosts found")


        Host.update(cls.api_client, id=cls.hosts[1].id, hosttags="PREMIUM")

        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = cls.template.id

        cls.service_offering_with_tag = ServiceOffering.create(
            cls.api_client,
            cls.services["service_offering_with_tag"]
        )

        cls._cleanup = [
            cls.service_offering_with_tag,
            ]
        return
示例#23
0
    def setUpClass(cls):
        cls.testClient = super(TestHosts, cls).getClsTestClient()
        cls.testdata = cls.testClient.getParsedTestDataConfig()
        cls.apiclient = cls.testClient.getApiClient()
        cls.dbclient = cls.testClient.getDbConnection()
        cls._cleanup = []

        #get zone, domain etc
        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
        cls.domain = get_domain(cls.apiclient)
        cls.pod = get_pod(cls.apiclient, cls.zone.id)

        # list hosts
        hosts = list_hosts(cls.apiclient)
        if len(hosts) > 0:
            cls.my_host_id = hosts[0].id
            cls.host_db_id = cls.dbclient.execute(
                "select id from host where uuid='%s';" % cls.my_host_id)
            cls.my_cluster_id = hosts[0].clusterid
        else:
            raise unittest.SkipTest("There is no host available in the setup")
示例#24
0
    def setUp(self):

        if self.testClient.getHypervisorInfo().lower() != "vmware":
            raise unittest.SkipTest(
                "VMWare tests only valid on VMWare hypervisor")

        self.services = self.testClient.getParsedTestDataConfig()
        self.apiclient = self.testClient.getApiClient()
        self.dbclient = self.testClient.getDbConnection()
        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
        self.domain = get_domain(self.apiclient)
        self.services['mode'] = self.zone.networktype
        self.hypervisor = self.hypervisor = self.testClient.getHypervisorInfo()

        template = get_suitable_test_template(self.apiclient, self.zone.id,
                                              self.services["ostype"],
                                              self.hypervisor)

        if template == FAILED:
            assert False, "get_suitable_test_template() failed to return template with description %s" % self.services[
                "ostype"]

        self.account = Account.create(self.apiclient,
                                      self.services["account"],
                                      domainid=self.domain.id)

        self.services["small"]["zoneid"] = self.zone.id
        self.services["small"]["template"] = template.id

        self.services["iso1"]["zoneid"] = self.zone.id

        iso = Iso.create(self.apiclient,
                         self.services["iso1"],
                         account=self.account.name,
                         domainid=self.account.domainid)

        self.cleanup = [self.account]
示例#25
0
    def setUpClass(cls):
        cls.testClient = super(TestCreateSnapshot, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ['hyperv']:
            raise unittest.SkipTest(
                "Snapshots feature is not supported on Hyper-V")
        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())

        cls.template = get_template(cls.api_client, cls.zone.id,
                                    cls.services["ostype"])

        cls.services["virtual_machine"]["zoneid"] = cls.zone.id

        # Create VMs, NAT Rules etc
        cls.service_offering = ServiceOffering.create(
            cls.api_client, cls.services["service_offering"])
        cls._cleanup = [
            cls.service_offering,
        ]
        return
示例#26
0
    def setUpClass(cls):

        cls.testClient = super(TestVMPlacement, cls).getClsTestClient()
        if cls.testClient.getHypervisorInfo().lower() != "vmware":
            raise unittest.SkipTest(
                "VMWare tests only valid on VMWare hypervisor")
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.pod = get_pod(cls.api_client, zone_id=cls.zone.id)
        cls.template = get_template(cls.api_client, cls.zone.id,
                                    cls.services["ostype"])
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = cls.template.id

        cls.service_offering = ServiceOffering.create(
            cls.api_client, cls.services["service_offering"], offerha=True)
        cls._cleanup = [
            cls.service_offering,
        ]
        return
示例#27
0
    def setUpClass(cls):

        cls.testClient = super(TestTemplates, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.services['mode'] = cls.zone.networktype
        #populate second zone id for iso copy
        cmd = listZones.listZonesCmd()
        zones = cls.api_client.listZones(cmd)
        if not isinstance(zones, list):
            raise Exception("Failed to find zones.")
        if len(zones) >= 2:
            cls.services["destzoneid"] = zones[1].id

        template = get_template(cls.api_client, cls.zone.id,
                                cls.services["ostype"])
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls._cleanup = []
        try:
            cls.account = Account.create(cls.api_client,
                                         cls.services["account"],
                                         domainid=cls.domain.id)
            cls._cleanup.append(cls.account)

            cls.services["account"] = cls.account.name
            cls.service_offering = ServiceOffering.create(
                cls.api_client, cls.services["service_offering"])
            cls._cleanup.append(cls.service_offering)

            # create virtual machine
            cls.virtual_machine = VirtualMachine.create(
                cls.api_client,
                cls.services["virtual_machine"],
                templateid=template.id,
                accountid=cls.account.name,
                domainid=cls.account.domainid,
                serviceofferingid=cls.service_offering.id,
            )
            #Stop virtual machine
            cls.virtual_machine.stop(cls.api_client)

            timeout = cls.services["timeout"]

            while True:
                list_volume = Volume.list(
                    cls.api_client,
                    virtualmachineid=cls.virtual_machine.id,
                    type='ROOT',
                    listall=True)
                if isinstance(list_volume, list):
                    break
                elif timeout == 0:
                    raise Exception("List volumes failed.")

                time.sleep(5)
                timeout = timeout - 1

            cls.volume = list_volume[0]

            #Create template from volume
            cls.template = Template.create(cls.api_client,
                                           cls.services["template"],
                                           cls.volume.id)
        except Exception as e:
            cls.tearDownClass()
            raise unittest.SkipTest("Failure in setUpClass: %s" % e)
示例#28
0
    def setUpClass(cls):
        cls._cleanup = []
        cls.testClient = super(TestBrocadeVcs, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.template = get_template(cls.api_client, cls.zone.id,
                                    cls.services["ostype"])
        try:
            cls.brocadeDeviceData = cls.config.__dict__[
                "brocadeDeviceData"].__dict__
            assert cls.brocadeDeviceData[
                "ipaddress"], "ipaddress of brocade device\
                    not present in config file"

            assert cls.brocadeDeviceData[
                "username"], "username of brocade device\
                    not present in config file"

        except Exception as e:
            raise unittest.SkipTest("Exception occured while reading\
                    brocade device data from config file: %s" % e)
        try:
            """ Adds Brocade device and enables NS provider"""
            cmd = listPhysicalNetworks.listPhysicalNetworksCmd()
            cmd.zoneid = cls.zone.id
            physical_networks = cls.api_client.listPhysicalNetworks(cmd)
            if isinstance(physical_networks, list):
                physical_network = physical_networks[0]
            cmd = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
            cmd.name = 'BrocadeVcs'
            cmd.physicalnetworkid = physical_network.id
            nw_service_providers = cls.api_client.listNetworkServiceProviders(
                cmd)

            if isinstance(nw_service_providers, list):
                brocade_provider = nw_service_providers[0]
            else:
                cmd1 = addNetworkServiceProvider.addNetworkServiceProviderCmd()
                cmd1.name = 'BrocadeVcs'
                cmd1.physicalnetworkid = physical_network.id
                brocade_provider = cls.api_client.addNetworkServiceProvider(
                    cmd1)

            cmd2 = addBrocadeVcsDevice.addBrocadeVcsDeviceCmd()
            cmd2.physicalnetworkid = physical_network.id
            cmd2.username = cls.brocadeDeviceData["username"]
            cmd2.password = cls.brocadeDeviceData["password"]
            cmd2.hostname = cls.brocadeDeviceData["ipaddress"]
            cls.brocade = cls.api_client.addBrocadeVcsDevice(cmd2)

            if brocade_provider.state != 'Enabled':
                cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd(
                )
                cmd.id = brocade_provider.id
                cmd.state = 'Enabled'
                cls.api_client.updateNetworkServiceProvider(cmd)

            cls.network_offering = NetworkOffering.create(
                cls.api_client,
                cls.services["network_offering"],
                conservemode=True)
            cls._cleanup.append(cls.network_offering)

            # Enable Network offering
            cls.network_offering.update(cls.api_client, state='Enabled')
            cls.services["virtual_machine"]["zoneid"] = cls.zone.id
            cls.services["virtual_machine"]["template"] = cls.template.id
            cls.service_offering = ServiceOffering.create(
                cls.api_client, cls.services["service_offering"])
            cls._cleanup.append(cls.service_offering)
        except Exception as e:
            cls.tearDownClass()
            raise Exception("Warning: Exception in setUpClass: %s" % e)
        return
示例#29
0
    def setUpClass(cls):
        testClient = super(TestCopyDeleteTemplate, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls._cleanup = []
        cls.services = testClient.getParsedTestDataConfig()
        cls.unsupportedHypervisor = False
        cls.hypervisor = testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ['lxc']:
            # Template creation from root volume is not supported in LXC
            cls.unsupportedHypervisor = True
            return

        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
        cls.services['mode'] = cls.zone.networktype
        try:
            cls.disk_offering = DiskOffering.create(
                cls.apiclient, cls.services["disk_offering"])
            cls._cleanup.append(cls.disk_offering)
            template = get_template(cls.apiclient, cls.zone.id,
                                    cls.services["ostype"])
            if template == FAILED:
                assert False, "get_template() failed to return template with description %s" % cls.services[
                    "ostype"]

            cls.services["template"]["ostypeid"] = template.ostypeid
            cls.services["template_2"]["ostypeid"] = template.ostypeid
            cls.services["ostypeid"] = template.ostypeid

            cls.services["virtual_machine"]["zoneid"] = cls.zone.id
            cls.services["volume"]["diskoffering"] = cls.disk_offering.id
            cls.services["volume"]["zoneid"] = cls.zone.id
            cls.services["sourcezoneid"] = cls.zone.id
            cls.account = Account.create(cls.apiclient,
                                         cls.services["account"],
                                         domainid=cls.domain.id)
            cls._cleanup.append(cls.account)
            cls.service_offering = ServiceOffering.create(
                cls.apiclient, cls.services["service_offerings"]["tiny"])
            cls._cleanup.append(cls.service_offering)
            #create virtual machine
            cls.virtual_machine = VirtualMachine.create(
                cls.apiclient,
                cls.services["virtual_machine"],
                templateid=template.id,
                accountid=cls.account.name,
                domainid=cls.account.domainid,
                serviceofferingid=cls.service_offering.id,
                mode=cls.services["mode"])
            #Stop virtual machine
            cls.virtual_machine.stop(cls.apiclient)

            list_volume = Volume.list(cls.apiclient,
                                      virtualmachineid=cls.virtual_machine.id,
                                      type='ROOT',
                                      listall=True)

            cls.volume = list_volume[0]
        except Exception as e:
            cls.tearDownClass()
            raise unittest.SkipTest("Exception in setUpClass: %s" % e)
        return
示例#30
0
    def setUpClass(cls):
        cls.testClient = super(TestDeployVMFromISOWithUefi,
                               cls).getClsTestClient()
        cls.apiclient = cls.testClient.getApiClient()

        cls.hypervisor = cls.testClient.getHypervisorInfo()

        if cls.hypervisor != 'kvm':
            raise unittest.SkipTest(
                "Those tests can be run only for KVM hypervisor")

        cls.testdata = cls.testClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())

        hosts = list_hosts(cls.apiclient, zoneid=cls.zone.id, type="Routing")

        if not cls.isUefiEnabledOnAtLeastOnHost(hosts):
            raise unittest.SkipTest("At least one host should support UEFI")

        cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][
            0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__

        # Create service, disk offerings  etc
        cls.service_offering = ServiceOffering.create(
            cls.apiclient, cls.testdata["service_offering"])

        cls.disk_offering = DiskOffering.create(cls.apiclient,
                                                cls.testdata["disk_offering"])

        cls.testdata["virtual_machine"]["zoneid"] = cls.zone.id
        cls.testdata["iso1"]["zoneid"] = cls.zone.id
        cls.testdata["iso3"]["zoneid"] = cls.zone.id
        cls.account = Account.create(cls.apiclient,
                                     cls.testdata["account"],
                                     domainid=cls.domain.id)
        cls._cleanup = [cls.account, cls.service_offering, cls.disk_offering]

        cls.centos_iso = Iso.create(cls.apiclient,
                                    cls.testdata["iso1"],
                                    account=cls.account.name,
                                    domainid=cls.account.domainid,
                                    zoneid=cls.zone.id)
        try:
            # Download the ISO
            cls.centos_iso.download(cls.apiclient)
        except Exception as e:
            raise Exception("Exception while downloading ISO %s: %s" %
                            (cls.centos_iso.id, e))

        cls.windows_iso = Iso.create(cls.apiclient,
                                     cls.testdata["iso3"],
                                     account=cls.account.name,
                                     domainid=cls.account.domainid,
                                     zoneid=cls.zone.id)
        try:
            # Download the ISO
            cls.windows_iso.download(cls.apiclient)
        except Exception as e:
            raise Exception("Exception while downloading ISO %s: %s" %
                            (cls.windows_iso.id, e))

        return