mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Change pvscan --lvmetad to pvscan --cache.
This commit is contained in:
parent
7e35dfff3d
commit
d742cdf327
@ -51,8 +51,8 @@ an accurate (up to the data it has received) image of the VGs available in the
|
||||
system. I imagine we could extend the pvscan command (or add a new one, say
|
||||
lvmetad_client, if pvscan is found to be inappropriate):
|
||||
|
||||
$ pvscan --lvmetad /dev/foo
|
||||
$ pvscan --lvmetad --remove /dev/foo
|
||||
$ pvscan --cache /dev/foo
|
||||
$ pvscan --cache --remove /dev/foo
|
||||
|
||||
These commands would simply read the label and the MDA (if applicable) from the
|
||||
given PV and feed that data to the running lvmetad, using
|
||||
|
@ -32,11 +32,11 @@ LVM
|
||||
|
||||
For LVM, the crucial piece of the puzzle is lvmetad, which allows us to build up
|
||||
VGs from PVs as they appear, and at the same time collect information on what is
|
||||
already available. A command, pvscan --lvmetad is expected to be used to
|
||||
already available. A command, pvscan --cache is expected to be used to
|
||||
implement udev rules. It is relatively easy to make this command print out a
|
||||
list of VGs (and possibly LVs) that have been made available by adding any
|
||||
particular device to the set of visible devices. In othe words, udev says "hey,
|
||||
/dev/sdb just appeared", calls pvscan --lvmetad, which talks to lvmetad, which
|
||||
/dev/sdb just appeared", calls pvscan --cache, which talks to lvmetad, which
|
||||
says "cool, that makes vg0 complete". Pvscan takes this info and prints it out,
|
||||
and the udev rule can then somehow decide whether anything needs to be done
|
||||
about this "vg0". Presumably a table of devices that need to be activated
|
||||
|
2
lib/cache/lvmetad.c
vendored
2
lib/cache/lvmetad.c
vendored
@ -583,7 +583,7 @@ void lvmetad_set_active(int active)
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code implements pvscan --lvmetad.
|
||||
* The following code implements pvscan --cache.
|
||||
*/
|
||||
|
||||
struct _pvscan_lvmetad_baton {
|
||||
|
@ -60,7 +60,7 @@ static int _vsn1_check_version(const struct dm_config_tree *cft)
|
||||
const struct dm_config_node *cn;
|
||||
const struct dm_config_value *cv;
|
||||
|
||||
// TODO if this is pvscan --lvmetad, we want this check back.
|
||||
// TODO if this is pvscan --cache, we want this check back.
|
||||
if (lvmetad_active())
|
||||
return 1;
|
||||
|
||||
|
@ -3620,6 +3620,7 @@ static struct physical_volume *_pv_read(struct cmd_context *cmd,
|
||||
|
||||
if (lvmetad_active()) {
|
||||
info = lvmcache_info_from_pvid(dev->pvid, 0);
|
||||
// FIXME AGK no error unless 'warnings' set!
|
||||
if (!info && !lvmetad_pv_lookup_by_devt(cmd, dev->dev))
|
||||
return NULL;
|
||||
info = lvmcache_info_from_pvid(dev->pvid, 0);
|
||||
|
@ -3,6 +3,7 @@
|
||||
pvscan \- scan all disks for physical volumes
|
||||
.SH SYNOPSIS
|
||||
.B pvscan
|
||||
.RB [ \-\-cache " " DevicePath [ DevicePath ... ] ]
|
||||
.RB [ \-d | \-\-debug ]
|
||||
.RB [ \-h | \-\-help ]
|
||||
.RB [ \-v | \-\-verbose ]
|
||||
@ -12,7 +13,6 @@ pvscan \- scan all disks for physical volumes
|
||||
.RB [ \-n | \-\-novolumegroup ]
|
||||
.RB [ \-s | \-\-short ]
|
||||
.RB [ \-u | \-\-uuid ]
|
||||
.RB [ \-\-lvmetad " " DevicePath [ DevicePath ... ] ]
|
||||
.SH DESCRIPTION
|
||||
.B pvscan
|
||||
scans all supported LVM block devices in the system for physical volumes.
|
||||
@ -31,10 +31,10 @@ Short listing format.
|
||||
.BR \-u ", " \-\-uuid
|
||||
Show UUIDs (Uniform Unique Identifiers) in addition to device special names.
|
||||
.TP
|
||||
.BR \-\-lvmetad " " DevicePath [ DevicePath... ]
|
||||
Scan a single device and contact lvmetad to update its cached state. Called
|
||||
internally by udev rules. The device is processed \fBregardless\fP of any device
|
||||
filters set in lvm.conf.
|
||||
.BR \-\-cache " " DevicePath [ DevicePath... ]
|
||||
Scan a single device and instruct the lvmetad daemon to update its cached
|
||||
state. Called internally by udev rules. The device is processed
|
||||
\fBregardless\fP of any device filters set in lvm.conf.
|
||||
.SH SEE ALSO
|
||||
.BR lvm (8),
|
||||
.BR pvcreate (8),
|
||||
|
@ -80,7 +80,7 @@ prepare_lvmetad() {
|
||||
|
||||
notify_lvmetad() {
|
||||
if test -e LOCAL_LVMETAD; then
|
||||
pvscan --lvmetad "$@" || true
|
||||
pvscan --cache "$@" || true
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ arg(use_policies_ARG, '\0', "use-policies", NULL, 0)
|
||||
arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0)
|
||||
arg(config_ARG, '\0', "config", string_arg, 0)
|
||||
arg(trustcache_ARG, '\0', "trustcache", NULL, 0)
|
||||
arg(lvmetad_ARG, '\0', "lvmetad", NULL, 0)
|
||||
arg(cache_ARG, '\0', "cache", NULL, 0)
|
||||
arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0)
|
||||
arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0)
|
||||
arg(unquoted_ARG, '\0', "unquoted", NULL, 0)
|
||||
|
@ -663,6 +663,7 @@ xx(pvscan,
|
||||
"List all physical volumes",
|
||||
PERMITTED_READ_ONLY,
|
||||
"pvscan " "\n"
|
||||
"\t[--cache DevicePath [DevicePath...]] " "\n"
|
||||
"\t[-d|--debug] " "\n"
|
||||
"\t{-e|--exported | -n|--novolumegroup} " "\n"
|
||||
"\t[-h|-?|--help]" "\n"
|
||||
@ -670,12 +671,11 @@ xx(pvscan,
|
||||
"\t[-P|--partial] " "\n"
|
||||
"\t[-s|--short] " "\n"
|
||||
"\t[-u|--uuid] " "\n"
|
||||
"\t[--lvmetad DevicePath [DevicePath...]] " "\n"
|
||||
"\t[-v|--verbose] " "\n"
|
||||
"\t[--version]\n",
|
||||
|
||||
exported_ARG, ignorelockingfailure_ARG, novolumegroup_ARG, partial_ARG,
|
||||
short_ARG, uuid_ARG, lvmetad_ARG)
|
||||
cache_ARG, exported_ARG, ignorelockingfailure_ARG, novolumegroup_ARG,
|
||||
partial_ARG, short_ARG, uuid_ARG)
|
||||
|
||||
xx(segtypes,
|
||||
"List available segment types",
|
||||
|
@ -104,7 +104,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
|
||||
int ret = ECMD_PROCESSED;
|
||||
|
||||
if (!argc) {
|
||||
log_error("List of Physical Volumes to tell lvmetad to cache required.");
|
||||
log_error("List of Physical Volumes to be cached by the lvmetad daemon required.");
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ int pvscan(struct cmd_context *cmd, int argc, char **argv)
|
||||
pv_max_name_len = 0;
|
||||
vg_max_name_len = 0;
|
||||
|
||||
if (arg_count(cmd, lvmetad_ARG))
|
||||
if (arg_count(cmd, cache_ARG))
|
||||
return _pvscan_lvmetad(cmd, argc, argv);
|
||||
|
||||
if (arg_count(cmd, novolumegroup_ARG) && arg_count(cmd, exported_ARG)) {
|
||||
|
@ -20,6 +20,6 @@ SUBSYSTEM!="block", GOTO="lvm_end"
|
||||
KERNEL=="dm-[0-9]*", ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end"
|
||||
|
||||
# Only process devices already marked as a PV - this requires blkid to be called before.
|
||||
ENV{ID_FS_TYPE}=="LVM2_member|LVM1_member", RUN+="$env{DM_SBIN_PATH}/pvscan --lvmetad $major:$minor"
|
||||
ENV{ID_FS_TYPE}=="LVM2_member|LVM1_member", RUN+="$env{DM_SBIN_PATH}/pvscan --cache $major:$minor"
|
||||
|
||||
LABEL="lvm_end"
|
||||
|
Loading…
Reference in New Issue
Block a user