From 00ed6759c8cbf2f4497fa0d5f7df69780159539a Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Wed, 3 Apr 2013 11:10:52 +0200 Subject: [PATCH] lvmetad: Mark PVs visible to lvmetad but not to us as MISSING. --- lib/cache/lvmetad.c | 6 +++++- test/shell/lvcreate-missing.sh | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/shell/lvcreate-missing.sh diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c index 3cde71e2c..a7354a7bf 100644 --- a/lib/cache/lvmetad.c +++ b/lib/cache/lvmetad.c @@ -387,14 +387,18 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna if ((info = lvmcache_info_from_pvid((const char *)&pvl->pv->id, 0))) { pvl->pv->label_sector = lvmcache_get_label(info)->sector; pvl->pv->dev = lvmcache_device(info); + if (!pvl->pv->dev) + pvl->pv->status |= MISSING_PV; if (!lvmcache_fid_add_mdas_pv(info, fid)) { vg = NULL; goto_out; /* FIXME error path */ } - } /* else probably missing */ + } else + pvl->pv->status |= MISSING_PV; /* probably missing */ } lvmcache_update_vg(vg, 0); + vg_mark_partial_lvs(vg, 1); } out: diff --git a/test/shell/lvcreate-missing.sh b/test/shell/lvcreate-missing.sh new file mode 100644 index 000000000..63471c379 --- /dev/null +++ b/test/shell/lvcreate-missing.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Copyright (C) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions +# of the GNU General Public License v.2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +. lib/test + +aux prepare_vg 2 +init_udev_transaction +dmsetup remove -f "$dev1" || true +finish_udev_transaction + +not lvcreate -n "foo" $vg -l 1 -- 2.43.5