1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-17 06:04:23 +03:00

filters: always reevaluate filter before creating a PV

...to avoid using cached value (persistent filter) and therefore
not noticing any change made after last scan/filtering - the state
of the device may have changed, for example new signatures added.

$ lvm dumpconfig --type diff
allocation {
	use_blkid_wiping=0
}
devices {
	obtain_device_list_from_udev=0
}

$ cat /etc/lvm/cache/.cache | grep sda

$ vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "fedora" using metadata type lvm2

$ cat /etc/lvm/cache/.cache | grep sda
		"/dev/sda",

$ parted /dev/sda mklabel gpt
Information: You may need to update /etc/fstab.

$ parted /dev/sda print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 134MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  Flags

$ cat /etc/lvm/cache/.cache | grep sda
		"/dev/sda",

====

Before this patch:
$ pvcreate /dev/sda
  Physical volume "/dev/sda" successfully created

With this patch applied:
$ pvcreate /dev/sda
  Physical volume /dev/sda not found
  Device /dev/sda not found (or ignored by filtering).
This commit is contained in:
Peter Rajnoha 2014-06-25 16:19:27 +02:00
parent e329c3146d
commit e80884cd08
2 changed files with 8 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
Always reevaluate filters just before creating PV.
Version 2.02.107 - 23rd June 2014
=================================

View File

@ -1337,6 +1337,13 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name,
/* FIXME Check partition type is LVM unless --force is given */
/*
* Make sure we don't overwrite any existing signature
* that may have been created after last time we did filtering.
*/
if (cmd->filter->wipe)
cmd->filter->wipe(cmd->filter);
/* Is there a pv here already? */
pv = find_pv_by_name(cmd, name, 1, 1);