From 5f073d034da4b835214dd929796a1cfd18bb4090 Mon Sep 17 00:00:00 2001 From: Avdhoot Date: Mon, 6 Jan 2025 19:10:14 +0530 Subject: [PATCH] pvc_name is initialized in clone method Signed-off-by: Avdhoot --- ocs_ci/ocs/cnv/virtual_machine.py | 1 + .../workloads/cnv/test_vm_snapshot_cloning_ops.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ocs_ci/ocs/cnv/virtual_machine.py b/ocs_ci/ocs/cnv/virtual_machine.py index 044dd4a4aba..182eea37b38 100644 --- a/ocs_ci/ocs/cnv/virtual_machine.py +++ b/ocs_ci/ocs/cnv/virtual_machine.py @@ -740,6 +740,7 @@ def _clone_vm_pvc(self, vm_data): access_mode=self.pvc_access_mode, volume_mode=constants.VOLUME_MODE_BLOCK, ) + self.pvc_name = self.pvc_obj.name wait_for_resource_state(self.pvc_obj, state=constants.STATUS_BOUND, timeout=300) vm_data["spec"]["template"]["spec"]["volumes"][0]["persistentVolumeClaim"] = { "claimName": self.pvc_obj.name diff --git a/tests/functional/workloads/cnv/test_vm_snapshot_cloning_ops.py b/tests/functional/workloads/cnv/test_vm_snapshot_cloning_ops.py index 9306d52378d..60fa8f7abdd 100644 --- a/tests/functional/workloads/cnv/test_vm_snapshot_cloning_ops.py +++ b/tests/functional/workloads/cnv/test_vm_snapshot_cloning_ops.py @@ -124,13 +124,13 @@ def test_vm_snapshot_ops( @pytest.mark.polarion_id("OCS-6288") def test_vm_snap_of_clone( self, + setup_cnv, project_factory, + multi_cnv_workload, + clone_vm_workload, snapshot_factory, snapshot_restore_factory, - multi_cnv_workload, cnv_workload, - clone_vm_workload, - setup_cnv, ): """ This test performs the VM cloning and IOs created using different volume interfaces(PVC/DV/DVT) @@ -181,10 +181,10 @@ def test_vm_snap_of_clone( ), f"Failed: MD5 comparison between source {vm_obj.name} and cloned {clone_obj.name} VMs" run_dd_io(vm_obj=clone_obj, file_path=file_paths[1]) - clone_obj.stop() - - # Taking Snapshot of PVC cloned_pvc_obj = clone_obj.get_vm_pvc_obj() + # Stopping VM before taking snapshot of the VM PVC + clone_obj.stop() + # Taking Snapshot of cloned PVC snap_obj = snapshot_factory(cloned_pvc_obj) # Restore the snapshot