The appliance has no LVM system ID set, which means that lvm commands will ignore VGs with a system ID set to anything. Since we want to work with them, pass --foreign at least when listing them to see them. See also lvmsystemid(7). --- daemon/lvm.c | 10 ++++++---- generator/daemon.ml | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/daemon/lvm.c b/daemon/lvm.c index 831c56e..0123ae5 100644 --- a/daemon/lvm.c +++ b/daemon/lvm.c @@ -194,7 +194,7 @@ do_pvs (void) int r; r = command (&out, &err, - str_lvm, "pvs", "-o", "pv_name", "--noheadings", NULL); + str_lvm, "pvs", "--foreign", "-o", "pv_name", "--noheadings", NULL); if (r == -1) { reply_with_error ("%s", err); free (out); @@ -212,7 +212,7 @@ do_vgs (void) int r; r = command (&out, &err, - str_lvm, "vgs", "-o", "vg_name", "--noheadings", NULL); + str_lvm, "vgs", "--foreign", "-o", "vg_name", "--noheadings", NULL); if (r == -1) { reply_with_error ("%s", err); free (out); @@ -263,6 +263,7 @@ do_lvs (void) if (has_S > 0) { r = command (&out, &err, str_lvm, "lvs", + "--foreign", "-o", "vg_name,lv_name", "-S", "lv_role=public && lv_skip_activation!=1", "--noheadings", @@ -277,6 +278,7 @@ do_lvs (void) } else { r = command (&out, &err, str_lvm, "lvs", + "--foreign", "-o", "lv_attr,vg_name,lv_name", "--noheadings", "--separator", ":", NULL); @@ -718,7 +720,7 @@ get_lvm_field (const char *cmd, const char *field, const char *device) char *out; CLEANUP_FREE char *err = NULL; int r = command (&out, &err, - str_lvm, cmd, + str_lvm, cmd, "--foreign", "--unbuffered", "--noheadings", "-o", field, device, NULL); if (r == -1) { @@ -755,7 +757,7 @@ get_lvm_fields (const char *cmd, const char *field, const char *device) CLEANUP_FREE char *out = NULL, *err = NULL; int r = command (&out, &err, - str_lvm, cmd, + str_lvm, cmd, "--foreign", "--unbuffered", "--noheadings", "-o", field, device, NULL); if (r == -1) { diff --git a/generator/daemon.ml b/generator/daemon.ml index 1d79126..9160beb 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -632,6 +632,7 @@ cleanup_free_mountable (mountable_t *mountable) pr "\n"; pr " r = command (&out, &err,\n"; pr " \"lvm\", \"%ss\",\n" typ; + pr " \"--foreign\",\n"; pr " \"-o\", lvm_%s_cols, \"--unbuffered\", \"--noheadings\",\n" typ; pr " \"--nosuffix\", \"--separator\", \"\\r\", \"--units\", \"b\", NULL);\n"; pr " if (r == -1) {\n"; -- 2.7.4