[PATCH 8/8] storage: Add tests for logical backend startup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add the logical storage pool startup validation (xml2argv) tests.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/storage/storage_backend_logical.c               |  6 +-----
 src/storage/storage_util.c                          | 11 +++++++++++
 src/storage/storage_util.h                          |  4 ++++
 .../pool-logical-create.argv                        |  1 +
 .../pool-logical-noname.argv                        |  1 +
 .../pool-logical-nopath.argv                        |  1 +
 tests/storagepoolxml2argvdata/pool-logical.argv     |  1 +
 tests/storagepoolxml2argvtest.c                     | 13 ++++++++-----
 8 files changed, 28 insertions(+), 10 deletions(-)
 create mode 100644 tests/storagepoolxml2argvdata/pool-logical-create.argv
 create mode 100644 tests/storagepoolxml2argvdata/pool-logical-noname.argv
 create mode 100644 tests/storagepoolxml2argvdata/pool-logical-nopath.argv
 create mode 100644 tests/storagepoolxml2argvdata/pool-logical.argv

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 44cff61af7..12fff651e8 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -52,11 +52,7 @@ virStorageBackendLogicalSetActive(virStoragePoolObjPtr pool,
 {
     int ret;
     virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
-    virCommandPtr cmd =
-        virCommandNewArgList(VGCHANGE,
-                             on ? "-aly" : "-aln",
-                             def->source.name,
-                             NULL);
+    virCommandPtr cmd = virStorageBackendLogicalChangeCmd(def, on);
 
     ret = virCommandRun(cmd, NULL);
     virCommandFree(cmd);
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 789f270f2a..01f3c93008 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -4337,3 +4337,14 @@ virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
         virStorageBackendFileSystemMountDefaultArgs(cmd, src, def);
     return cmd;
 }
+
+
+virCommandPtr
+virStorageBackendLogicalChangeCmd(virStoragePoolDefPtr def,
+                                  bool on)
+{
+    return virCommandNewArgList(VGCHANGE,
+                                on ? "-aly" : "-aln",
+                                def->source.name,
+                                NULL);
+}
diff --git a/src/storage/storage_util.h b/src/storage/storage_util.h
index 28b3e0b9c9..a2ef2ac07d 100644
--- a/src/storage/storage_util.h
+++ b/src/storage/storage_util.h
@@ -184,4 +184,8 @@ virCommandPtr
 virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
                                     const char *src);
 
+virCommandPtr
+virStorageBackendLogicalChangeCmd(virStoragePoolDefPtr def,
+                                  bool on);
+
 #endif /* __VIR_STORAGE_UTIL_H__ */
diff --git a/tests/storagepoolxml2argvdata/pool-logical-create.argv b/tests/storagepoolxml2argvdata/pool-logical-create.argv
new file mode 100644
index 0000000000..203da86e48
--- /dev/null
+++ b/tests/storagepoolxml2argvdata/pool-logical-create.argv
@@ -0,0 +1 @@
+/usr/sbin/vgchange -aly HostVG
diff --git a/tests/storagepoolxml2argvdata/pool-logical-noname.argv b/tests/storagepoolxml2argvdata/pool-logical-noname.argv
new file mode 100644
index 0000000000..0813467120
--- /dev/null
+++ b/tests/storagepoolxml2argvdata/pool-logical-noname.argv
@@ -0,0 +1 @@
+/usr/sbin/vgchange -aly zily
diff --git a/tests/storagepoolxml2argvdata/pool-logical-nopath.argv b/tests/storagepoolxml2argvdata/pool-logical-nopath.argv
new file mode 100644
index 0000000000..203da86e48
--- /dev/null
+++ b/tests/storagepoolxml2argvdata/pool-logical-nopath.argv
@@ -0,0 +1 @@
+/usr/sbin/vgchange -aly HostVG
diff --git a/tests/storagepoolxml2argvdata/pool-logical.argv b/tests/storagepoolxml2argvdata/pool-logical.argv
new file mode 100644
index 0000000000..203da86e48
--- /dev/null
+++ b/tests/storagepoolxml2argvdata/pool-logical.argv
@@ -0,0 +1 @@
+/usr/sbin/vgchange -aly HostVG
diff --git a/tests/storagepoolxml2argvtest.c b/tests/storagepoolxml2argvtest.c
index 42044e3518..26b12c8fc3 100644
--- a/tests/storagepoolxml2argvtest.c
+++ b/tests/storagepoolxml2argvtest.c
@@ -43,8 +43,11 @@ testCompareXMLToArgvFiles(bool shouldFail,
         cmd = virStorageBackendFileSystemMountCmd(def, src);
         break;
 
-    case VIR_STORAGE_POOL_DIR:
     case VIR_STORAGE_POOL_LOGICAL:
+        cmd = virStorageBackendLogicalChangeCmd(def, true);
+        break;
+
+    case VIR_STORAGE_POOL_DIR:
     case VIR_STORAGE_POOL_DISK:
     case VIR_STORAGE_POOL_ISCSI:
     case VIR_STORAGE_POOL_ISCSI_DIRECT:
@@ -136,10 +139,10 @@ mymain(void)
     DO_TEST_FAIL("pool-dir");
     DO_TEST_FAIL("pool-dir-naming");
     DO_TEST("pool-fs");
-    DO_TEST_FAIL("pool-logical");
-    DO_TEST_FAIL("pool-logical-nopath");
-    DO_TEST_FAIL("pool-logical-create");
-    DO_TEST_FAIL("pool-logical-noname");
+    DO_TEST("pool-logical");
+    DO_TEST("pool-logical-nopath");
+    DO_TEST("pool-logical-create");
+    DO_TEST("pool-logical-noname");
     DO_TEST_FAIL("pool-disk");
     DO_TEST_FAIL("pool-disk-device-nopartsep");
     DO_TEST_FAIL("pool-iscsi");
-- 
2.17.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux