From b074cc8a7db8cd061ccf25727ee1db541324d2e1 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Mon, 8 Apr 2024 13:41:26 +0200 Subject: [PATCH 1/2] Use `vm.get_sr` instead of relying on fixture in vm migration and nfs tests Signed-off-by: Benjamin Reis --- .../cephfs/test_cephfs_sr_crosspool_migration.py | 8 ++++---- .../cephfs/test_cephfs_sr_intrapool_migration.py | 13 +++++++------ .../storage/ext/test_ext_sr_crosspool_migration.py | 8 ++++---- .../storage/ext/test_ext_sr_intrapool_migration.py | 8 ++++---- .../test_glusterfs_sr_crosspool_migration.py | 8 ++++---- .../test_glusterfs_sr_intrapool_migration.py | 13 +++++++------ .../linstor/test_linstor_sr_crosspool_migration.py | 8 ++++---- .../linstor/test_linstor_sr_intrapool_migration.py | 13 +++++++------ .../storage/lvm/test_lvm_sr_crosspool_migration.py | 8 ++++---- .../storage/lvm/test_lvm_sr_intrapool_migration.py | 8 ++++---- .../test_lvmoiscsi_sr_crosspool_migration.py | 8 ++++---- .../test_lvmoiscsi_sr_intrapool_migration.py | 13 +++++++------ .../moosefs/test_moosefs_sr_crosspool_migration.py | 8 ++++---- .../moosefs/test_moosefs_sr_intrapool_migration.py | 13 +++++++------ tests/storage/nfs/test_nfs_sr.py | 5 ++--- .../storage/nfs/test_nfs_sr_crosspool_migration.py | 8 ++++---- .../storage/nfs/test_nfs_sr_intrapool_migration.py | 13 +++++++------ tests/storage/storage.py | 6 ++++-- .../storage/xfs/test_xfs_sr_crosspool_migration.py | 8 ++++---- .../storage/xfs/test_xfs_sr_intrapool_migration.py | 8 ++++---- .../storage/zfs/test_zfs_sr_crosspool_migration.py | 8 ++++---- .../storage/zfs/test_zfs_sr_intrapool_migration.py | 8 ++++---- .../zfsvol/test_zfsvol_sr_crosspool_migration.py | 12 ++++-------- .../zfsvol/test_zfsvol_sr_intrapool_migration.py | 12 ++++-------- 24 files changed, 112 insertions(+), 113 deletions(-) diff --git a/tests/storage/cephfs/test_cephfs_sr_crosspool_migration.py b/tests/storage/cephfs/test_cephfs_sr_crosspool_migration.py index 2f30d869e..0e6873fa8 100644 --- a/tests/storage/cephfs/test_cephfs_sr_crosspool_migration.py +++ b/tests/storage/cephfs/test_cephfs_sr_crosspool_migration.py @@ -14,8 +14,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1") class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_cephfs_sr, cephfs_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_cephfs_sr, host, cephfs_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_cephfs_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_cephfs_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_cephfs_sr, cephfs_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_cephfs_sr, host, cephfs_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_cephfs_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_cephfs_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/cephfs/test_cephfs_sr_intrapool_migration.py b/tests/storage/cephfs/test_cephfs_sr_intrapool_migration.py index 523594a9f..19355e870 100644 --- a/tests/storage/cephfs/test_cephfs_sr_intrapool_migration.py +++ b/tests/storage/cephfs/test_cephfs_sr_intrapool_migration.py @@ -14,11 +14,12 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2") class Test: - def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_cephfs_sr, cephfs_sr): - live_storage_migration_then_come_back(vm_on_cephfs_sr, host, cephfs_sr, hostA2, cephfs_sr) + def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_cephfs_sr): + sr = vm_on_cephfs_sr.get_sr() + live_storage_migration_then_come_back(vm_on_cephfs_sr, host, hostA2, sr) - def test_cold_intrapool_migration(self, host, hostA2, vm_on_cephfs_sr, cephfs_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_cephfs_sr, host, cephfs_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_cephfs_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_cephfs_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_cephfs_sr, cephfs_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_cephfs_sr, host, cephfs_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_cephfs_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_cephfs_sr, host, hostA2, local_sr_on_hostA2) diff --git a/tests/storage/ext/test_ext_sr_crosspool_migration.py b/tests/storage/ext/test_ext_sr_crosspool_migration.py index 6dac1b33b..97b80ef01 100644 --- a/tests/storage/ext/test_ext_sr_crosspool_migration.py +++ b/tests/storage/ext/test_ext_sr_crosspool_migration.py @@ -12,8 +12,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1") class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_ext_sr, ext_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_ext_sr, host, ext_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_ext_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_ext_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_ext_sr, ext_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_ext_sr, host, ext_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_ext_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_ext_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/ext/test_ext_sr_intrapool_migration.py b/tests/storage/ext/test_ext_sr_intrapool_migration.py index 1d56c8a3f..fa0c45174 100644 --- a/tests/storage/ext/test_ext_sr_intrapool_migration.py +++ b/tests/storage/ext/test_ext_sr_intrapool_migration.py @@ -12,8 +12,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2") class Test: - def test_cold_intrapool_migration(self, host, hostA2, vm_on_ext_sr, ext_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_ext_sr, host, ext_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_ext_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_ext_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_ext_sr, ext_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_ext_sr, host, ext_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_ext_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_ext_sr, host, hostA2, local_sr_on_hostA2) diff --git a/tests/storage/glusterfs/test_glusterfs_sr_crosspool_migration.py b/tests/storage/glusterfs/test_glusterfs_sr_crosspool_migration.py index e5af17897..94eddaabe 100644 --- a/tests/storage/glusterfs/test_glusterfs_sr_crosspool_migration.py +++ b/tests/storage/glusterfs/test_glusterfs_sr_crosspool_migration.py @@ -14,8 +14,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1", "sr_disk_for_all_hosts") class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_glusterfs_sr, glusterfs_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_glusterfs_sr, host, glusterfs_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_glusterfs_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_glusterfs_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_glusterfs_sr, glusterfs_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_glusterfs_sr, host, glusterfs_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_glusterfs_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_glusterfs_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/glusterfs/test_glusterfs_sr_intrapool_migration.py b/tests/storage/glusterfs/test_glusterfs_sr_intrapool_migration.py index 1a3531821..01f27935c 100644 --- a/tests/storage/glusterfs/test_glusterfs_sr_intrapool_migration.py +++ b/tests/storage/glusterfs/test_glusterfs_sr_intrapool_migration.py @@ -14,11 +14,12 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2", "sr_disk_for_all_hosts") class Test: - def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_glusterfs_sr, glusterfs_sr): - live_storage_migration_then_come_back(vm_on_glusterfs_sr, host, glusterfs_sr, hostA2, glusterfs_sr) + def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_glusterfs_sr): + sr = vm_on_glusterfs_sr.get_sr() + live_storage_migration_then_come_back(vm_on_glusterfs_sr, host, hostA2, sr) - def test_cold_intrapool_migration(self, host, hostA2, vm_on_glusterfs_sr, glusterfs_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_glusterfs_sr, host, glusterfs_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_glusterfs_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_glusterfs_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_glusterfs_sr, glusterfs_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_glusterfs_sr, host, glusterfs_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_glusterfs_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_glusterfs_sr, host, hostA2, local_sr_on_hostA2) diff --git a/tests/storage/linstor/test_linstor_sr_crosspool_migration.py b/tests/storage/linstor/test_linstor_sr_crosspool_migration.py index 74b1c0b5d..8336909d6 100644 --- a/tests/storage/linstor/test_linstor_sr_crosspool_migration.py +++ b/tests/storage/linstor/test_linstor_sr_crosspool_migration.py @@ -14,8 +14,8 @@ @pytest.mark.big_vm # and ideally on a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1") class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_linstor_sr, linstor_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_linstor_sr, host, linstor_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_linstor_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_linstor_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_linstor_sr, linstor_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_linstor_sr, host, linstor_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_linstor_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_linstor_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/linstor/test_linstor_sr_intrapool_migration.py b/tests/storage/linstor/test_linstor_sr_intrapool_migration.py index b1853feee..e5fc94d69 100644 --- a/tests/storage/linstor/test_linstor_sr_intrapool_migration.py +++ b/tests/storage/linstor/test_linstor_sr_intrapool_migration.py @@ -14,11 +14,12 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2") class Test: - def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_linstor_sr, linstor_sr): - live_storage_migration_then_come_back(vm_on_linstor_sr, host, linstor_sr, hostA2, linstor_sr) + def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_linstor_sr): + sr = vm_on_linstor_sr.get_sr() + live_storage_migration_then_come_back(vm_on_linstor_sr, host, hostA2, sr) - def test_cold_intrapool_migration(self, host, hostA2, vm_on_linstor_sr, linstor_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_linstor_sr, host, linstor_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_linstor_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_linstor_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_linstor_sr, linstor_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_linstor_sr, host, linstor_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_linstor_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_linstor_sr, host, hostA2, local_sr_on_hostA2) diff --git a/tests/storage/lvm/test_lvm_sr_crosspool_migration.py b/tests/storage/lvm/test_lvm_sr_crosspool_migration.py index 0345b1f6d..48f29aeb1 100644 --- a/tests/storage/lvm/test_lvm_sr_crosspool_migration.py +++ b/tests/storage/lvm/test_lvm_sr_crosspool_migration.py @@ -12,8 +12,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1") class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_lvm_sr, lvm_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_lvm_sr, host, lvm_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_lvm_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_lvm_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_lvm_sr, lvm_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_lvm_sr, host, lvm_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_lvm_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_lvm_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/lvm/test_lvm_sr_intrapool_migration.py b/tests/storage/lvm/test_lvm_sr_intrapool_migration.py index 4f0e4cca9..e77d8eb76 100644 --- a/tests/storage/lvm/test_lvm_sr_intrapool_migration.py +++ b/tests/storage/lvm/test_lvm_sr_intrapool_migration.py @@ -12,8 +12,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2") class Test: - def test_cold_intrapool_migration(self, host, hostA2, vm_on_lvm_sr, lvm_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_lvm_sr, host, lvm_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_lvm_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_lvm_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_lvm_sr, lvm_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_lvm_sr, host, lvm_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_lvm_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_lvm_sr, host, hostA2, local_sr_on_hostA2) diff --git a/tests/storage/lvmoiscsi/test_lvmoiscsi_sr_crosspool_migration.py b/tests/storage/lvmoiscsi/test_lvmoiscsi_sr_crosspool_migration.py index ca6f937f7..93769a943 100644 --- a/tests/storage/lvmoiscsi/test_lvmoiscsi_sr_crosspool_migration.py +++ b/tests/storage/lvmoiscsi/test_lvmoiscsi_sr_crosspool_migration.py @@ -12,8 +12,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1") class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_lvmoiscsi_sr, lvmoiscsi_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_lvmoiscsi_sr, host, lvmoiscsi_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_lvmoiscsi_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_lvmoiscsi_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_lvmoiscsi_sr, lvmoiscsi_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_lvmoiscsi_sr, host, lvmoiscsi_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_lvmoiscsi_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_lvmoiscsi_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/lvmoiscsi/test_lvmoiscsi_sr_intrapool_migration.py b/tests/storage/lvmoiscsi/test_lvmoiscsi_sr_intrapool_migration.py index f3c227ce1..091360b09 100644 --- a/tests/storage/lvmoiscsi/test_lvmoiscsi_sr_intrapool_migration.py +++ b/tests/storage/lvmoiscsi/test_lvmoiscsi_sr_intrapool_migration.py @@ -12,11 +12,12 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2") class Test: - def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_lvmoiscsi_sr, lvmoiscsi_sr): - live_storage_migration_then_come_back(vm_on_lvmoiscsi_sr, host, lvmoiscsi_sr, hostA2, lvmoiscsi_sr) + def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_lvmoiscsi_sr): + sr = vm_on_lvmoiscsi_sr.get_sr() + live_storage_migration_then_come_back(vm_on_lvmoiscsi_sr, host, hostA2, sr) - def test_cold_intrapool_migration(self, host, hostA2, vm_on_lvmoiscsi_sr, lvmoiscsi_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_lvmoiscsi_sr, host, lvmoiscsi_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_lvmoiscsi_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_lvmoiscsi_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_lvmoiscsi_sr, lvmoiscsi_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_lvmoiscsi_sr, host, lvmoiscsi_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_lvmoiscsi_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_lvmoiscsi_sr, host, hostA2, local_sr_on_hostA2) diff --git a/tests/storage/moosefs/test_moosefs_sr_crosspool_migration.py b/tests/storage/moosefs/test_moosefs_sr_crosspool_migration.py index feb0889de..37044ae93 100644 --- a/tests/storage/moosefs/test_moosefs_sr_crosspool_migration.py +++ b/tests/storage/moosefs/test_moosefs_sr_crosspool_migration.py @@ -14,8 +14,8 @@ @pytest.mark.big_vm # and ideally on a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1", "host_no_ipv6") # MooseFS doesn't support IPv6 class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_moosefs_sr, moosefs_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_moosefs_sr, host, moosefs_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_moosefs_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_moosefs_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_moosefs_sr, moosefs_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_moosefs_sr, host, moosefs_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_moosefs_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_moosefs_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/moosefs/test_moosefs_sr_intrapool_migration.py b/tests/storage/moosefs/test_moosefs_sr_intrapool_migration.py index c4c1ad323..c9e50bb77 100644 --- a/tests/storage/moosefs/test_moosefs_sr_intrapool_migration.py +++ b/tests/storage/moosefs/test_moosefs_sr_intrapool_migration.py @@ -14,11 +14,12 @@ @pytest.mark.big_vm # and ideally on a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2", "host_no_ipv6") # MooseFS doesn't support IPv6 class Test: - def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_moosefs_sr, moosefs_sr): - live_storage_migration_then_come_back(vm_on_moosefs_sr, host, moosefs_sr, hostA2, moosefs_sr) + def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_moosefs_sr): + sr = vm_on_moosefs_sr.get_sr() + live_storage_migration_then_come_back(vm_on_moosefs_sr, host, hostA2, sr) - def test_cold_intrapool_migration(self, host, hostA2, vm_on_moosefs_sr, moosefs_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_moosefs_sr, host, moosefs_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_moosefs_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_moosefs_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_moosefs_sr, moosefs_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_moosefs_sr, host, moosefs_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_moosefs_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_moosefs_sr, host, hostA2, local_sr_on_hostA2) diff --git a/tests/storage/nfs/test_nfs_sr.py b/tests/storage/nfs/test_nfs_sr.py index 41dc53755..0c2f38482 100644 --- a/tests/storage/nfs/test_nfs_sr.py +++ b/tests/storage/nfs/test_nfs_sr.py @@ -15,7 +15,6 @@ def test_create_and_destroy_sr(self, host, nfs_device_config): vm.destroy(verify=True) sr.destroy(verify=True) -@pytest.mark.usefixtures("nfs_sr") class TestNFSSR: @pytest.mark.quicktest def test_quicktest(self, nfs_sr): @@ -47,9 +46,9 @@ def test_snapshot(self, vm_on_nfs_sr): @pytest.mark.reboot @pytest.mark.small_vm - def test_reboot(self, host, nfs_sr, vm_on_nfs_sr): - sr = nfs_sr + def test_reboot(self, host, vm_on_nfs_sr): vm = vm_on_nfs_sr + sr = vm.get_sr() host.reboot(verify=True) wait_for(sr.all_pbds_attached, "Wait for PBD attached") # start the VM as a way to check that the underlying SR is operational diff --git a/tests/storage/nfs/test_nfs_sr_crosspool_migration.py b/tests/storage/nfs/test_nfs_sr_crosspool_migration.py index 00f85bc5d..7f5d5d729 100644 --- a/tests/storage/nfs/test_nfs_sr_crosspool_migration.py +++ b/tests/storage/nfs/test_nfs_sr_crosspool_migration.py @@ -12,8 +12,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1") class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_nfs_sr, nfs_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_nfs_sr, host, nfs_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_nfs_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_nfs_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_nfs_sr, nfs_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_nfs_sr, host, nfs_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_nfs_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_nfs_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/nfs/test_nfs_sr_intrapool_migration.py b/tests/storage/nfs/test_nfs_sr_intrapool_migration.py index 1b6da55cf..97a4da5be 100644 --- a/tests/storage/nfs/test_nfs_sr_intrapool_migration.py +++ b/tests/storage/nfs/test_nfs_sr_intrapool_migration.py @@ -12,11 +12,12 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2") class Test: - def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_nfs_sr, nfs_sr): - live_storage_migration_then_come_back(vm_on_nfs_sr, host, nfs_sr, hostA2, nfs_sr) + def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_nfs_sr): + sr = vm_on_nfs_sr.get_sr() + live_storage_migration_then_come_back(vm_on_nfs_sr, host, hostA2, sr) - def test_cold_intrapool_migration(self, host, hostA2, vm_on_nfs_sr, nfs_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_nfs_sr, host, nfs_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_nfs_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_nfs_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_nfs_sr, nfs_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_nfs_sr, host, nfs_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_nfs_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_nfs_sr, host, hostA2, local_sr_on_hostA2) diff --git a/tests/storage/storage.py b/tests/storage/storage.py index 8ea85347e..ab99de202 100644 --- a/tests/storage/storage.py +++ b/tests/storage/storage.py @@ -13,8 +13,9 @@ def try_to_create_sr_with_missing_device(sr_type, label, host): return assert False, 'SR creation should not have succeeded!' -def cold_migration_then_come_back(vm, prov_host, prov_sr, dest_host, dest_sr): +def cold_migration_then_come_back(vm, prov_host, dest_host, dest_sr): """ Storage migration of a shutdown VM, then migrate it back. """ + prov_sr = vm.get_sr() assert vm.is_halted() # Move the VM to another host of the pool vm.migrate(dest_host, dest_sr) @@ -31,7 +32,8 @@ def cold_migration_then_come_back(vm, prov_host, prov_sr, dest_host, dest_sr): vm.wait_for_os_booted() vm.shutdown(verify=True) -def live_storage_migration_then_come_back(vm, prov_host, prov_sr, dest_host, dest_sr): +def live_storage_migration_then_come_back(vm, prov_host, dest_host, dest_sr): + prov_sr = vm.get_sr() # start VM vm.start(on=prov_host.uuid) vm.wait_for_os_booted() diff --git a/tests/storage/xfs/test_xfs_sr_crosspool_migration.py b/tests/storage/xfs/test_xfs_sr_crosspool_migration.py index 11ae5498b..4b7f0bfff 100644 --- a/tests/storage/xfs/test_xfs_sr_crosspool_migration.py +++ b/tests/storage/xfs/test_xfs_sr_crosspool_migration.py @@ -14,8 +14,8 @@ @pytest.mark.big_vm # and ideally on a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1") class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_xfs_sr, xfs_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_xfs_sr, host, xfs_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_xfs_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_xfs_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_xfs_sr, xfs_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_xfs_sr, host, xfs_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_xfs_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_xfs_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/xfs/test_xfs_sr_intrapool_migration.py b/tests/storage/xfs/test_xfs_sr_intrapool_migration.py index 171aed6ad..cd2b0ca5b 100644 --- a/tests/storage/xfs/test_xfs_sr_intrapool_migration.py +++ b/tests/storage/xfs/test_xfs_sr_intrapool_migration.py @@ -14,8 +14,8 @@ @pytest.mark.big_vm # and ideally on a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2") class Test: - def test_cold_intrapool_migration(self, host, hostA2, vm_on_xfs_sr, xfs_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_xfs_sr, host, xfs_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_xfs_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_xfs_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_xfs_sr, xfs_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_xfs_sr, host, xfs_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_xfs_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_xfs_sr, host, hostA2, local_sr_on_hostA2) diff --git a/tests/storage/zfs/test_zfs_sr_crosspool_migration.py b/tests/storage/zfs/test_zfs_sr_crosspool_migration.py index 392a1d30d..ceab2b431 100644 --- a/tests/storage/zfs/test_zfs_sr_crosspool_migration.py +++ b/tests/storage/zfs/test_zfs_sr_crosspool_migration.py @@ -14,8 +14,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1") class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_zfs_sr, zfs_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_zfs_sr, host, zfs_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_zfs_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_zfs_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_zfs_sr, zfs_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_zfs_sr, host, zfs_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_zfs_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_zfs_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/zfs/test_zfs_sr_intrapool_migration.py b/tests/storage/zfs/test_zfs_sr_intrapool_migration.py index 6a3dafcad..ba5765946 100644 --- a/tests/storage/zfs/test_zfs_sr_intrapool_migration.py +++ b/tests/storage/zfs/test_zfs_sr_intrapool_migration.py @@ -14,8 +14,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2") class Test: - def test_cold_intrapool_migration(self, host, hostA2, vm_on_zfs_sr, zfs_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_zfs_sr, host, zfs_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_zfs_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_zfs_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_zfs_sr, zfs_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_zfs_sr, host, zfs_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_zfs_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_zfs_sr, host, hostA2, local_sr_on_hostA2) diff --git a/tests/storage/zfsvol/test_zfsvol_sr_crosspool_migration.py b/tests/storage/zfsvol/test_zfsvol_sr_crosspool_migration.py index 681a1be39..7a5e91f71 100644 --- a/tests/storage/zfsvol/test_zfsvol_sr_crosspool_migration.py +++ b/tests/storage/zfsvol/test_zfsvol_sr_crosspool_migration.py @@ -15,12 +15,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1") class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_zfsvol_sr, - zfsvol_sr, local_sr_on_hostB1): - cold_migration_then_come_back( - vm_on_zfsvol_sr, host, zfsvol_sr, hostB1, local_sr_on_hostB1) + def test_cold_crosspool_migration(self, host, hostB1, vm_on_zfsvol_sr, local_sr_on_hostB1): + cold_migration_then_come_back(vm_on_zfsvol_sr, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_zfsvol_sr, - zfsvol_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back( - vm_on_zfsvol_sr, host, zfsvol_sr, hostB1, local_sr_on_hostB1) + def test_live_crosspool_migration(self, host, hostB1, vm_on_zfsvol_sr, local_sr_on_hostB1): + live_storage_migration_then_come_back(vm_on_zfsvol_sr, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/zfsvol/test_zfsvol_sr_intrapool_migration.py b/tests/storage/zfsvol/test_zfsvol_sr_intrapool_migration.py index 73f479209..d19f40ee6 100644 --- a/tests/storage/zfsvol/test_zfsvol_sr_intrapool_migration.py +++ b/tests/storage/zfsvol/test_zfsvol_sr_intrapool_migration.py @@ -15,12 +15,8 @@ @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2") class Test: - def test_cold_intrapool_migration(self, host, hostA2, vm_on_zfsvol_sr, - zfsvol_sr, local_sr_on_hostA2): - cold_migration_then_come_back( - vm_on_zfsvol_sr, host, zfsvol_sr, hostA2, local_sr_on_hostA2) + def test_cold_intrapool_migration(self, host, hostA2, vm_on_zfsvol_sr, local_sr_on_hostA2): + cold_migration_then_come_back(vm_on_zfsvol_sr, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_zfsvol_sr, - zfsvol_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back( - vm_on_zfsvol_sr, host, zfsvol_sr, hostA2, local_sr_on_hostA2) + def test_live_intrapool_migration(self, host, hostA2, vm_on_zfsvol_sr, local_sr_on_hostA2): + live_storage_migration_then_come_back(vm_on_zfsvol_sr, host, hostA2, local_sr_on_hostA2) From 2d308d3259d33d133f228b1e99d454d3028290f4 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Wed, 10 Apr 2024 09:59:03 +0200 Subject: [PATCH 2/2] Add tests for NFS4+ only environment New NFS4 device config Run nfs tests on both device configs thanks to a paramtrized fixture Signed-off-by: Benjamin Reis --- data.py-dist | 7 +++ tests/storage/nfs/conftest.py | 49 +++++++++++++++++++ tests/storage/nfs/test_nfs_sr.py | 43 +++++++++++----- .../nfs/test_nfs_sr_crosspool_migration.py | 12 +++-- .../nfs/test_nfs_sr_intrapool_migration.py | 19 ++++--- 5 files changed, 107 insertions(+), 23 deletions(-) diff --git a/data.py-dist b/data.py-dist index f0ddf78c2..a53bd0f0f 100644 --- a/data.py-dist +++ b/data.py-dist @@ -59,6 +59,13 @@ DEFAULT_NFS_DEVICE_CONFIG = { # 'serverpath': '/path/to/shared/mount' # Path to shared mountpoint } +# Default NFS4+ only device config: +DEFAULT_NFS4_DEVICE_CONFIG = { +# 'server': '10.0.0.2', # URL/Hostname of NFS server +# 'serverpath': '/path_to_shared_mount' # Path to shared mountpoint +# 'nfsversion': '4.1' +} + # Default NFS ISO device config: DEFAULT_NFS_ISO_DEVICE_CONFIG = { # 'location': '10.0.0.2:/path/to/shared/mount' # URL/Hostname of NFS server and path to shared mountpoint diff --git a/tests/storage/nfs/conftest.py b/tests/storage/nfs/conftest.py index aef0902b2..e8c430040 100644 --- a/tests/storage/nfs/conftest.py +++ b/tests/storage/nfs/conftest.py @@ -1,6 +1,14 @@ import logging import pytest +# --- Dispatch fixture for NFS versions ---------------------------------------- + +@pytest.fixture +def dispatch_nfs(request): + yield request.getfixturevalue(request.param) + +# --- NFS3 fixtures ------------------------------------------------------------ + @pytest.fixture(scope='package') def nfs_device_config(sr_device_config): if sr_device_config is not None: @@ -39,3 +47,44 @@ def vm_on_nfs_sr(host, nfs_sr, vm_ref): # teardown logging.info("<< Destroy VM") vm.destroy(verify=True) + +# --- NFS4+ only fixtures ------------------------------------------------------ + +@pytest.fixture(scope='package') +def nfs4_device_config(sr_device_config): + if sr_device_config is not None: + # SR device config from CLI param + config = sr_device_config + else: + # SR device config from data.py defaults + try: + from data import DEFAULT_NFS4_DEVICE_CONFIG + except ImportError: + DEFAULT_NFS4_DEVICE_CONFIG = {} + if DEFAULT_NFS4_DEVICE_CONFIG: + config = DEFAULT_NFS4_DEVICE_CONFIG + else: + raise Exception("No default NFS4+ device-config found, neither in CLI nor in data.py defaults") + return config + +@pytest.fixture(scope='package') +def nfs4_sr(host, nfs4_device_config): + """ A NFS4+ SR on first host. """ + sr = host.sr_create('nfs', "NFS4-SR-test", nfs4_device_config, shared=True) + yield sr + # teardown + sr.destroy() + +@pytest.fixture(scope='module') +def vdi_on_nfs4_sr(nfs4_sr): + vdi = nfs4_sr.create_vdi('NFS4-VDI-test') + yield vdi + vdi.destroy() + +@pytest.fixture(scope='module') +def vm_on_nfs4_sr(host, nfs4_sr, vm_ref): + vm = host.import_vm(vm_ref, sr_uuid=nfs4_sr.uuid) + yield vm + # teardown + logging.info("<< Destroy VM") + vm.destroy(verify=True) diff --git a/tests/storage/nfs/test_nfs_sr.py b/tests/storage/nfs/test_nfs_sr.py index 0c2f38482..ee10cab92 100644 --- a/tests/storage/nfs/test_nfs_sr.py +++ b/tests/storage/nfs/test_nfs_sr.py @@ -5,36 +5,52 @@ # Requirements: # - one XCP-ng host >= 8.0 with an additional unused disk for the SR +# Make sure this fixture is called before the parametrized one +@pytest.mark.usefixtures('sr_device_config') class TestNFSSRCreateDestroy: - def test_create_and_destroy_sr(self, host, nfs_device_config): + @pytest.mark.parametrize('dispatch_nfs', ['nfs_device_config', 'nfs4_device_config'], indirect=True) + def test_create_and_destroy_sr(self, host, dispatch_nfs): + device_config = dispatch_nfs # Create and destroy tested in the same test to leave the host as unchanged as possible - sr = host.sr_create('nfs', "NFS-SR-test", nfs_device_config, shared=True, verify=True) + sr = host.sr_create('nfs', "NFS-SR-test", device_config, shared=True, verify=True) # import a VM in order to detect vm import issues here rather than in the vm_on_nfs fixture used in # the next tests, because errors in fixtures break teardown vm = host.import_vm(vm_image('mini-linux-x86_64-bios'), sr_uuid=sr.uuid) vm.destroy(verify=True) sr.destroy(verify=True) +# Make sure these fixtures are called before the parametrized one +@pytest.mark.usefixtures('sr_device_config', 'hosts') class TestNFSSR: @pytest.mark.quicktest - def test_quicktest(self, nfs_sr): - nfs_sr.run_quicktest() + @pytest.mark.parametrize('dispatch_nfs', ['nfs_sr', 'nfs4_sr'], indirect=True) + def test_quicktest(self, dispatch_nfs): + sr = dispatch_nfs + sr.run_quicktest() - def test_vdi_is_not_open(self, vdi_on_nfs_sr): - assert not vdi_is_open(vdi_on_nfs_sr) + @pytest.mark.parametrize('dispatch_nfs', ['vdi_on_nfs_sr', 'vdi_on_nfs4_sr'], indirect=True) + def test_vdi_is_not_open(self, dispatch_nfs): + vdi = dispatch_nfs + assert not vdi_is_open(vdi) @pytest.mark.small_vm # run with a small VM to test the features @pytest.mark.big_vm # and ideally with a big VM to test it scales - def test_start_and_shutdown_VM(self, vm_on_nfs_sr): - vm = vm_on_nfs_sr + # Make sure this fixture is called before the parametrized one + @pytest.mark.usefixtures('vm_ref') + @pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True) + def test_start_and_shutdown_VM(self, dispatch_nfs): + vm = dispatch_nfs vm.start() vm.wait_for_os_booted() vm.shutdown(verify=True) @pytest.mark.small_vm @pytest.mark.big_vm - def test_snapshot(self, vm_on_nfs_sr): - vm = vm_on_nfs_sr + # Make sure this fixture is called before the parametrized one + @pytest.mark.usefixtures('vm_ref') + @pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True) + def test_snapshot(self, dispatch_nfs): + vm = dispatch_nfs vm.start() try: vm.wait_for_os_booted() @@ -46,8 +62,11 @@ def test_snapshot(self, vm_on_nfs_sr): @pytest.mark.reboot @pytest.mark.small_vm - def test_reboot(self, host, vm_on_nfs_sr): - vm = vm_on_nfs_sr + # Make sure this fixture is called before the parametrized one + @pytest.mark.usefixtures('vm_ref') + @pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True) + def test_reboot(self, host, dispatch_nfs): + vm = dispatch_nfs sr = vm.get_sr() host.reboot(verify=True) wait_for(sr.all_pbds_attached, "Wait for PBD attached") diff --git a/tests/storage/nfs/test_nfs_sr_crosspool_migration.py b/tests/storage/nfs/test_nfs_sr_crosspool_migration.py index 7f5d5d729..c09177f01 100644 --- a/tests/storage/nfs/test_nfs_sr_crosspool_migration.py +++ b/tests/storage/nfs/test_nfs_sr_crosspool_migration.py @@ -11,9 +11,13 @@ @pytest.mark.small_vm # run with a small VM to test the features @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostB1", "local_sr_on_hostB1") +# Make sure these fixtures are called before the parametrized one +@pytest.mark.usefixtures('sr_device_config', 'vm_ref', 'hosts') class Test: - def test_cold_crosspool_migration(self, host, hostB1, vm_on_nfs_sr, local_sr_on_hostB1): - cold_migration_then_come_back(vm_on_nfs_sr, host, hostB1, local_sr_on_hostB1) + @pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True) + def test_cold_crosspool_migration(self, host, hostB1, dispatch_nfs, local_sr_on_hostB1): + cold_migration_then_come_back(dispatch_nfs, host, hostB1, local_sr_on_hostB1) - def test_live_crosspool_migration(self, host, hostB1, vm_on_nfs_sr, local_sr_on_hostB1): - live_storage_migration_then_come_back(vm_on_nfs_sr, host, hostB1, local_sr_on_hostB1) + @pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True) + def test_live_crosspool_migration(self, host, hostB1, dispatch_nfs, local_sr_on_hostB1): + live_storage_migration_then_come_back(dispatch_nfs, host, hostB1, local_sr_on_hostB1) diff --git a/tests/storage/nfs/test_nfs_sr_intrapool_migration.py b/tests/storage/nfs/test_nfs_sr_intrapool_migration.py index 97a4da5be..acde175bc 100644 --- a/tests/storage/nfs/test_nfs_sr_intrapool_migration.py +++ b/tests/storage/nfs/test_nfs_sr_intrapool_migration.py @@ -11,13 +11,18 @@ @pytest.mark.small_vm # run with a small VM to test the features @pytest.mark.big_vm # and ideally with a big VM to test it scales @pytest.mark.usefixtures("hostA2", "local_sr_on_hostA2") +# Make sure these fixtures are called before the parametrized one +@pytest.mark.usefixtures('sr_device_config', 'vm_ref', 'hosts') class Test: - def test_live_intrapool_shared_migration(self, host, hostA2, vm_on_nfs_sr): - sr = vm_on_nfs_sr.get_sr() - live_storage_migration_then_come_back(vm_on_nfs_sr, host, hostA2, sr) + @pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True) + def test_live_intrapool_shared_migration(self, host, hostA2, dispatch_nfs): + sr = dispatch_nfs.get_sr() + live_storage_migration_then_come_back(dispatch_nfs, host, hostA2, sr) - def test_cold_intrapool_migration(self, host, hostA2, vm_on_nfs_sr, local_sr_on_hostA2): - cold_migration_then_come_back(vm_on_nfs_sr, host, hostA2, local_sr_on_hostA2) + @pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True) + def test_cold_intrapool_migration(self, host, hostA2, dispatch_nfs, local_sr_on_hostA2): + cold_migration_then_come_back(dispatch_nfs, host, hostA2, local_sr_on_hostA2) - def test_live_intrapool_migration(self, host, hostA2, vm_on_nfs_sr, local_sr_on_hostA2): - live_storage_migration_then_come_back(vm_on_nfs_sr, host, hostA2, local_sr_on_hostA2) + @pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True) + def test_live_intrapool_migration(self, host, hostA2, dispatch_nfs, local_sr_on_hostA2): + live_storage_migration_then_come_back(dispatch_nfs, host, hostA2, local_sr_on_hostA2)