]> sourceware.org Git - lvm2.git/commitdiff
Fix pvcreate device check.
authorMilan Broz <mbroz@redhat.com>
Wed, 17 Mar 2010 14:44:18 +0000 (14:44 +0000)
committerMilan Broz <mbroz@redhat.com>
Wed, 17 Mar 2010 14:44:18 +0000 (14:44 +0000)
If user try to vgcreate or vgextend non-existent VG,
these messages appears:

# vgcreate xxx /dev/xxx
  Internal error: Volume Group xxx was not unlocked
  Device /dev/xxx not found (or ignored by filtering).
  Unable to add physical volume '/dev/xxx' to volume group 'xxx'.
  Internal error: Attempt to unlock unlocked VG xxx.

(the same with existing VG and non-existing PV & vgextend)
# vgextend vg_test /dev/xxx
...

It is caused because code tries to "refresh" cache if
md filter is switched on using cache destroy.

But we can change filters and rescan even without this
machinery now, just use refresh_filters
(and reset md filter afterwards).

(Patch also  discovers cache alias bug in vgsplit test,
fix it by using better filter line.)

WHATS_NEW
lib/metadata/metadata.c
test/t-vgsplit-stacked.sh

index 409288b142ea2550067d0769020f2cd68c166077..8dc1ea6e10e5da3b7dabe877eefab858b2258f9b 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.63 - 
 ================================
+  Fix pvcreate device md filter check.
   Suppress repeated errors about the same missing PV uuids.
   Bypass full device scans when using internally-cached VG metadata.
   Only do one full device scan during each read of text format metadata.
index dcf1aa9191c439d01b6755201e2720c28c00a39d..4060ca223aefd96514940c3301bde272d738e6d9 100644 (file)
@@ -1290,18 +1290,10 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name,
        dev = dev_cache_get(name, cmd->filter);
 
        /* Is there an md superblock here? */
+       /* FIXME: still possible issues here - rescan cache? */
        if (!dev && md_filtering()) {
-               unlock_vg(cmd, VG_ORPHANS);
-
-               persistent_filter_wipe(cmd->filter);
-               lvmcache_destroy(cmd, 1);
-
+               refresh_filters(cmd);
                init_md_filtering(0);
-               if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {
-                       log_error("Can't get lock for orphan PVs");
-                       init_md_filtering(1);
-                       return 0;
-               }
                dev = dev_cache_get(name, cmd->filter);
                init_md_filtering(1);
        }
index 46cb1053c4a962c3c717af9c6a0a60010764f363..fb4e659eddcbea2b606b651fdfe7cc48f1c8e79e 100644 (file)
@@ -1,6 +1,6 @@
 . ./test-utils.sh
 
-prepare_lvmconf '[ "a/dev\/mirror/", "a/dev\/mapper\/.*$/", "r/.*/" ]'
+prepare_lvmconf '[ "a/dev\/mirror/", "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
 aux prepare_devs 3
 
 pvcreate $devs
This page took 0.043839 seconds and 5 git commands to generate.