]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: fix test_rbd_wnbd.py
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Thu, 17 Nov 2022 08:29:48 +0000 (10:29 +0200)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 23 Nov 2022 10:59:30 +0000 (12:59 +0200)
The rbd-wnbd Python test now fails as the wnbd driver changed
the bus type from "virtual" to "SAS" in order to accommodate
Microsoft Failover Cluster.

SAS is considered a shared bus, so with the default SAN policy
(offlineShared), the disks will be offline/read-only by
default[1][2].

That being considered, we're updating the test to set the rw disk
flag before attempting any write operations.

[1] https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-partitionmanager-sanpolicy
[2] https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/san

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
qa/workunits/windows/test_rbd_wnbd.py

index 0b9ae7c954ccc7d67a78e79f95288e12ebef185c..b0cddc48b735454747483a859cc8bbd6084d71f3 100644 (file)
@@ -285,6 +285,13 @@ class RbdImage(object):
     def path(self):
         return f"\\\\.\\PhysicalDrive{self.disk_number}"
 
+    @Tracer.trace
+    def set_writable(self):
+        execute(
+            "powershell.exe", "-command",
+            "Set-Disk", "-Number", str(self.disk_number),
+            "-IsReadOnly", "$false")
+
     @Tracer.trace
     def map(self, timeout: int = 60):
         LOG.info("Mapping image: %s", self.name)
@@ -296,7 +303,9 @@ class RbdImage(object):
         self.disk_number = self.get_disk_number(timeout=timeout)
 
         elapsed = time.time() - tstart
-        self._wait_for_disk(timeout=timeout - elapsed, )
+        self._wait_for_disk(timeout=timeout - elapsed)
+
+        self.set_writable()
 
     @Tracer.trace
     def unmap(self):