1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

pvscan: notify lvmetad about device that is gone and pvscan is run with device path instead of major:minor pair

If pvscan is run with device path instead of major:minor pair and this
device still exists in the system and the device is not visible anymore
(due to a filter that is applied), notify lvmetad properly about this.

This makes it more consistent with respect to existing pvscan with
major:minor which already notifies lvmetad about device that is gone
due to filters.

However, if the device is not in the system anymore, we're not able
to translate the original device path into major:minor pair which
lvmetad needs for its action (lvmetad_pv_gone fn). So in this case,
we still need to use major:minor pair only, not device path. But at
least make "pvscan --cache DevicePath" as near as possible to "pvscan
--cahce <major>:<minor>" functionality.

Also add a note to pvscan man page about this difference when using
pvscan --cache with DevicePath and major:minor pair.
This commit is contained in:
Peter Rajnoha 2015-01-12 13:50:11 +01:00
parent 1e4a4d48ae
commit 8dbe767340
3 changed files with 18 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.115 - Version 2.02.115 -
===================================== =====================================
Also notify lvmetad about filtered device if using pvscan --cache DevicePath.
Use LVM's own selection instead of awk expressions in clvmd startup scripts. Use LVM's own selection instead of awk expressions in clvmd startup scripts.
Do not filter out snapshot origin LVs as unusable devices for an LVM stack. Do not filter out snapshot origin LVs as unusable devices for an LVM stack.
Fix incorrect rimage names when converting from mirror to raid1 LV (2.02.112). Fix incorrect rimage names when converting from mirror to raid1 LV (2.02.112).

View File

@ -69,8 +69,12 @@ If lvmetad has not yet cached any metadata or the filters have recently been
changed, then all devices may be scanned, effectively ignoring the rest of changed, then all devices may be scanned, effectively ignoring the rest of
the command line. Otherwise, if all the devices referenced on the command line the command line. Otherwise, if all the devices referenced on the command line
contain metadata in the default lvm2 format, other devices are not accessed. contain metadata in the default lvm2 format, other devices are not accessed.
If metadata written using the obsolete GFS pool format is encountered, this is If metadata written using the obsolete GFS pool or lvm1 format is encountered,
ignored and so lvmetad should not be used. this is ignored and so lvmetad should not be used.
To notify lvmetad about a device that is not present in the system anymore,
\fB\-\-major\fP and \fB\-\-minor\fP pair of that device must be always supplied,
not \fBDevicePath\fP as pvscan is not able to translate the \fBDevicePath\fP
into major and minor pair which lvmetad requires.
.SH SEE ALSO .SH SEE ALSO
.BR lvm (8), .BR lvm (8),
.BR lvmetad (8), .BR lvmetad (8),

View File

@ -239,8 +239,17 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
if (pv_name[0] == '/') { if (pv_name[0] == '/') {
/* device path */ /* device path */
if (!(dev = dev_cache_get(pv_name, cmd->lvmetad_filter))) { if (!(dev = dev_cache_get(pv_name, cmd->lvmetad_filter))) {
if ((dev = dev_cache_get(pv_name, NULL))) {
if (!_clear_dev_from_lvmetad_cache(dev->dev, MAJOR(dev->dev), MINOR(dev->dev), handler)) {
stack;
ret = ECMD_FAILED;
break;
}
} else {
log_error("Physical Volume %s not found.", pv_name); log_error("Physical Volume %s not found.", pv_name);
ret = ECMD_FAILED; ret = ECMD_FAILED;
break;
}
continue; continue;
} }
} }