def setUpClass(cls): cls.testClient = super(TestSnapshots, 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._cleanup = [] cls.unsupportedHypervisor = False cls.hypervisor = str(get_hypervisor_type(cls.api_client)).lower() cls.disk_offering = DiskOffering.create(cls.api_client, cls.services["disk_offering"]) cls.template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"]) cls.services["domainid"] = cls.domain.id cls.services["volume"]["zoneid"] = cls.services["server_with_disk"][ "zoneid"] = cls.zone.id cls.services["server_with_disk"]["diskoffering"] = cls.disk_offering.id cls.services["server_without_disk"]["zoneid"] = cls.zone.id cls.services["templates"]["ostypeid"] = cls.template.ostypeid cls.services["zoneid"] = cls.zone.id cls.services["diskoffering"] = cls.disk_offering.id cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"]) cls._cleanup = [cls.service_offering, cls.disk_offering] return
def setUpClass(cls): cls.testClient = super(TestCreateVMSnapshotTemplate, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() cls._cleanup = [] 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.unsupportedHypervisor = False cls.hypervisor = get_hypervisor_type(cls.api_client) cls.template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"]) cls.services["domainid"] = cls.domain.id cls.services["server"]["zoneid"] = cls.zone.id # 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._cleanup = [ cls.service_offering, cls.account, ] return
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 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
def test2_attach_ISO_in_CentOSVM(self): """ @desc:Incorrect guest os mapping in vmware for CentOS 5.9 and above Step1 :Register an CentOS 6.3 template Step2 :Launch a VM Step3: Try to attach VMware Tools ISO Step4: Verify VMware tools ISO attached correctly """ self.hypervisor = str(get_hypervisor_type(self.api_client)).lower() if self.hypervisor != "vmware": self.skipTest("This test can be run only on vmware") template = Template.register(self.userapiclient, self.services["CentOS6.3template"], zoneid=self.zone.id, account=self.account.name, domainid=self.account.domainid, hypervisor=self.hypervisor) self.debug("Registered a template with format {} and id {}".format( self.services["CentOS6.3template"]["format"], template.id)) template.download(self.userapiclient) self.cleanup.append(template) vm = VirtualMachine.create(self.userapiclient, self.services["virtual_machine"], accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, templateid=template.id, zoneid=self.zone.id) self.cleanup.append(vm) response = VirtualMachine.list(self.userapiclient, id=vm.id) status = validateList(response) self.assertEqual(status[0], PASS, "list vm response returned invalid list") list_default_iso_response = list_isos(self.api_client, name="vmware-tools.iso", account="system", isready="true") status = validateList(list_default_iso_response) self.assertEquals(PASS, status[0], "ISO list is empty") self.debug("Registered a ISO with name {}".format( list_default_iso_response[0].name)) try: vm.attach_iso(self.userapiclient, list_default_iso_response[0]) except CloudstackAPIException as e: self.fail("Attached ISO failed : %s" % e) response = VirtualMachine.list(self.userapiclient, id=vm.id) status = validateList(response) self.assertEqual(status[0], PASS, "list vm response returned invalid list") attachedIsoName = response[0].isoname self.assertEqual(attachedIsoName, "vmware-tools.iso", "vmware-tools.iso not attached") return
def setUpClass(cls): cls.testClient = super(TestSnapshotEvents, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() cls.services = Services().services cls._cleanup = [] # 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.unsupportedHypervisor = False cls.hypervisor = get_hypervisor_type(cls.api_client) 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.services["account"] = cls.account.name 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 ) cls._cleanup = [ cls.service_offering, cls.account, ] return
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
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 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
def setUpClass(cls): cls.testClient = super(TestAdapterTypeForNic, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() cls.testdata = cls.testClient.getParsedTestDataConfig() cls.hypervisor = get_hypervisor_type(cls.api_client) # 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.testdata["ostype"]) # Create Accounts & networks cls.testdata["isolated_network"]["zoneid"] = cls.zone.id cls._cleanup = [] cls.account = Account.create( cls.api_client, cls.testdata["account"], domainid=cls.domain.id) cls._cleanup.append(cls.account) cls.userapiclient = cls.testClient.getUserApiClient( UserName=cls.account.name, DomainName=cls.account.domain ) cls.service_offering = ServiceOffering.create( cls.api_client, cls.testdata["service_offering"]) cls._cleanup.append(cls.service_offering) # Create Shared Network Offering cls.isolated_network_offering = NetworkOffering.create( cls.api_client, cls.testdata["isolated_network_offering"]) cls._cleanup.append(cls.isolated_network_offering) # Enable Isolated Network offering cls.isolated_network_offering.update(cls.api_client, state='Enabled') return
def setUpClass(cls): cls.testClient = super(TestSnapshots, 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._cleanup = [] cls.unsupportedHypervisor = False cls.hypervisor = str(get_hypervisor_type(cls.api_client)).lower() cls.disk_offering = DiskOffering.create( cls.api_client, cls.services["disk_offering"] ) cls.template = get_template( cls.api_client, cls.zone.id, cls.services["ostype"] ) cls.services["domainid"] = cls.domain.id cls.services["volume"]["zoneid"] = cls.services[ "server_with_disk"]["zoneid"] = cls.zone.id cls.services["server_with_disk"]["diskoffering"] = cls.disk_offering.id cls.services["server_without_disk"]["zoneid"] = cls.zone.id cls.services["templates"]["ostypeid"] = cls.template.ostypeid cls.services["zoneid"] = cls.zone.id cls.services["diskoffering"] = cls.disk_offering.id cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] ) cls._cleanup = [ cls.service_offering, cls.disk_offering ] return
def setUpClass(cls): cls.testClient = super(TestAdapterTypeForNic, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() cls.testdata = cls.testClient.getParsedTestDataConfig() cls.hypervisor = get_hypervisor_type(cls.api_client) # 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.testdata["ostype"]) # Create Accounts & networks cls.testdata["isolated_network"]["zoneid"] = cls.zone.id cls._cleanup = [] cls.account = Account.create(cls.api_client, cls.testdata["account"], domainid=cls.domain.id) cls._cleanup.append(cls.account) cls.userapiclient = cls.testClient.getUserApiClient( UserName=cls.account.name, DomainName=cls.account.domain) cls.service_offering = ServiceOffering.create( cls.api_client, cls.testdata["service_offering"]) cls._cleanup.append(cls.service_offering) # Create Shared Network Offering cls.isolated_network_offering = NetworkOffering.create( cls.api_client, cls.testdata["isolated_network_offering"]) cls._cleanup.append(cls.isolated_network_offering) # Enable Isolated Network offering cls.isolated_network_offering.update(cls.api_client, state='Enabled') return
def setUpClass(cls): testClient = super(TestISO, cls).getClsTestClient() cls.apiclient = testClient.getApiClient() cls.services = testClient.getParsedTestDataConfig() cls._cleanup = [] cls.unsupportedHypervisor = False cls.hypervisor = get_hypervisor_type(cls.apiclient) # 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 ) cls._cleanup.append(cls.account) # 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)) return
def setUpClass(cls): testClient = super(TestISO, cls).getClsTestClient() cls.apiclient = testClient.getApiClient() cls.services = testClient.getParsedTestDataConfig() cls._cleanup = [] cls.unsupportedHypervisor = False cls.hypervisor = get_hypervisor_type(cls.apiclient) if cls.hypervisor.lower() in ["simulator"]: cls.unsupportedHypervisor = True return # 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 ) cls._cleanup.append(cls.account) # 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)) return
def test1_attach_volume_ide(self): """ @desc: Exception when attaching data disk to RHEL VM on vSphere Step1: Confirm that vmware.root.disk.controller = "ide" in Global Settings. Step2: Register RHEl 6.0 template and deploy a VM. Step3: Note that the root disk is attached to IDE. Step4: Create new DATA disk and attempt to attach it to the VM. Verify that step4 succeeds without any exception """ self.hypervisor = str(get_hypervisor_type(self.api_client)).lower() if self.hypervisor != "vmware": self.skipTest("This test can be run only on vmware") cmd = listConfigurations.listConfigurationsCmd() cmd.name = "vmware.root.disk.controller" cmd.listAll = True try: config_descs = self.api_client.listConfigurations(cmd) except Exception as e: raise Exception("Failed to fetch configurations: %s" % e) if not isinstance(config_descs, list): raise Exception("List configs didn't returned a valid data") config_desc = config_descs[0] if str(config_desc.value).lower() != "ide": self.skipTest( "This test is invalid if {} is not set to ide".format( config_desc.name)) """ Register RHEL 6.0 template and deploy vm """ template = Template.register(self.userapiclient, self.services["rhel60template"], zoneid=self.zone.id, account=self.account.name, domainid=self.account.domainid, hypervisor=self.hypervisor) self.assertIsNotNone(template, "Failed to register Rhel6 template") self.debug("Registered a template with format {} and id {}".format( self.services["rhel60template"]["format"], template.id)) template.download(self.userapiclient) self.cleanup.append(template) vm = VirtualMachine.create(self.userapiclient, self.services["virtual_machine"], accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, templateid=template.id, zoneid=self.zone.id) self.assertIsNotNone(vm, "Failed to deploy virtual machine") self.cleanup.append(vm) response = VirtualMachine.list(self.userapiclient, id=vm.id) status = validateList(response) self.assertEqual(status[0], PASS, "list vm response returned invalid list") """ list root disk of the vm created above and make sure that device type is ide """ volume_res = Volume.list(self.userapiclient, virtualmachineid=vm.id, type="root", listAll="true") self.assertEqual( validateList(volume_res)[0], PASS, "list vm response returned invalid list") chaininfo = volume_res[0].chaininfo device_Bus = literal_eval(chaininfo)["diskDeviceBusName"] if "ide" not in device_Bus: self.fail("Root disk is not created with device type IDE") disk = Volume.create(self.userapiclient, self.services["volume"], zoneid=self.zone.id, diskofferingid=self.disk_offering.id) self.assertIsNotNone(disk, "Failed to create custom volume") self.cleanup.append(disk) try: vm.attach_volume(self.userapiclient, disk) list_volumes = Volume.list(self.userapiclient, listall=self.services["listall"], id=disk.id) attached_volume = list_volumes[0] self.assertEqual( disk.id, attached_volume.id, "list volume response does not match with the volume created and attached to vm" ) except Exception as e: self.fail( "Failed to attach data disk to RHEL vm whose root disk type is IDE" ) return
def test2_attach_ISO_in_CentOSVM(self): """ @desc:Incorrect guest os mapping in vmware for CentOS 5.9 and above Step1 :Register an CentOS 6.3 template Step2 :Launch a VM Step3: Try to attach VMware Tools ISO Step4: Verify VMware tools ISO attached correctly """ self.hypervisor = str(get_hypervisor_type(self.api_client)).lower() if self.hypervisor != "vmware": self.skipTest("This test can be run only on vmware") template = Template.register( self.userapiclient, self.services["CentOS6.3template"], zoneid=self.zone.id, account=self.account.name, domainid=self.account.domainid, hypervisor=self.hypervisor ) self.debug( "Registered a template with format {} and id {}".format( self.services["CentOS6.3template"]["format"],template.id) ) template.download(self.userapiclient) self.cleanup.append(template) vm = VirtualMachine.create( self.userapiclient, self.services["virtual_machine"], accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, templateid=template.id, zoneid=self.zone.id ) self.cleanup.append(vm) response = VirtualMachine.list(self.userapiclient,id=vm.id) status = validateList(response) self.assertEqual(status[0],PASS,"list vm response returned invalid list") list_default_iso_response = list_isos( self.api_client, name="vmware-tools.iso", account="system", isready="true" ) status = validateList(list_default_iso_response) self.assertEquals( PASS, status[0], "ISO list is empty") self.debug( "Registered a ISO with name {}".format(list_default_iso_response[0].name)) try: vm.attach_iso(self.userapiclient,list_default_iso_response[0]) except CloudstackAPIException as e: self.fail("Attached ISO failed : %s" % e) response = VirtualMachine.list(self.userapiclient, id=vm.id) status = validateList(response) self.assertEqual(status[0], PASS,"list vm response returned invalid list") attachedIsoName=response[0].isoname; self.assertEqual(attachedIsoName, "vmware-tools.iso", "vmware-tools.iso not attached") return
def test1_attach_volume_ide(self): """ @desc: Exception when attaching data disk to RHEL VM on vSphere Step1: Confirm that vmware.root.disk.controller = "ide" in Global Settings. Step2: Register RHEl 6.0 template and deploy a VM. Step3: Note that the root disk is attached to IDE. Step4: Create new DATA disk and attempt to attach it to the VM. Verify that step4 succeeds without any exception """ self.hypervisor = str(get_hypervisor_type(self.api_client)).lower() if self.hypervisor != "vmware": self.skipTest("This test can be run only on vmware") cmd = listConfigurations.listConfigurationsCmd() cmd.name = "vmware.root.disk.controller" cmd.listAll = True try: config_descs = self.api_client.listConfigurations(cmd) except Exception as e: raise Exception("Failed to fetch configurations: %s" % e) if not isinstance(config_descs, list): raise Exception("List configs didn't returned a valid data") config_desc = config_descs[0] if str(config_desc.value).lower() != "ide": self.skipTest("This test is invalid if {} is not set to ide".format(config_desc.name)) """ Register RHEL 6.0 template and deploy vm """ template = Template.register( self.userapiclient, self.services["rhel60template"], zoneid=self.zone.id, account=self.account.name, domainid=self.account.domainid, hypervisor=self.hypervisor ) self.assertIsNotNone(template,"Failed to register Rhel6 template") self.debug( "Registered a template with format {} and id {}".format( self.services["rhel60template"]["format"],template.id) ) template.download(self.userapiclient) self.cleanup.append(template) vm = VirtualMachine.create( self.userapiclient, self.services["virtual_machine"], accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, templateid=template.id, zoneid=self.zone.id ) self.assertIsNotNone(vm,"Failed to deploy virtual machine") self.cleanup.append(vm) response = VirtualMachine.list(self.userapiclient,id=vm.id) status = validateList(response) self.assertEqual(status[0],PASS,"list vm response returned invalid list") """ list root disk of the vm created above and make sure that device type is ide """ volume_res = Volume.list( self.userapiclient, virtualmachineid=vm.id, type="root", listAll="true" ) self.assertEqual(validateList(volume_res)[0],PASS,"list vm response returned invalid list") chaininfo = volume_res[0].chaininfo device_Bus = literal_eval(chaininfo)["diskDeviceBusName"] if "ide" not in device_Bus: self.fail("Root disk is not created with device type IDE") disk = Volume.create( self.userapiclient, self.services["volume"], zoneid=self.zone.id, diskofferingid=self.disk_offering.id ) self.assertIsNotNone(disk,"Failed to create custom volume") self.cleanup.append(disk) try: vm.attach_volume(self.userapiclient,disk) list_volumes = Volume.list( self.userapiclient, listall=self.services["listall"], id=disk.id ) attached_volume = list_volumes[0] self.assertEqual( disk.id, attached_volume.id, "list volume response does not match with the volume created and attached to vm" ) except Exception as e: self.fail("Failed to attach data disk to RHEL vm whose root disk type is IDE") return