From 1ac47e34f2c2e21df578cb742f2e59985f5f4fba Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Wed, 5 Nov 2008 11:41:43 +0000 Subject: [PATCH] Call vgscan before attempting to scan logical volumes. This makes sure we've "touched" any logical volumes, so they appear in the subsequent "pvs" call. Signed-off-by: Chris Lalancette --- ChangeLog | 5 +++++ configure.in | 6 +++++- src/storage_backend_logical.c | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dcef06d9bd..d5926b2d84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Nov 5 12:41:00 CET 2008 Chris Lalancette + * configure.in, src/storage_backend_logical.c: Call vgscan before + attempting to scan logical volumes. This makes sure we've "touched" + any logical volumes, so they appear in the subsequent "pvs" call. + Tue Nov 4 23:33:31 UTC 2008 Daniel P. Berrange * configure.in: Set WITH_XXXX conditionals for drivers in diff --git a/configure.in b/configure.in index c105eca809..ef6973076f 100644 --- a/configure.in +++ b/configure.in @@ -748,6 +748,7 @@ if test "$with_storage_lvm" = "yes" -o "$with_storage_lvm" = "check"; then AC_PATH_PROG([VGREMOVE], [vgremove], [], [$PATH:/sbin:/usr/sbin]) AC_PATH_PROG([LVREMOVE], [lvremove], [], [$PATH:/sbin:/usr/sbin]) AC_PATH_PROG([VGCHANGE], [vgchange], [], [$PATH:/sbin:/usr/sbin]) + AC_PATH_PROG([VGSCAN], [vgscan], [], [$PATH:/sbin:/usr/sbin]) AC_PATH_PROG([PVS], [pvs], [], [$PATH:/sbin:/usr/sbin]) AC_PATH_PROG([VGS], [vgs], [], [$PATH:/sbin:/usr/sbin]) AC_PATH_PROG([LVS], [lvs], [], [$PATH:/sbin:/usr/sbin]) @@ -760,6 +761,7 @@ if test "$with_storage_lvm" = "yes" -o "$with_storage_lvm" = "check"; then if test -z "$VGREMOVE" ; then AC_MSG_ERROR([We need vgremove for LVM storage driver]) ; fi if test -z "$LVREMOVE" ; then AC_MSG_ERROR([We need lvremove for LVM storage driver]) ; fi if test -z "$VGCHANGE" ; then AC_MSG_ERROR([We need vgchange for LVM storage driver]) ; fi + if test -z "$VGSCAN" ; then AC_MSG_ERROR([We need vgscan for LVM storage driver]) ; fi if test -z "$PVS" ; then AC_MSG_ERROR([We need pvs for LVM storage driver]) ; fi if test -z "$VGS" ; then AC_MSG_ERROR([We need vgs for LVM storage driver]) ; fi if test -z "$LVS" ; then AC_MSG_ERROR([We need lvs for LVM storage driver]) ; fi @@ -770,7 +772,8 @@ if test "$with_storage_lvm" = "yes" -o "$with_storage_lvm" = "check"; then if test -z "$PVREMOVE" ; then with_storage_lvm=no ; fi if test -z "$VGREMOVE" ; then with_storage_lvm=no ; fi if test -z "$LVREMOVE" ; then with_storage_lvm=no ; fi - if test -z "VGCHANGE" ; then with_storage_lvm=no ; fi + if test -z "$VGCHANGE" ; then with_storage_lvm=no ; fi + if test -z "$VGSCAN" ; then with_storage_lvm=no ; fi if test -z "$PVS" ; then with_storage_lvm=no ; fi if test -z "$VGS" ; then with_storage_lvm=no ; fi if test -z "$LVS" ; then with_storage_lvm=no ; fi @@ -787,6 +790,7 @@ if test "$with_storage_lvm" = "yes" -o "$with_storage_lvm" = "check"; then AC_DEFINE_UNQUOTED([VGREMOVE],["$VGREMOVE"],[Location of vgcreate program]) AC_DEFINE_UNQUOTED([LVREMOVE],["$LVREMOVE"],[Location of lvcreate program]) AC_DEFINE_UNQUOTED([VGCHANGE],["$VGCHANGE"],[Location of vgchange program]) + AC_DEFINE_UNQUOTED([VGSCAN],["$VGSCAN"],[Location of vgscan program]) AC_DEFINE_UNQUOTED([PVS],["$PVS"],[Location of pvs program]) AC_DEFINE_UNQUOTED([VGS],["$VGS"],[Location of vgs program]) AC_DEFINE_UNQUOTED([LVS],["$LVS"],[Location of lvs program]) diff --git a/src/storage_backend_logical.c b/src/storage_backend_logical.c index 53bea67f35..7b013f896e 100644 --- a/src/storage_backend_logical.c +++ b/src/storage_backend_logical.c @@ -326,11 +326,19 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn, 2 }; const char *const prog[] = { PVS, "--noheadings", "-o", "pv_name,vg_name", NULL }; + const char *const scanprog[] = { VGSCAN, NULL }; int exitstatus; char *retval = NULL; virStoragePoolSourceList sourceList; int i; + /* + * NOTE: ignoring errors here; this is just to "touch" any logical volumes + * that might be hanging around, so if this fails for some reason, the + * worst that happens is that scanning doesn't pick everything up + */ + virRun(conn, scanprog, &exitstatus); + memset(&sourceList, 0, sizeof(sourceList)); sourceList.type = VIR_STORAGE_POOL_LOGICAL;