On 12/4/18 5:47 PM, John Ferlan wrote:
Add the logical storage pool startup validation (xml2argv) tests.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
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
The same point here. On my system it is /sbin/vgchange.
Michal