def test_02_take_VM_snapshot_with_data_disk(self): self.virtual_machine.start(self.apiClient) data_volume = Volume.create(self.apiClient, self.testdata[TestData.volume_1], account=self.account.name, domainid=self.domain.id, zoneid=self.zone.id, diskofferingid=self.disk_offering.id) self.cleanup = [data_volume] self.virtual_machine.attach_volume(self.apiClient, data_volume) root_volumes = list_volumes(self.apiClient, type="ROOT", listAll="true") sf_util.check_list( root_volumes, 1, self, TestVMSnapshots._should_only_be_one_root_volume_err_msg) root_volume = root_volumes[0] root_volume_id = {'volumeid': root_volume.id} sf_iscsi_name_result = self.cs_api.getVolumeiScsiName(root_volume_id) sf_iscsi_root_volume_name = sf_iscsi_name_result['apivolumeiscsiname'][ 'volumeiScsiName'] sf_util.check_iscsi_name(sf_iscsi_root_volume_name, self) root_volume_path_1 = self._get_path(root_volume_id) data_volumes = list_volumes(self.apiClient, type="DATADISK", listAll="true") sf_util.check_list(data_volumes, 1, self, "There should only be one data volume.") data_volume = data_volumes[0] data_volume_id = {'volumeid': data_volume.id} sf_iscsi_name_result = self.cs_api.getVolumeiScsiName(data_volume_id) sf_iscsi_data_volume_name = sf_iscsi_name_result['apivolumeiscsiname'][ 'volumeiScsiName'] sf_util.check_iscsi_name(sf_iscsi_data_volume_name, self) data_volume_path_1 = self._get_path(data_volume_id) ####################################### ####################################### # STEP 1: Take snapshot of running VM # ####################################### ####################################### vm_snapshot = VmSnapshot.create(self.apiClient, vmid=self.virtual_machine.id, snapshotmemory="false", name="Test Snapshot", description="Test Snapshot Desc") list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") self._verify_vm_snapshot(list_vm_snapshots, vm_snapshot) root_volume_path_2 = self._get_path(root_volume_id) self.assertEqual(root_volume_path_1, root_volume_path_2, TestVMSnapshots._path_should_not_have_changed_err_msg) data_volume_path_2 = self._get_path(data_volume_id) self.assertEqual(data_volume_path_1, data_volume_path_2, TestVMSnapshots._path_should_not_have_changed_err_msg) root_volume_xen_sr = self.xen_session.xenapi.SR.get_by_name_label( sf_iscsi_root_volume_name)[0] root_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs( root_volume_xen_sr) sf_util.check_list(root_volume_xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) root_volume_vdis_after_create = self._get_vdis(root_volume_xen_vdis) vdiSnapshotOf = self.xen_session.xenapi.VDI.get_record( root_volume_vdis_after_create.snapshot_vdi["snapshot_of"]) self.assertEqual(vdiSnapshotOf["uuid"], root_volume_vdis_after_create.active_vdi["uuid"], TestVMSnapshots._snapshot_parent_not_correct_err_msg) data_volume_xen_sr = self.xen_session.xenapi.SR.get_by_name_label( sf_iscsi_data_volume_name)[0] data_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs( data_volume_xen_sr) sf_util.check_list(data_volume_xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) data_volume_vdis_after_create = self._get_vdis(data_volume_xen_vdis) vdiSnapshotOf = self.xen_session.xenapi.VDI.get_record( data_volume_vdis_after_create.snapshot_vdi["snapshot_of"]) self.assertEqual(vdiSnapshotOf["uuid"], data_volume_vdis_after_create.active_vdi["uuid"], TestVMSnapshots._snapshot_parent_not_correct_err_msg) ####################################### ####################################### ### STEP 2: Revert VM to Snapshot ### ####################################### ####################################### self.virtual_machine.stop(self.apiClient) VmSnapshot.revertToSnapshot(self.apiClient, vmsnapshotid=vm_snapshot.id) list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") sf_util.check_list( list_vm_snapshots, 1, self, TestVMSnapshots._should_only_be_one_vm_snapshot_err_msg) root_volume_path_3 = self._get_path(root_volume_id) self.assertNotEqual(root_volume_path_1, root_volume_path_3, TestVMSnapshots._path_should_have_changed_err_msg) root_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs( root_volume_xen_sr) sf_util.check_list(root_volume_xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) root_volume_vdis_after_revert = self._get_vdis(root_volume_xen_vdis) self.assertNotEqual( root_volume_vdis_after_create.active_vdi["uuid"], root_volume_vdis_after_revert.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_not_be_the_same_err_msg) self.assertEqual( root_volume_vdis_after_create.snapshot_vdi["uuid"], root_volume_vdis_after_revert.snapshot_vdi["uuid"], TestVMSnapshots._snapshot_vdis_should_be_the_same_err_msg) self.assertEqual(root_volume_vdis_after_create.base_vdi["uuid"], root_volume_vdis_after_revert.base_vdi["uuid"], TestVMSnapshots._base_vdis_should_be_the_same_err_msg) data_volume_path_3 = self._get_path(data_volume_id) self.assertNotEqual(data_volume_path_1, data_volume_path_3, TestVMSnapshots._path_should_have_changed_err_msg) data_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs( data_volume_xen_sr) sf_util.check_list(data_volume_xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) data_volume_vdis_after_revert = self._get_vdis(data_volume_xen_vdis) self.assertNotEqual( data_volume_vdis_after_create.active_vdi["uuid"], data_volume_vdis_after_revert.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_not_be_the_same_err_msg) self.assertEqual( data_volume_vdis_after_create.snapshot_vdi["uuid"], data_volume_vdis_after_revert.snapshot_vdi["uuid"], TestVMSnapshots._snapshot_vdis_should_be_the_same_err_msg) self.assertEqual(data_volume_vdis_after_create.base_vdi["uuid"], data_volume_vdis_after_revert.base_vdi["uuid"], TestVMSnapshots._base_vdis_should_be_the_same_err_msg) ####################################### ####################################### ##### STEP 3: Delete VM snapshot ##### ####################################### ####################################### VmSnapshot.deleteVMSnapshot(self.apiClient, vmsnapshotid=vm_snapshot.id) list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") self.assertEqual(list_vm_snapshots, None, TestVMSnapshots._should_be_no_vm_snapshots_err_msg) root_volume_path_4 = self._get_path(root_volume_id) self.assertEqual(root_volume_path_3, root_volume_path_4, TestVMSnapshots._path_should_not_have_changed_err_msg) root_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs( root_volume_xen_sr) sf_util.check_list(root_volume_xen_vdis, 1, self, TestVMSnapshots._should_only_be_one_vdi_err_msg) root_volume_vdis_after_delete = self._get_vdis(root_volume_xen_vdis, True) self.assertEqual( root_volume_vdis_after_revert.active_vdi["uuid"], root_volume_vdis_after_delete.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_be_the_same_err_msg) data_volume_path_4 = self._get_path(data_volume_id) self.assertEqual(data_volume_path_3, data_volume_path_4, TestVMSnapshots._path_should_not_have_changed_err_msg) data_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs( data_volume_xen_sr) sf_util.check_list(data_volume_xen_vdis, 1, self, TestVMSnapshots._should_only_be_one_vdi_err_msg) data_volume_vdis_after_delete = self._get_vdis(data_volume_xen_vdis, True) self.assertEqual( data_volume_vdis_after_revert.active_vdi["uuid"], data_volume_vdis_after_delete.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_be_the_same_err_msg) ####################################### ####################################### ##### STEP 4: Start VM ##### ####################################### ####################################### self.virtual_machine.detach_volume(self.apiClient, data_volume) self.virtual_machine.start(self.apiClient)
def test_02_take_VM_snapshot_with_data_disk(self): self.virtual_machine.start(self.apiClient) data_volume = Volume.create( self.apiClient, self.testdata[TestData.volume_1], account=self.account.name, domainid=self.domain.id, zoneid=self.zone.id, diskofferingid=self.disk_offering.id ) self.cleanup = [data_volume] self.virtual_machine.attach_volume(self.apiClient, data_volume) root_volumes = list_volumes(self.apiClient, type="ROOT", listAll="true") sf_util.check_list(root_volumes, 1, self, TestVMSnapshots._should_only_be_one_root_volume_err_msg) root_volume = root_volumes[0] root_volume_id = {'volumeid': root_volume.id} sf_iscsi_name_result = self.cs_api.getVolumeiScsiName(root_volume_id) sf_iscsi_root_volume_name = sf_iscsi_name_result['apivolumeiscsiname']['volumeiScsiName'] sf_util.check_iscsi_name(sf_iscsi_root_volume_name, self) root_volume_path_1 = self._get_path(root_volume_id) data_volumes = list_volumes(self.apiClient, type="DATADISK", listAll="true") sf_util.check_list(data_volumes, 1, self, "There should only be one data volume.") data_volume = data_volumes[0] data_volume_id = {'volumeid': data_volume.id} sf_iscsi_name_result = self.cs_api.getVolumeiScsiName(data_volume_id) sf_iscsi_data_volume_name = sf_iscsi_name_result['apivolumeiscsiname']['volumeiScsiName'] sf_util.check_iscsi_name(sf_iscsi_data_volume_name, self) data_volume_path_1 = self._get_path(data_volume_id) ####################################### ####################################### # STEP 1: Take snapshot of running VM # ####################################### ####################################### vm_snapshot = VmSnapshot.create( self.apiClient, vmid=self.virtual_machine.id, snapshotmemory="false", name="Test Snapshot", description="Test Snapshot Desc" ) list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") self._verify_vm_snapshot(list_vm_snapshots, vm_snapshot) root_volume_path_2 = self._get_path(root_volume_id) self.assertEqual( root_volume_path_1, root_volume_path_2, TestVMSnapshots._path_should_not_have_changed_err_msg ) data_volume_path_2 = self._get_path(data_volume_id) self.assertEqual( data_volume_path_1, data_volume_path_2, TestVMSnapshots._path_should_not_have_changed_err_msg ) root_volume_xen_sr = self.xen_session.xenapi.SR.get_by_name_label(sf_iscsi_root_volume_name)[0] root_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs(root_volume_xen_sr) sf_util.check_list(root_volume_xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) root_volume_vdis_after_create = self._get_vdis(root_volume_xen_vdis) vdiSnapshotOf = self.xen_session.xenapi.VDI.get_record(root_volume_vdis_after_create.snapshot_vdi["snapshot_of"]) self.assertEqual( vdiSnapshotOf["uuid"], root_volume_vdis_after_create.active_vdi["uuid"], TestVMSnapshots._snapshot_parent_not_correct_err_msg ) data_volume_xen_sr = self.xen_session.xenapi.SR.get_by_name_label(sf_iscsi_data_volume_name)[0] data_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs(data_volume_xen_sr) sf_util.check_list(data_volume_xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) data_volume_vdis_after_create = self._get_vdis(data_volume_xen_vdis) vdiSnapshotOf = self.xen_session.xenapi.VDI.get_record(data_volume_vdis_after_create.snapshot_vdi["snapshot_of"]) self.assertEqual( vdiSnapshotOf["uuid"], data_volume_vdis_after_create.active_vdi["uuid"], TestVMSnapshots._snapshot_parent_not_correct_err_msg ) ####################################### ####################################### ### STEP 2: Revert VM to Snapshot ### ####################################### ####################################### self.virtual_machine.stop(self.apiClient) VmSnapshot.revertToSnapshot(self.apiClient, vmsnapshotid=vm_snapshot.id) list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") sf_util.check_list(list_vm_snapshots, 1, self, TestVMSnapshots._should_only_be_one_vm_snapshot_err_msg) root_volume_path_3 = self._get_path(root_volume_id) self.assertNotEqual( root_volume_path_1, root_volume_path_3, TestVMSnapshots._path_should_have_changed_err_msg ) root_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs(root_volume_xen_sr) sf_util.check_list(root_volume_xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) root_volume_vdis_after_revert = self._get_vdis(root_volume_xen_vdis) self.assertNotEqual( root_volume_vdis_after_create.active_vdi["uuid"], root_volume_vdis_after_revert.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_not_be_the_same_err_msg ) self.assertEqual( root_volume_vdis_after_create.snapshot_vdi["uuid"], root_volume_vdis_after_revert.snapshot_vdi["uuid"], TestVMSnapshots._snapshot_vdis_should_be_the_same_err_msg ) self.assertEqual( root_volume_vdis_after_create.base_vdi["uuid"], root_volume_vdis_after_revert.base_vdi["uuid"], TestVMSnapshots._base_vdis_should_be_the_same_err_msg ) data_volume_path_3 = self._get_path(data_volume_id) self.assertNotEqual( data_volume_path_1, data_volume_path_3, TestVMSnapshots._path_should_have_changed_err_msg ) data_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs(data_volume_xen_sr) sf_util.check_list(data_volume_xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) data_volume_vdis_after_revert = self._get_vdis(data_volume_xen_vdis) self.assertNotEqual( data_volume_vdis_after_create.active_vdi["uuid"], data_volume_vdis_after_revert.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_not_be_the_same_err_msg ) self.assertEqual( data_volume_vdis_after_create.snapshot_vdi["uuid"], data_volume_vdis_after_revert.snapshot_vdi["uuid"], TestVMSnapshots._snapshot_vdis_should_be_the_same_err_msg ) self.assertEqual( data_volume_vdis_after_create.base_vdi["uuid"], data_volume_vdis_after_revert.base_vdi["uuid"], TestVMSnapshots._base_vdis_should_be_the_same_err_msg ) ####################################### ####################################### ##### STEP 3: Delete VM snapshot ##### ####################################### ####################################### VmSnapshot.deleteVMSnapshot(self.apiClient, vmsnapshotid=vm_snapshot.id) list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") self.assertEqual( list_vm_snapshots, None, TestVMSnapshots._should_be_no_vm_snapshots_err_msg ) root_volume_path_4 = self._get_path(root_volume_id) self.assertEqual( root_volume_path_3, root_volume_path_4, TestVMSnapshots._path_should_not_have_changed_err_msg ) root_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs(root_volume_xen_sr) sf_util.check_list(root_volume_xen_vdis, 1, self, TestVMSnapshots._should_only_be_one_vdi_err_msg) root_volume_vdis_after_delete = self._get_vdis(root_volume_xen_vdis, True) self.assertEqual( root_volume_vdis_after_revert.active_vdi["uuid"], root_volume_vdis_after_delete.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_be_the_same_err_msg ) data_volume_path_4 = self._get_path(data_volume_id) self.assertEqual( data_volume_path_3, data_volume_path_4, TestVMSnapshots._path_should_not_have_changed_err_msg ) data_volume_xen_vdis = self.xen_session.xenapi.SR.get_VDIs(data_volume_xen_sr) sf_util.check_list(data_volume_xen_vdis, 1, self, TestVMSnapshots._should_only_be_one_vdi_err_msg) data_volume_vdis_after_delete = self._get_vdis(data_volume_xen_vdis, True) self.assertEqual( data_volume_vdis_after_revert.active_vdi["uuid"], data_volume_vdis_after_delete.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_be_the_same_err_msg ) ####################################### ####################################### ##### STEP 4: Start VM ##### ####################################### ####################################### self.virtual_machine.detach_volume(self.apiClient, data_volume) self.virtual_machine.start(self.apiClient)
def test_01_take_VM_snapshot(self): self.virtual_machine.start(self.apiClient) root_volumes = list_volumes(self.apiClient, type="ROOT", listAll="true") sf_util.check_list( root_volumes, 1, self, TestVMSnapshots._should_only_be_one_root_volume_err_msg) root_volume = root_volumes[0] volume_id = {'volumeid': root_volume.id} sf_iscsi_name_result = self.cs_api.getVolumeiScsiName(volume_id) sf_iscsi_name = sf_iscsi_name_result['apivolumeiscsiname'][ 'volumeiScsiName'] sf_util.check_iscsi_name(sf_iscsi_name, self) root_volume_path_1 = self._get_path(volume_id) ####################################### ####################################### # STEP 1: Take snapshot of running VM # ####################################### ####################################### vm_snapshot = VmSnapshot.create(self.apiClient, vmid=self.virtual_machine.id, snapshotmemory="false", name="Test Snapshot", description="Test Snapshot Desc") list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") self._verify_vm_snapshot(list_vm_snapshots, vm_snapshot) root_volume_path_2 = self._get_path(volume_id) self.assertEqual(root_volume_path_1, root_volume_path_2, TestVMSnapshots._path_should_not_have_changed_err_msg) xen_sr = self.xen_session.xenapi.SR.get_by_name_label(sf_iscsi_name)[0] xen_vdis = self.xen_session.xenapi.SR.get_VDIs(xen_sr) sf_util.check_list(xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) vdis_after_create = self._get_vdis(xen_vdis) vdiSnapshotOf = self.xen_session.xenapi.VDI.get_record( vdis_after_create.snapshot_vdi["snapshot_of"]) self.assertEqual(vdiSnapshotOf["uuid"], vdis_after_create.active_vdi["uuid"], TestVMSnapshots._snapshot_parent_not_correct_err_msg) ####################################### ####################################### ### STEP 2: Revert VM to Snapshot ### ####################################### ####################################### self.virtual_machine.stop(self.apiClient) VmSnapshot.revertToSnapshot(self.apiClient, vmsnapshotid=vm_snapshot.id) list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") sf_util.check_list( list_vm_snapshots, 1, self, TestVMSnapshots._should_only_be_one_vm_snapshot_err_msg) root_volume_path_3 = self._get_path(volume_id) self.assertNotEqual(root_volume_path_1, root_volume_path_3, TestVMSnapshots._path_should_have_changed_err_msg) xen_vdis = self.xen_session.xenapi.SR.get_VDIs(xen_sr) sf_util.check_list(xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) vdis_after_revert = self._get_vdis(xen_vdis) self.assertNotEqual( vdis_after_create.active_vdi["uuid"], vdis_after_revert.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_not_be_the_same_err_msg) self.assertEqual( vdis_after_create.snapshot_vdi["uuid"], vdis_after_revert.snapshot_vdi["uuid"], TestVMSnapshots._snapshot_vdis_should_be_the_same_err_msg) self.assertEqual(vdis_after_create.base_vdi["uuid"], vdis_after_revert.base_vdi["uuid"], TestVMSnapshots._base_vdis_should_be_the_same_err_msg) ####################################### ####################################### ##### STEP 3: Delete VM snapshot ##### ####################################### ####################################### VmSnapshot.deleteVMSnapshot(self.apiClient, vmsnapshotid=vm_snapshot.id) list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") self.assertEqual(list_vm_snapshots, None, TestVMSnapshots._should_be_no_vm_snapshots_err_msg) root_volume_path_4 = self._get_path(volume_id) self.assertEqual(root_volume_path_3, root_volume_path_4, TestVMSnapshots._path_should_not_have_changed_err_msg) xen_vdis = self.xen_session.xenapi.SR.get_VDIs(xen_sr) sf_util.check_list(xen_vdis, 1, self, TestVMSnapshots._should_only_be_one_vdi_err_msg) vdis_after_delete = self._get_vdis(xen_vdis, True) self.assertEqual( vdis_after_revert.active_vdi["uuid"], vdis_after_delete.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_be_the_same_err_msg) ####################################### ####################################### ##### STEP 4: Start VM ##### ####################################### ####################################### self.virtual_machine.start(self.apiClient)
def test_01_take_VM_snapshot(self): self.virtual_machine.start(self.apiClient) root_volumes = list_volumes(self.apiClient, type="ROOT", listAll="true") sf_util.check_list(root_volumes, 1, self, TestVMSnapshots._should_only_be_one_root_volume_err_msg) root_volume = root_volumes[0] volume_id = {'volumeid': root_volume.id} sf_iscsi_name_result = self.cs_api.getVolumeiScsiName(volume_id) sf_iscsi_name = sf_iscsi_name_result['apivolumeiscsiname']['volumeiScsiName'] sf_util.check_iscsi_name(sf_iscsi_name, self) root_volume_path_1 = self._get_path(volume_id) ####################################### ####################################### # STEP 1: Take snapshot of running VM # ####################################### ####################################### vm_snapshot = VmSnapshot.create( self.apiClient, vmid=self.virtual_machine.id, snapshotmemory="false", name="Test Snapshot", description="Test Snapshot Desc" ) list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") self._verify_vm_snapshot(list_vm_snapshots, vm_snapshot) root_volume_path_2 = self._get_path(volume_id) self.assertEqual( root_volume_path_1, root_volume_path_2, TestVMSnapshots._path_should_not_have_changed_err_msg ) xen_sr = self.xen_session.xenapi.SR.get_by_name_label(sf_iscsi_name)[0] xen_vdis = self.xen_session.xenapi.SR.get_VDIs(xen_sr) sf_util.check_list(xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) vdis_after_create = self._get_vdis(xen_vdis) vdiSnapshotOf = self.xen_session.xenapi.VDI.get_record(vdis_after_create.snapshot_vdi["snapshot_of"]) self.assertEqual( vdiSnapshotOf["uuid"], vdis_after_create.active_vdi["uuid"], TestVMSnapshots._snapshot_parent_not_correct_err_msg ) ####################################### ####################################### ### STEP 2: Revert VM to Snapshot ### ####################################### ####################################### self.virtual_machine.stop(self.apiClient) VmSnapshot.revertToSnapshot(self.apiClient, vmsnapshotid=vm_snapshot.id) list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") sf_util.check_list(list_vm_snapshots, 1, self, TestVMSnapshots._should_only_be_one_vm_snapshot_err_msg) root_volume_path_3 = self._get_path(volume_id) self.assertNotEqual( root_volume_path_1, root_volume_path_3, TestVMSnapshots._path_should_have_changed_err_msg ) xen_vdis = self.xen_session.xenapi.SR.get_VDIs(xen_sr) sf_util.check_list(xen_vdis, 3, self, TestVMSnapshots._should_be_three_vdis_err_msg) vdis_after_revert = self._get_vdis(xen_vdis) self.assertNotEqual( vdis_after_create.active_vdi["uuid"], vdis_after_revert.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_not_be_the_same_err_msg ) self.assertEqual( vdis_after_create.snapshot_vdi["uuid"], vdis_after_revert.snapshot_vdi["uuid"], TestVMSnapshots._snapshot_vdis_should_be_the_same_err_msg ) self.assertEqual( vdis_after_create.base_vdi["uuid"], vdis_after_revert.base_vdi["uuid"], TestVMSnapshots._base_vdis_should_be_the_same_err_msg ) ####################################### ####################################### ##### STEP 3: Delete VM snapshot ##### ####################################### ####################################### VmSnapshot.deleteVMSnapshot(self.apiClient, vmsnapshotid=vm_snapshot.id) list_vm_snapshots = VmSnapshot.list(self.apiClient, listAll="true") self.assertEqual( list_vm_snapshots, None, TestVMSnapshots._should_be_no_vm_snapshots_err_msg ) root_volume_path_4 = self._get_path(volume_id) self.assertEqual( root_volume_path_3, root_volume_path_4, TestVMSnapshots._path_should_not_have_changed_err_msg ) xen_vdis = self.xen_session.xenapi.SR.get_VDIs(xen_sr) sf_util.check_list(xen_vdis, 1, self, TestVMSnapshots._should_only_be_one_vdi_err_msg) vdis_after_delete = self._get_vdis(xen_vdis, True) self.assertEqual( vdis_after_revert.active_vdi["uuid"], vdis_after_delete.active_vdi["uuid"], TestVMSnapshots._active_vdis_should_be_the_same_err_msg ) ####################################### ####################################### ##### STEP 4: Start VM ##### ####################################### ####################################### self.virtual_machine.start(self.apiClient)