Example #1
0
    def migrate_vm_with_pools(self, target_pool, id):
        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()

        cmd.storageid = target_pool.id
        cmd.virtualmachineid = id

        return self.apiclient.migrateVirtualMachine(cmd)
    def test_01_migrate_vm_from_nfs_to_storpool(self):
        ''' Test migrate virtual machine (created before migration to global id) from NFS primary storage to StorPool'''

        self.virtual_machine.stop(self.apiclient, forced=True)
        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
        cmd.virtualmachineid = self.virtual_machine.id
        cmd.storageid = self.primary_storage.id
        migrated_vm = self.apiclient.migrateVirtualMachine(cmd)
        volumes = list_volumes(self.apiclient, virtualmachineid=migrated_vm.id)
        for v in volumes:
            name = v.path.split("/")[3]
            try:
                sp_volume = self.spapi.volumeList(volumeName="~" + name)
            except spapi.ApiError as err:
                raise Exception(err)

            self.assertEqual(
                v.storageid, self.primary_storage.id,
                "Did not migrate virtual machine from NFS to StorPool")
    def test_03_vm_uuid_to_another_storage(self):
        volumes = list_volumes(self.apiclient,
                               virtualmachineid=self.virtual_machine3.id)
        for v in volumes:
            try:
                #volumes will be updated to their globalId after the start of CS with commit with migration
                name = v.path.split("/")[3]
                sp_volume = self.spapi.volumeList(volumeName="~" + name)
                for t in self.virtual_machine3.tags:
                    self.debug("self.virtual_machine3.tags %" %
                               self.virtual_machine3.tags)
                    self.debug("StorPool volume response %" % sp_volume)
                    if t == sp_volume.templateName:
                        self.debug("***************")
            except spapi.ApiError as err:
                raise Exception(err)

            self.assertEqual(
                v.storageid, self.primary_storage.id,
                "Did not migrate virtual machine from NFS to StorPool vol storageId=%s primary storage id=%s"
                % (v.storageid, self.primary_storage.id))
        self.virtual_machine3.stop(self.apiclient, forced=True)
        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
        cmd.virtualmachineid = self.virtual_machine3.id
        cmd.storageid = self.primary_storage.id
        migrated_vm = self.apiclient.migrateVirtualMachine(cmd)
        volumes = list_volumes(self.apiclient, virtualmachineid=migrated_vm.id)
        for v in volumes:
            name = None
            if v.path.startswith("/dev/storpool-byid/"):
                name = v.path.split("/")[3]
                name = "~" + name
            else:
                name = v.id
            try:
                sp_volume = self.spapi.volumeList(volumeName=name)
            except spapi.ApiError as err:
                raise Exception(err)

            self.assertEqual(
                v.storageid, self.primary_storage.id,
                "Did not migrate virtual machine from NFS to StorPool")
Example #4
0
    def test_11_migrate_vm_to_another_storage(self):
        ''' Migrate VM to another Primary Storage
        '''
        list_volumes_of_vm = list_volumes(
            self.apiclient,
            virtualmachineid = self.vm_migrate.id,
            listall = True
            )

        self.assertTrue(len(list_volumes_of_vm) == 1, "There are more volumes attached to VM")

        if list_volumes_of_vm[0].storageid is self.primary_storage.id:
            cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
            cmd.virtualmachineid = self.vm_migrate.id
            if hostid:
                cmd.hostid = self.hostid
            vm =   apiclient.migrateVirtualMachine(cmd)
            volume = list_volumes(
                self.apiclient,
                virtualmachineid = vm.id,
                listall = True
                )[0]
            self.assertNotEqual(volume.storageid, self.primary_storage.id, "Could not migrate VM")
    def test_vmware_affinity(self):
        """ Test Set up affinity rules

            The test requires following pre-requisites
            - VMWare cluster configured in fully automated mode
        """

        # Validate the following
        # 1. Deploy 2 VMs on same hosts
        # 2. Migrate one VM from one host to another
        # 3. The second VM should also get migrated

        hosts = Host.list(self.apiclient,
                          zoneid=self.zone.id,
                          resourcestate='Enabled',
                          type='Routing')
        self.assertEqual(isinstance(hosts, list), True,
                         "List hosts should return valid host response")
        self.assertGreaterEqual(
            len(hosts), 2, "There must be two hosts present in a cluster")

        host_1 = hosts[0].id

        host_2 = hosts[1].id

        aff_grp = self.create_aff_grp(aff_grp=self.services["host_affinity"],
                                      acc=self.account.name,
                                      domainid=self.domain.id)

        vm_1 = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            domainid=self.domain.id,
            serviceofferingid=self.service_offering.id,
            affinitygroupnames=[aff_grp.name],
            hostid=host_1)

        vm_2 = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            domainid=self.domain.id,
            serviceofferingid=self.service_offering.id,
            affinitygroupnames=[aff_grp.name])

        vms = VirtualMachine.list(self.apiclient, id=vm_1.id, listall=True)

        vm_list_validation_result = validateList(vms)

        self.assertEqual(
            vm_list_validation_result[0], PASS,
            "vm list validation failed due to %s" %
            vm_list_validation_result[2])

        virtual_machine_1 = vm_list_validation_result[1]

        self.assertEqual(virtual_machine_1.state, "Running",
                         "Deployed VM should be in RUnning state")

        self.debug("Deploying VM on account: %s" % self.account.name)

        vms = VirtualMachine.list(self.apiclient, id=vm_2.id, listall=True)
        vm_list_validation_result = validateList(vms)

        self.assertEqual(
            vm_list_validation_result[0], PASS,
            "vm list validation failed due to %s" %
            vm_list_validation_result[2])

        virtual_machine_2 = vm_list_validation_result[1]

        self.assertEqual(virtual_machine_2.state, "Running",
                         "Deployed VM should be in RUnning state")

        self.debug("Migrate VM from host_1 to host_2")
        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
        cmd.virtualmachineid = virtual_machine_2.id
        cmd.hostid = host_2
        self.apiclient.migrateVirtualMachine(cmd)
        self.debug("Migrated VM from host_1 to host_2")

        vms = VirtualMachine.list(self.apiclient, hostid=host_2, listall=True)
        vm_list_validation_result = validateList(vms)

        self.assertEqual(
            vm_list_validation_result[0], PASS,
            "vm list validation failed due to %s" %
            vm_list_validation_result[2])

        vmids = [vm.id for vm in vms]

        self.assertIn(virtual_machine_1.id, vmids,
                      "VM 1 should be successfully migrated to host 2")
        self.assertIn(virtual_machine_2.id, vmids,
                      "VM 2 should be automatically migrated to host 2")
        return
Example #6
0
    def test_vmware_affinity(self):
        """ Test Set up affinity rules

            The test requires following pre-requisites
            - VMWare cluster configured in fully automated mode
        """

        # Validate the following
        # 1. Deploy 2 VMs on same hosts
        # 2. Migrate one VM from one host to another
        # 3. The second VM should also get migrated

        hosts = Host.list(
                          self.apiclient,
                          zoneid=self.zone.id,
                          resourcestate='Enabled',
                          type='Routing'
                          )
        self.assertEqual(
                         isinstance(hosts, list),
                         True,
                         "List hosts should return valid host response"
                         )
        self.assertGreaterEqual(
                         len(hosts),
                         2,
                         "There must be two hosts present in a cluster"
                        )

        host_1 = hosts[0].id

        host_2 = hosts[1].id

        aff_grp = self.create_aff_grp(aff_grp=self.services["host_affinity"], acc=self.account.name, domainid=self.domain.id)

        vm_1 = VirtualMachine.create(
                              self.apiclient,
                              self.services["virtual_machine"],
                              accountid=self.account.name,
                              domainid=self.domain.id,
                              serviceofferingid=self.service_offering.id,
                              affinitygroupnames=[aff_grp.name],
                              hostid = host_1
                             )

        vm_2 = VirtualMachine.create(
                              self.apiclient,
                              self.services["virtual_machine"],
                              accountid=self.account.name,
                              domainid=self.domain.id,
                              serviceofferingid=self.service_offering.id,
                              affinitygroupnames=[aff_grp.name]
                             )

        vms = VirtualMachine.list(
                                  self.apiclient,
                                  id= vm_1.id,
                                  listall=True
                                  )

        vm_list_validation_result = validateList(vms)

        self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
                         vm_list_validation_result[2])

        virtual_machine_1 = vm_list_validation_result[1]

        self.assertEqual(
                         virtual_machine_1.state,
                         "Running",
                         "Deployed VM should be in RUnning state"
                         )

        self.debug("Deploying VM on account: %s" % self.account.name)

        vms = VirtualMachine.list(
                                  self.apiclient,
                                  id=vm_2.id,
                                  listall=True
                                  )
        vm_list_validation_result = validateList(vms)

        self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
                         vm_list_validation_result[2])

        virtual_machine_2 = vm_list_validation_result[1]

        self.assertEqual(
                         virtual_machine_2.state,
                         "Running",
                         "Deployed VM should be in RUnning state"
                         )

        self.debug("Migrate VM from host_1 to host_2")
        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
        cmd.virtualmachineid = virtual_machine_2.id
        cmd.hostid = host_2
        self.apiclient.migrateVirtualMachine(cmd)
        self.debug("Migrated VM from host_1 to host_2")

        vms = VirtualMachine.list(
                                  self.apiclient,
                                  hostid=host_2,
                                  listall=True
                                  )
        vm_list_validation_result = validateList(vms)

        self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
                         vm_list_validation_result[2])

        vmids = [vm.id for vm in vms]

        self.assertIn(
                      virtual_machine_1.id,
                      vmids,
                      "VM 1 should be successfully migrated to host 2"
                      )
        self.assertIn(
                      virtual_machine_2.id,
                      vmids,
                      "VM 2 should be automatically migrated to host 2"
                      )
        return
    def test_04_cant_migrate_vm_to_host_with_ha_negative(self):
        """ Verify you can not migrate VMs to hosts with an ha.tag (negative) """

        # Steps,
        #1. Create a Compute service offering with the 'Offer HA' option selected.
        #2. Create a Guest VM with the compute service offering created above.
        #3. Select the VM and migrate VM to another host. Choose a 'Not Suitable' host.
        # Validations,
        #The option from the 'Migrate instance to another host' dialog box should list host3 as 'Not Suitable' for migration.
        #By design, The Guest VM can STILL can be migrated to host3 if the admin chooses to do so.

        #create and verify virtual machine with HA enabled service offering
        self.hypervisor = self.testClient.getHypervisorInfo()
        if self.hypervisor.lower() in ['lxc']:
            self.skipTest("vm migrate is not supported in %s" %
                          self.hypervisor)
        virtual_machine_with_ha = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_with_ha.id)

        vms = VirtualMachine.list(self.apiclient,
                                  id=virtual_machine_with_ha.id,
                                  listall=True)

        self.assertEqual(
            isinstance(vms, list), True,
            "The listVirtualMachines returned invalid object in response.")

        self.assertNotEqual(
            len(vms), 0, "The listVirtualMachines returned empty response.")

        vm = vms[0]

        self.debug("Deployed VM on host: %s" % vm.hostid)

        #Find out Non-Suitable host for VM migration
        list_hosts_response = list_hosts(self.apiclient, type="Routing")
        self.assertEqual(isinstance(list_hosts_response, list), True,
                         "listHosts returned invalid object in response.")

        self.assertNotEqual(len(list_hosts_response), 0,
                            "listHosts returned empty response.")

        notSuitableHost = None
        for host in list_hosts_response:
            if not host.suitableformigration and host.id != vm.hostid:
                notSuitableHost = host
                break

        self.assertTrue(notSuitableHost is not None,
                        "notsuitablehost should not be None")

        #Migrate VM to Non-Suitable host
        self.debug("Migrating VM-ID: %s to Host: %s" %
                   (vm.id, notSuitableHost.id))

        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
        cmd.hostid = notSuitableHost.id
        cmd.virtualmachineid = vm.id
        self.apiclient.migrateVirtualMachine(cmd)

        #Verify that the virtual machine got migrated to targeted Non-Suitable host
        list_vm_response = list_virtual_machines(self.apiclient, id=vm.id)
        self.assertEqual(
            isinstance(list_vm_response, list), True,
            "listVirtualMachine returned invalid object in response.")

        self.assertNotEqual(len(list_vm_response), 0,
                            "listVirtualMachines returned empty response.")

        self.assertEqual(
            list_vm_response[0].id, vm.id,
            "Virtual machine id with the virtual machine from listVirtualMachine is not matching."
        )

        self.assertEqual(
            list_vm_response[0].hostid, notSuitableHost.id,
            "The detination host id of migrated VM is not matching.")
    def test_03_cant_migrate_vm_to_host_with_ha_positive(self):
        """ Verify you can not migrate VMs to hosts with an ha.tag (positive) """

        # Steps,
        # 1. Create a Compute service offering with the 'Offer HA' option selected.
        # 2. Create a Guest VM with the compute service offering created above.
        # 3. Select the VM and migrate VM to another host. Choose a 'Suitable' host (i.e. host2)
        # Validations
        # The option from the 'Migrate instance to another host' dialog box' should list host3 as 'Not Suitable' for migration.
        # Confirm that the VM is migrated to the 'Suitable' host you selected
        # (i.e. host2)

        # create and verify the virtual machine with HA enabled service
        # offering
        self.hypervisor = self.testClient.getHypervisorInfo()
        if self.hypervisor.lower() in ['lxc']:
            self.skipTest("vm migrate is not supported in %s" %
                          self.hypervisor)

        virtual_machine_with_ha = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_with_ha.id)

        vms = VirtualMachine.list(
            self.apiclient,
            id=virtual_machine_with_ha.id,
            listall=True,
        )

        self.assertEqual(
            isinstance(vms, list), True,
            "List VMs should return valid response for deployed VM")

        self.assertNotEqual(
            len(vms), 0,
            "List VMs should return valid response for deployed VM")

        vm = vms[0]

        self.debug("Deployed VM on host: %s" % vm.hostid)

        # Find out a Suitable host for VM migration
        list_hosts_response = list_hosts(self.apiclient,
                                         virtualmachineid=vm.id)
        self.assertEqual(isinstance(list_hosts_response, list), True,
                         "The listHosts API returned the invalid list")

        self.assertNotEqual(len(list_hosts_response), 0,
                            "The listHosts returned nothing.")
        suitableHost = None
        for host in list_hosts_response:
            if host.suitableformigration and host.hostid != vm.hostid:
                suitableHost = host
                break

        self.assertTrue(suitableHost is not None,
                        "suitablehost should not be None")

        # Migration of the VM to a suitable host
        self.debug("Migrating VM-ID: %s to Host: %s" %
                   (vm.id, suitableHost.id))

        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
        cmd.hostid = suitableHost.id
        cmd.virtualmachineid = vm.id
        self.apiclient.migrateVirtualMachine(cmd)

        # Verify that the VM migrated to a targeted Suitable host
        list_vm_response = list_virtual_machines(self.apiclient, id=vm.id)
        self.assertEqual(isinstance(list_vm_response, list), True,
                         "The listVirtualMachines returned the invalid list.")

        self.assertNotEqual(list_vm_response, None,
                            "The listVirtualMachines API returned nothing.")

        vm_response = list_vm_response[0]

        self.assertEqual(
            vm_response.id, vm.id,
            "The virtual machine id and the the virtual machine from listVirtualMachines is not matching."
        )

        self.assertEqual(vm_response.hostid, suitableHost.id,
                         "The VM is not migrated to targeted suitable host.")
 def migrate_vm(self, vm, primary_storage):
     cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
     cmd.virtualmachineid = vm.id
     cmd.storageid = self.primary_storage.id
     return self.apiclient.migrateVirtualMachine(cmd)
    def test_04_cant_migrate_vm_to_host_with_ha_negative(self):
        """ Verify you can not migrate VMs to hosts with an ha.tag (negative) """

        # Steps,
        #1. Create a Compute service offering with the 'Offer HA' option selected.
        #2. Create a Guest VM with the compute service offering created above.
        #3. Select the VM and migrate VM to another host. Choose a 'Not Suitable' host.
        # Validations,
        #The option from the 'Migrate instance to another host' dialog box should list host3 as 'Not Suitable' for migration.
        #By design, The Guest VM can STILL can be migrated to host3 if the admin chooses to do so.

        #create and verify virtual machine with HA enabled service offering
        self.hypervisor = self.testClient.getHypervisorInfo()
        if self.hypervisor.lower() in ['lxc']:
            self.skipTest("vm migrate is not supported in %s" % self.hypervisor)
        virtual_machine_with_ha = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_with_ha.id
        )

        vms = VirtualMachine.list(
            self.apiclient,
            id=virtual_machine_with_ha.id,
            listall=True
        )

        self.assertEqual(
            isinstance(vms, list),
            True,
            "The listVirtualMachines returned invalid object in response."
        )

        self.assertNotEqual(
            len(vms),
            0,
            "The listVirtualMachines returned empty response."
        )

        vm = vms[0]

        self.debug("Deployed VM on host: %s" % vm.hostid)

        #Find out Non-Suitable host for VM migration
        list_hosts_response = list_hosts(
            self.apiclient,
            type="Routing"
        )
        self.assertEqual(
            isinstance(list_hosts_response, list),
            True,
            "listHosts returned invalid object in response."
        )

        self.assertNotEqual(
            len(list_hosts_response),
            0,
            "listHosts returned empty response."
        )

        notSuitableHost = None
        for host in list_hosts_response:
            if not host.suitableformigration and host.id != vm.hostid:
                notSuitableHost = host
                break

        self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None")

        #Migrate VM to Non-Suitable host
        self.debug("Migrating VM-ID: %s to Host: %s" % (vm.id, notSuitableHost.id))

        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
        cmd.hostid = notSuitableHost.id
        cmd.virtualmachineid = vm.id
        self.apiclient.migrateVirtualMachine(cmd)

        #Verify that the virtual machine got migrated to targeted Non-Suitable host
        list_vm_response = list_virtual_machines(
            self.apiclient,
            id=vm.id
        )
        self.assertEqual(
            isinstance(list_vm_response, list),
            True,
            "listVirtualMachine returned invalid object in response."
        )

        self.assertNotEqual(
            len(list_vm_response),
            0,
            "listVirtualMachines returned empty response."
        )

        self.assertEqual(
            list_vm_response[0].id,
            vm.id,
            "Virtual machine id with the virtual machine from listVirtualMachine is not matching."
        )

        self.assertEqual(
            list_vm_response[0].hostid,
            notSuitableHost.id,
            "The detination host id of migrated VM is not matching."
        )
    def test_03_cant_migrate_vm_to_host_with_ha_positive(self):
        """ Verify you can not migrate VMs to hosts with an ha.tag (positive) """

        # Steps,
        # 1. Create a Compute service offering with the 'Offer HA' option selected.
        # 2. Create a Guest VM with the compute service offering created above.
        # 3. Select the VM and migrate VM to another host. Choose a 'Suitable' host (i.e. host2)
        # Validations
        # The option from the 'Migrate instance to another host' dialog box' should list host3 as 'Not Suitable' for migration.
        # Confirm that the VM is migrated to the 'Suitable' host you selected
        # (i.e. host2)

        # create and verify the virtual machine with HA enabled service
        # offering
        self.hypervisor = self.testClient.getHypervisorInfo()
        if self.hypervisor.lower() in ['lxc']:
            self.skipTest("vm migrate is not supported in %s" % self.hypervisor)

        virtual_machine_with_ha = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_with_ha.id
        )

        vms = VirtualMachine.list(
            self.apiclient,
            id=virtual_machine_with_ha.id,
            listall=True,
        )

        self.assertEqual(
            isinstance(vms, list),
            True,
            "List VMs should return valid response for deployed VM"
        )

        self.assertNotEqual(
            len(vms),
            0,
            "List VMs should return valid response for deployed VM"
        )

        vm = vms[0]

        self.debug("Deployed VM on host: %s" % vm.hostid)

        # Find out a Suitable host for VM migration
        list_hosts_response = list_hosts(
            self.apiclient,
            virtualmachineid = vm.id
        )
        self.assertEqual(
            isinstance(list_hosts_response, list),
            True,
            "The listHosts API returned the invalid list"
        )

        self.assertNotEqual(
            len(list_hosts_response),
            0,
            "The listHosts returned nothing."
        )
        suitableHost = None
        for host in list_hosts_response:
            if host.suitableformigration and host.hostid != vm.hostid:
                suitableHost = host
                break

        self.assertTrue(
            suitableHost is not None,
            "suitablehost should not be None")

        # Migration of the VM to a suitable host
        self.debug(
            "Migrating VM-ID: %s to Host: %s" %
            (vm.id, suitableHost.id))

        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
        cmd.hostid = suitableHost.id
        cmd.virtualmachineid = vm.id
        self.apiclient.migrateVirtualMachine(cmd)

        # Verify that the VM migrated to a targeted Suitable host
        list_vm_response = list_virtual_machines(
            self.apiclient,
            id=vm.id
        )
        self.assertEqual(
            isinstance(list_vm_response, list),
            True,
            "The listVirtualMachines returned the invalid list."
        )

        self.assertNotEqual(
            list_vm_response,
            None,
            "The listVirtualMachines API returned nothing."
        )

        vm_response = list_vm_response[0]

        self.assertEqual(
            vm_response.id,
            vm.id,
            "The virtual machine id and the the virtual machine from listVirtualMachines is not matching."
        )

        self.assertEqual(
            vm_response.hostid,
            suitableHost.id,
            "The VM is not migrated to targeted suitable host."
        )
Example #12
0
    def test_5_migrate_vm_from_ceph_to_storpool(self):
        ''' Test migrate virtual machine from Ceph primary storage to StorPool'''
        try:
            # Login to VM and write data to file system
            ssh_client = self.vm5.get_ssh_client(reconnect=True)

            cmds = [
                "echo %s > %s/%s" %
                (self.random_data_0, self.test_dir, self.random_data), "sync",
                "sleep 1", "sync", "sleep 1",
                "cat %s/%s" % (self.test_dir, self.random_data)
            ]

            for c in cmds:
                self.debug(c)
                result = ssh_client.execute(c)
                self.debug(result)

        except Exception:
            self.fail("SSH failed for Virtual machine: %s" %
                      self.vm5.ipaddress)

        self.assertEqual(self.random_data_0, result[0],
                         "Check the random data has be write into temp file!")

        self.vm5.stop(self.apiclient, forced=True)
        time.sleep(30)
        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
        cmd.virtualmachineid = self.vm5.id
        cmd.storageid = self.storage_pool.id
        migrated_vm = self.apiclient.migrateVirtualMachine(cmd)
        volumes = list_volumes(self.apiclient,
                               virtualmachineid=migrated_vm.id,
                               listall=True)
        for v in volumes:
            name = v.path.split("/")[3]
            try:
                sp_volume = self.spapi.volumeList(volumeName="~" + name)
            except spapi.ApiError as err:
                raise Exception(err)

            self.assertEqual(
                v.storageid, self.storage_pool.id,
                "Did not migrate virtual machine from Ceph to StorPool")

        self.vm5.start(self.apiclient)
        try:
            ssh_client = self.vm5.get_ssh_client(reconnect=True)

            cmds = ["cat %s/%s" % (self.test_dir, self.random_data)]

            for c in cmds:
                self.debug(c)
                result = ssh_client.execute(c)
                self.debug(result)

        except Exception:
            self.fail("SSH failed for Virtual machine: %s" %
                      self.vm5.ipaddress)

        self.assertEqual(
            self.random_data_0, result[0],
            "Check the random data is equal with the ramdom file!")