def setUpCloudStack(cls):
        testClient = super(TestStoragePool, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.unsupportedHypervisor = False
        cls.hypervisor = testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ("hyperv", "lxc"):
            cls.unsupportedHypervisor = True
            return

        cls.services = testClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = None
        cls._cleanup = []

        zones = list_zones(cls.apiclient)

        for z in zones:
            if z.internaldns1 == cls.getClsConfig().mgtSvr[0].mgtSvrIp:
                cls.zone = z

        td = TestData()
        cls.testdata = td.testdata
        cls.helper = StorPoolHelper()

        cls.account = cls.helper.create_account(cls.apiclient,
                                                cls.services["account"],
                                                accounttype=1,
                                                domainid=cls.domain.id,
                                                roleid=1)
        cls._cleanup.append(cls.account)

        securitygroup = SecurityGroup.list(cls.apiclient,
                                           account=cls.account.name,
                                           domainid=cls.account.domainid)[0]
        cls.helper.set_securityGroups(cls.apiclient,
                                      account=cls.account.name,
                                      domainid=cls.account.domainid,
                                      id=securitygroup.id)

        storpool_primary_storage = cls.testdata[TestData.primaryStorage]

        storpool_service_offerings = cls.testdata[TestData.serviceOffering]

        cls.template_name = storpool_primary_storage.get("name")

        storage_pool = list_storage_pools(cls.apiclient,
                                          name=cls.template_name)

        service_offerings = list_service_offering(cls.apiclient,
                                                  name=cls.template_name)

        disk_offerings = list_disk_offering(cls.apiclient, name="Small")

        disk_offering_20 = list_disk_offering(cls.apiclient, name="Medium")

        disk_offering_100 = list_disk_offering(cls.apiclient, name="Large")

        cls.disk_offerings = disk_offerings[0]
        cls.disk_offering_20 = disk_offering_20[0]
        cls.disk_offering_100 = disk_offering_100[0]
        cls.debug(pprint.pformat(storage_pool))
        if storage_pool is None:
            storage_pool = StoragePool.create(cls.apiclient,
                                              storpool_primary_storage)
        else:
            storage_pool = storage_pool[0]
        cls.storage_pool = storage_pool
        cls.debug(pprint.pformat(storage_pool))
        if service_offerings is None:
            service_offerings = ServiceOffering.create(
                cls.apiclient, storpool_service_offerings)
        else:
            service_offerings = service_offerings[0]
        #The version of CentOS has to be supported
        template = get_template(cls.apiclient, cls.zone.id, account="system")

        cls.debug(pprint.pformat(template))
        cls.debug(pprint.pformat(cls.hypervisor))

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

        cls.service_offering = service_offerings
        cls.debug(pprint.pformat(cls.service_offering))

        cls.local_cluster = cls.helper.get_local_cluster(cls.apiclient,
                                                         zoneid=cls.zone.id)
        cls.host = cls.helper.list_hosts_by_cluster_id(cls.apiclient,
                                                       cls.local_cluster.id)

        cls.remote_cluster = cls.helper.get_remote_cluster(cls.apiclient,
                                                           zoneid=cls.zone.id)
        cls.host_remote = cls.helper.list_hosts_by_cluster_id(
            cls.apiclient, cls.remote_cluster.id)

        cls.services["domainid"] = cls.domain.id
        cls.services["small"]["zoneid"] = cls.zone.id
        cls.services["templates"]["ostypeid"] = template.ostypeid
        cls.services["zoneid"] = cls.zone.id
        cls.services["diskofferingid"] = cls.disk_offerings.id

        cls.volume_1 = Volume.create(cls.apiclient,
                                     cls.services,
                                     account=cls.account.name,
                                     domainid=cls.account.domainid)

        cls.volume = Volume.create(cls.apiclient,
                                   cls.services,
                                   account=cls.account.name,
                                   domainid=cls.account.domainid)

        cls.virtual_machine = VirtualMachine.create(
            cls.apiclient, {"name": "StorPool-%s" % uuid.uuid4()},
            zoneid=cls.zone.id,
            templateid=template.id,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            hypervisor=cls.hypervisor,
            hostid=cls.host[0].id,
            rootdisksize=10)
        cls.virtual_machine2 = VirtualMachine.create(
            cls.apiclient, {"name": "StorPool-%s" % uuid.uuid4()},
            zoneid=cls.zone.id,
            templateid=template.id,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            hypervisor=cls.hypervisor,
            hostid=cls.host[0].id,
            rootdisksize=10)
        cls.virtual_machine3 = VirtualMachine.create(
            cls.apiclient, {"name": "StorPool-%s" % uuid.uuid4()},
            zoneid=cls.zone.id,
            templateid=template.id,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            hypervisor=cls.hypervisor,
            hostid=cls.host[0].id,
            rootdisksize=10)
        cls.template = template
        cls.random_data_0 = random_gen(size=100)
        cls.test_dir = "/tmp"
        cls.random_data = "random.data"

        return
    def setUpCloudStack(cls):
        cls.spapi = spapi.Api.fromConfig(multiCluster=True)
        testClient = super(TestMigrateVMWithVolumes, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()

        cls._cleanup = []

        cls.unsupportedHypervisor = False
        cls.hypervisor = testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ("hyperv", "lxc"):
            cls.unsupportedHypervisor = True
            return

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

        zones = list_zones(cls.apiclient)

        for z in zones:
            if z.internaldns1 == cls.getClsConfig().mgtSvr[0].mgtSvrIp:
                cls.zone = z

        td = TestData()
        cls.testdata = td.testdata
        cls.helper = StorPoolHelper()
        storpool_primary_storage = cls.testdata[TestData.primaryStorage]
        cls.template_name = storpool_primary_storage.get("name")
        storpool_service_offerings = cls.testdata[TestData.serviceOffering]

        nfs_service_offerings = cls.testdata[TestData.serviceOfferingsPrimary]
        ceph_service_offerings = cls.testdata[TestData.serviceOfferingsCeph]

        nfs_disk_offerings = cls.testdata[TestData.nfsDiskOffering]
        ceph_disk_offerings = cls.testdata[TestData.cephDiskOffering]

        storage_pool = list_storage_pools(cls.apiclient,
                                          name=cls.template_name)

        nfs_storage_pool = list_storage_pools(cls.apiclient, name='primary')

        ceph_primary_storage = cls.testdata[TestData.primaryStorage4]

        cls.ceph_storage_pool = list_storage_pools(
            cls.apiclient, name=ceph_primary_storage.get("name"))[0]

        service_offerings = list_service_offering(cls.apiclient,
                                                  name=cls.template_name)
        nfs_service_offering = list_service_offering(cls.apiclient, name='nfs')

        ceph_service_offering = list_service_offering(
            cls.apiclient, name=ceph_primary_storage.get("name"))

        if storage_pool is None:
            storage_pool = StoragePool.create(cls.apiclient,
                                              storpool_primary_storage)
        else:
            storage_pool = storage_pool[0]
        cls.storage_pool = storage_pool
        cls.debug(pprint.pformat(storage_pool))
        if service_offerings is None:
            service_offerings = ServiceOffering.create(
                cls.apiclient, storpool_service_offerings)
        else:
            service_offerings = service_offerings[0]
        if nfs_service_offering is None:
            nfs_service_offering = ServiceOffering.create(
                cls.apiclient, nfs_service_offerings)
        else:
            nfs_service_offering = nfs_service_offering[0]

        if ceph_service_offering is None:
            ceph_service_offering = ServiceOffering.create(
                cls.apiclient, ceph_service_offerings)
        else:
            ceph_service_offering = ceph_service_offering[0]

        nfs_disk_offering = list_disk_offering(cls.apiclient, name="nfs")
        if nfs_disk_offering is None:
            nfs_disk_offering = DiskOffering.create(cls.apiclient,
                                                    nfs_disk_offerings)
        else:
            cls.nfs_disk_offering = nfs_disk_offering[0]

        ceph_disk_offering = list_disk_offering(cls.apiclient, name="ceph")
        if ceph_disk_offering is None:
            cls.ceph_disk_offering = DiskOffering.create(
                cls.apiclient, ceph_disk_offerings)
        else:
            cls.ceph_disk_offering = ceph_disk_offering[0]

        template = get_template(cls.apiclient, cls.zone.id, account="system")

        cls.nfs_storage_pool = nfs_storage_pool[0]
        if cls.nfs_storage_pool.state == "Maintenance":
            cls.nfs_storage_pool = StoragePool.cancelMaintenance(
                cls.apiclient, cls.nfs_storage_pool.id)

        if cls.ceph_storage_pool.state == "Maintenance":
            cls.ceph_storage_pool = StoragePool.cancelMaintenance(
                cls.apiclient, cls.ceph_storage_pool.id)

        cls.account = cls.helper.create_account(cls.apiclient,
                                                cls.services["account"],
                                                accounttype=1,
                                                domainid=cls.domain.id,
                                                roleid=1)
        cls._cleanup.append(cls.account)

        securitygroup = SecurityGroup.list(cls.apiclient,
                                           account=cls.account.name,
                                           domainid=cls.account.domainid)[0]
        cls.helper.set_securityGroups(cls.apiclient,
                                      account=cls.account.name,
                                      domainid=cls.account.domainid,
                                      id=securitygroup.id)

        cls.vm = VirtualMachine.create(
            cls.apiclient, {"name": "StorPool-%s" % uuid.uuid4()},
            zoneid=cls.zone.id,
            templateid=template.id,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=nfs_service_offering.id,
            diskofferingid=cls.nfs_disk_offering.id,
            hypervisor=cls.hypervisor,
            rootdisksize=10)

        cls.vm2 = VirtualMachine.create(
            cls.apiclient, {"name": "StorPool-%s" % uuid.uuid4()},
            zoneid=cls.zone.id,
            templateid=template.id,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=ceph_service_offering.id,
            diskofferingid=cls.ceph_disk_offering.id,
            hypervisor=cls.hypervisor,
            rootdisksize=10)

        cls.debug(pprint.pformat(template))
        cls.debug(pprint.pformat(cls.hypervisor))

        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["small"]["zoneid"] = cls.zone.id
        cls.services["templates"]["ostypeid"] = template.ostypeid
        cls.services["zoneid"] = cls.zone.id

        cls.service_offering = service_offerings
        cls.nfs_service_offering = nfs_service_offering
        cls.debug(pprint.pformat(cls.service_offering))

        cls.template = template
        cls.random_data_0 = random_gen(size=100)
        cls.test_dir = "/tmp"
        cls.random_data = "random.data"
        return
Exemplo n.º 3
0
    def setUpCloudStack(cls):
        testClient = super(TestVmSnapshot, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls._cleanup = []
        cls.unsupportedHypervisor = False

        # Setup test data
        td = TestData()
        cls.testdata = td.testdata
        cls.helper = StorPoolHelper()


        cls.services = testClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = None
        zones = list_zones(cls.apiclient)

        for z in zones:
            if z.name == cls.getClsConfig().mgtSvr[0].zone:
                cls.zone = z

        assert cls.zone is not None

        cls.cluster = list_clusters(cls.apiclient)[0]
        cls.hypervisor = get_hypervisor_type(cls.apiclient)

        #The version of CentOS has to be supported
        template = get_template(
            cls.apiclient,
            cls.zone.id,
            account = "system"
        )


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

        cls.template = template

        cls.account = cls.helper.create_account(
                            cls.apiclient,
                            cls.services["account"],
                            accounttype = 1,
                            domainid=cls.domain.id,
                            roleid = 1
                            )
        cls._cleanup.append(cls.account)

        securitygroup = SecurityGroup.list(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid)[0]
        cls.helper.set_securityGroups(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid, id = securitygroup.id)

        primarystorage = cls.testdata[TestData.primaryStorage]

        serviceOffering = cls.testdata[TestData.serviceOffering]
        storage_pool = list_storage_pools(
            cls.apiclient,
            name = primarystorage.get("name")
            )
        cls.primary_storage = storage_pool[0]

        disk_offering = list_disk_offering(
            cls.apiclient,
            name="ssd"
            )

        assert disk_offering is not None


        service_offering_only = list_service_offering(
            cls.apiclient,
            name="ssd"
            )
        if service_offering_only is not None:
            cls.service_offering_only = service_offering_only[0]
        else:
            cls.service_offering_only = ServiceOffering.create(
                cls.apiclient,
                serviceOffering)
        assert cls.service_offering_only is not None

        cls.disk_offering = disk_offering[0]

        # Create 1 data volume_1
        cls.volume = Volume.create(
            cls.apiclient,
            cls.testdata[TestData.volume_1],
            account=cls.account.name,
            domainid=cls.domain.id,
            zoneid=cls.zone.id,
            diskofferingid=cls.disk_offering.id,
            size=10
        )

        cls.virtual_machine = VirtualMachine.create(
            cls.apiclient,
            {"name":"StorPool-%s" % uuid.uuid4() },
            zoneid=cls.zone.id,
            templateid=cls.template.id,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering_only.id,
            hypervisor=cls.hypervisor,
            rootdisksize=10
        )

        cls.random_data_0 = random_gen(size=100)
        cls.test_dir = "/tmp"
        cls.random_data = "random.data"
        return
Exemplo n.º 4
0
    def setUpCloudStack(cls):
        cls._cleanup = []

        cls.spapi = spapi.Api.fromConfig(multiCluster=True)
        testClient = super(TestResizeVolumes, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.unsupportedHypervisor = False
        cls.hypervisor = testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ("hyperv", "lxc"):
            cls.unsupportedHypervisor = True
            return

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

        zones = list_zones(cls.apiclient)

        for z in zones:
            if z.internaldns1 == cls.getClsConfig().mgtSvr[0].mgtSvrIp:
                cls.zone = z

        td = TestData()
        cls.testdata = td.testdata
        cls.helper = StorPoolHelper()

        storpool_primary_storage = cls.testdata[TestData.primaryStorage]

        cls.template_name = storpool_primary_storage.get("name")

        storpool_service_offerings = cls.testdata[TestData.serviceOfferingsIops]

        storpool_disk_offerings = {
            "name": "iops",
            "displaytext": "Testing IOPS on StorPool",
            "customizediops": True,
            "storagetype": "shared",
            "tags" : cls.template_name,
            }

        storage_pool = list_storage_pools(
            cls.apiclient,
            name = cls.template_name
            )

        service_offerings = list_service_offering(
            cls.apiclient,
            name='iops'
            )

        disk_offerings = list_disk_offering(
            cls.apiclient,
            name="iops"
            )

        if disk_offerings is None:
            disk_offerings = DiskOffering.create(cls.apiclient, storpool_disk_offerings, custom = True)
        else:
            disk_offerings = disk_offerings[0]
        cls.disk_offerings = disk_offerings
        if storage_pool is None:
            storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
        else:
            storage_pool = storage_pool[0]
        cls.storage_pool = storage_pool
        cls.debug(pprint.pformat(storage_pool))
        if service_offerings is None:
            service_offerings = ServiceOffering.create(cls.apiclient, storpool_service_offerings)
        else:
            service_offerings = service_offerings[0]

        template = get_template(
             cls.apiclient,
            cls.zone.id,
            account = "system"
        )

        cls.debug(pprint.pformat(template))
        cls.debug(pprint.pformat(cls.hypervisor))

        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["small"]["zoneid"] = cls.zone.id
        cls.services["templates"]["ostypeid"] = template.ostypeid
        cls.services["zoneid"] = cls.zone.id

        cls.account = cls.helper.create_account(
                            cls.apiclient,
                            cls.services["account"],
                            accounttype = 1,
                            domainid=cls.domain.id,
                            )
        cls._cleanup.append(cls.account)

        securitygroup = SecurityGroup.list(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid)[0]
        cls.helper.set_securityGroups(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid, id = securitygroup.id)

        cls.service_offering = service_offerings
        cls.debug(pprint.pformat(cls.service_offering))

        cls.local_cluster = cls.helper.get_local_cluster(cls.apiclient, zoneid = cls.zone.id)
        cls.host = cls.helper.list_hosts_by_cluster_id(cls.apiclient, cls.local_cluster.id)

        assert len(cls.host) > 1, "Hosts list is less than 1"
        cls.host_on_local_1 = cls.host[0]
        cls.host_on_local_2 = cls.host[1]

        cls.remote_cluster = cls.helper.get_remote_cluster(cls.apiclient, zoneid = cls.zone.id)
        cls.host_remote = cls.helper.list_hosts_by_cluster_id(cls.apiclient, cls.remote_cluster.id)
        assert len(cls.host_remote) > 1, "Hosts list is less than 1"

        cls.host_on_remote1 = cls.host_remote[0]
        cls.host_on_remote2 = cls.host_remote[1]

        cls.volume_1 = cls.helper.create_custom_disk(
            cls.apiclient,
            {"diskname":"StorPoolDisk" },
            zoneid=cls.zone.id,
            size = 5,
            miniops = 2000,
            maxiops = 5000,
            account=cls.account.name,
            domainid=cls.account.domainid,
            diskofferingid=cls.disk_offerings.id,
        )
        cls.volume_2 = cls.helper.create_custom_disk(
            cls.apiclient,
            {"diskname":"StorPoolDisk" },
            zoneid=cls.zone.id,
            size = 5,
            miniops = 2000,
            maxiops = 5000,
            account=cls.account.name,
            domainid=cls.account.domainid,
            diskofferingid=cls.disk_offerings.id,
        )
        cls.volume = cls.helper.create_custom_disk(
            cls.apiclient,
            {"diskname":"StorPoolDisk" },
            zoneid=cls.zone.id,
            size = 5,
            miniops = 2000,
            maxiops = 5000,
            account=cls.account.name,
            domainid=cls.account.domainid,
            diskofferingid=cls.disk_offerings.id,
        )
        cls.virtual_machine = cls.helper.create_vm_custom(
            cls.apiclient,
            {"name":"StorPool-%s" % uuid.uuid4() },
            zoneid=cls.zone.id,
            templateid=template.id,
            account=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            hypervisor=cls.hypervisor,
            minIops = 1000,
            maxIops = 5000,
            rootdisksize = 10
        )
        cls.virtual_machine2= cls.helper.create_vm_custom(
            cls.apiclient,
            {"name":"StorPool-%s" % uuid.uuid4() },
            zoneid=cls.zone.id,
            templateid=template.id,
            account=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            hypervisor=cls.hypervisor,
            minIops = 1000,
            maxIops = 5000,
            rootdisksize = 10
        )

        cls.virtual_machine_live_migration_1 = cls.helper.create_vm_custom(
            cls.apiclient,
            {"name":"StorPool-%s" % uuid.uuid4() },
            zoneid=cls.zone.id,
            templateid=template.id,
            account=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            hypervisor=cls.hypervisor,
            minIops = 1000,
            maxIops = 5000,
            hostid = cls.host_on_local_1.id,
            rootdisksize = 10
        )
        cls.virtual_machine_live_migration_2= cls.helper.create_vm_custom(
            cls.apiclient,
            {"name":"StorPool-%s" % uuid.uuid4() },
            zoneid=cls.zone.id,
            templateid=template.id,
            account=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            hypervisor=cls.hypervisor,
            minIops = 1000,
            maxIops = 5000,
            hostid = cls.host_on_remote1.id,
            rootdisksize = 10
        )

        cls.template = template
        cls.random_data_0 = random_gen(size=100)
        cls.test_dir = "/tmp"
        cls.random_data = "random.data"
        return
    def setUpCloudStack(cls):
        cls.testClient = super(TestNewPrimaryStorage, cls).getClsTestClient()

        cls.cleanup = []

        cls.apiclient = cls.testClient.getApiClient()
        cls.unsupportedHypervisor = False
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ("hyperv", "lxc"):
            cls.unsupportedHypervisor = True
            return

        td = TestData()
        cls.testdata = td.testdata
        cls.helper = StorPoolHelper()

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

        zones = list_zones(cls.apiclient)

        for z in zones:
            if z.internaldns1 == cls.getClsConfig().mgtSvr[0].mgtSvrIp:
                cls.zone = z

        cls.debug("################## zone %s" % cls.zone)
        cls.template_name = cls.testdata[TestData.primaryStorage3].get("name")
        cls.debug("################## template_name %s" % cls.template_name)

        cls.storage_pool_id = "spStoragePoolId"
        cls.sp_primary_storage, cls.spapiRemote, cls.spapi = cls.helper.create_sp_template_and_storage_pool(
            cls.apiclient, cls.template_name,
            cls.testdata[TestData.primaryStorage3], cls.zone.id)

        disk_offerings = list_disk_offering(cls.apiclient, name="Small")

        cls.disk_offerings = disk_offerings[0]

        diskOffering = {
            "name": cls.template_name,
            "displaytext": "test new primary storage disk offerigns",
            "disksize": 128,
            "tags": cls.template_name,
            "storagetype": "shared"
        }

        cls.sp_disk_offering = DiskOffering.create(cls.apiclient, diskOffering)
        cls.cleanup.append(cls.sp_disk_offering)

        sp_offerings = {
            "name": cls.template_name,
            "displaytext": cls.template_name,
            "cpunumber": 1,
            "cpuspeed": 500,
            "memory": 512,
            "storagetype": "shared",
            "tags": cls.template_name
        }
        cls.serviceOfferings = ServiceOffering.create(cls.apiclient,
                                                      sp_offerings)

        cls.template = get_template(cls.apiclient,
                                    cls.zone.id,
                                    account="system")
Exemplo n.º 6
0
    def setUpCloudStack(cls):
        cls._cleanup = []
        cls.spapi = spapi.Api.fromConfig(multiCluster=True)

        testClient = super(TestStoragePool, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.unsupportedHypervisor = False
        cls.hypervisor = testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ("hyperv", "lxc"):
            cls.unsupportedHypervisor = True
            return

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

        zones = list_zones(cls.apiclient)

        for z in zones:
            if z.internaldns1 == cls.getClsConfig().mgtSvr[0].mgtSvrIp:
                cls.zone = z

        cls.debug("##################### zone %s" % cls.zone)
        td = TestData()
        cls.testdata = td.testdata
        cls.helper = StorPoolHelper()

        storpool_primary_storage = {
            "name": "ssd",
            TestData.scope: "ZONE",
            "url": "ssd",
            TestData.provider: "StorPool",
            "path": "/dev/storpool",
            TestData.capacityBytes: 2251799813685248,
            TestData.hypervisor: "KVM"
        }

        storpool_without_qos = {
            "name": "ssd",
            "displaytext": "ssd",
            "cpunumber": 1,
            "cpuspeed": 500,
            "memory": 512,
            "storagetype": "shared",
            "customizediops": False,
            "hypervisorsnapshotreserve": 200,
            "tags": "ssd"
        }

        storpool_qos_template = {
            "name": "qos",
            "displaytext": "qos",
            "cpunumber": 1,
            "cpuspeed": 500,
            "memory": 512,
            "storagetype": "shared",
            "customizediops": False,
            "hypervisorsnapshotreserve": 200,
            "tags": "ssd"
        }

        disk_offering_ssd = {
            "name": "ssd",
            "displaytext": "SP_DO_1 (5GB Min IOPS = 300; Max IOPS = 500)",
            "disksize": 10,
            "customizediops": False,
            "hypervisorsnapshotreserve": 200,
            TestData.tags: "ssd",
            "storagetype": "shared"
        }

        disk_offering_qos = {
            "name": "qos",
            "displaytext": "SP_DO_1 (5GB Min IOPS = 300; Max IOPS = 500)",
            "disksize": 10,
            "customizediops": False,
            "hypervisorsnapshotreserve": 200,
            TestData.tags: "ssd",
            "storagetype": "shared"
        }

        cls.template_name = storpool_primary_storage.get("name")

        cls.template_name_2 = "qos"

        storage_pool = list_storage_pools(cls.apiclient, name="ssd")
        cls.primary_storage = storage_pool[0]

        if storage_pool is None:
            storage_pool = StoragePool.create(cls.apiclient,
                                              storpool_primary_storage)
        else:
            storage_pool = storage_pool[0]
        cls.storage_pool = storage_pool
        cls.debug(pprint.pformat(storage_pool))

        service_offerings_ssd = list_service_offering(cls.apiclient,
                                                      name=cls.template_name)

        service_offerings_qos = list_service_offering(cls.apiclient,
                                                      name=cls.template_name_2)

        if service_offerings_ssd is None:
            service_offerings_ssd = ServiceOffering.create(
                cls.apiclient, storpool_without_qos)
        else:
            service_offerings_ssd = service_offerings_ssd[0]

        if service_offerings_qos is None:
            service_offerings_qos = ServiceOffering.create(
                cls.apiclient, storpool_qos_template)
            ResourceDetails.create(cls.apiclient,
                                   resourceid=service_offerings_qos.id,
                                   resourcetype="ServiceOffering",
                                   details={"SP_TEMPLATE": "qos"},
                                   fordisplay=True)

        else:
            service_offerings_qos = service_offerings_qos[0]

        cls.service_offering_ssd = service_offerings_ssd
        cls.service_offering_qos = service_offerings_qos

        cls.disk_offering_ssd = list_disk_offering(cls.apiclient,
                                                   name=cls.template_name)
        cls.disk_offering_qos = list_disk_offering(cls.apiclient,
                                                   name=cls.template_name_2)

        if cls.disk_offering_ssd is None:
            cls.disk_offering_ssd = DiskOffering.create(
                cls.apiclient, disk_offering_ssd)
        else:
            cls.disk_offering_ssd = cls.disk_offering_ssd[0]

        if cls.disk_offering_qos is None:
            cls.disk_offering_qos = DiskOffering.create(
                cls.apiclient, disk_offering_qos)
            ResourceDetails.create(cls.apiclient,
                                   resourceid=cls.disk_offering_qos.id,
                                   resourcetype="DiskOffering",
                                   details={"SP_TEMPLATE": "qos"},
                                   fordisplay=True)
        else:
            cls.disk_offering_qos = cls.disk_offering_qos[0]

        #The version of CentOS has to be supported
        template = get_template(cls.apiclient, cls.zone.id, account="system")

        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["small"]["zoneid"] = cls.zone.id
        cls.services["templates"]["ostypeid"] = template.ostypeid
        cls.services["zoneid"] = cls.zone.id
        cls.services["diskofferingid"] = cls.disk_offering_ssd.id

        cls.account = cls.helper.create_account(cls.apiclient,
                                                cls.services["account"],
                                                accounttype=1,
                                                domainid=cls.domain.id,
                                                roleid=1)
        cls._cleanup.append(cls.account)

        securitygroup = SecurityGroup.list(cls.apiclient,
                                           account=cls.account.name,
                                           domainid=cls.account.domainid)[0]
        cls.helper.set_securityGroups(cls.apiclient,
                                      account=cls.account.name,
                                      domainid=cls.account.domainid,
                                      id=securitygroup.id)

        cls.volume_1 = Volume.create(cls.apiclient,
                                     cls.services,
                                     account=cls.account.name,
                                     domainid=cls.account.domainid)

        cls.volume_2 = Volume.create(cls.apiclient,
                                     cls.services,
                                     account=cls.account.name,
                                     domainid=cls.account.domainid)

        cls.virtual_machine = VirtualMachine.create(
            cls.apiclient, {"name": "StorPool-%s" % uuid.uuid4()},
            zoneid=cls.zone.id,
            templateid=template.id,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering_ssd.id,
            hypervisor=cls.hypervisor,
            rootdisksize=10)
        cls.virtual_machine.attach_volume(cls.apiclient, cls.volume_1)

        cls.virtual_machine.attach_volume(cls.apiclient, cls.volume_2)

        cls.template = template
        cls.hostid = cls.virtual_machine.hostid

        cls.random_data_0 = random_gen(size=100)
        cls.test_dir = "/tmp"
        cls.random_data = "random.data"
        return