From d742cdf32713726d3c170c59846073d951a76a6f Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Fri, 2 Mar 2012 18:09:46 +0000 Subject: [PATCH] Change pvscan --lvmetad to pvscan --cache. --- doc/lvmetad_design.txt | 4 ++-- doc/udev_assembly.txt | 4 ++-- lib/cache/lvmetad.c | 2 +- lib/format_text/import_vsn1.c | 2 +- lib/metadata/metadata.c | 1 + man/pvscan.8.in | 10 +++++----- test/lib/aux.sh | 2 +- tools/args.h | 2 +- tools/commands.h | 6 +++--- tools/pvscan.c | 4 ++-- udev/69-dm-lvm-metad.rules | 2 +- 11 files changed, 20 insertions(+), 19 deletions(-) diff --git a/doc/lvmetad_design.txt b/doc/lvmetad_design.txt index 45e065160..3b336eced 100644 --- a/doc/lvmetad_design.txt +++ b/doc/lvmetad_design.txt @@ -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 diff --git a/doc/udev_assembly.txt b/doc/udev_assembly.txt index acf9d2c3f..618640273 100644 --- a/doc/udev_assembly.txt +++ b/doc/udev_assembly.txt @@ -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 diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c index b1e46041c..ca4e44eb1 100644 --- a/lib/cache/lvmetad.c +++ b/lib/cache/lvmetad.c @@ -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 { diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c index 046607a08..dff70f711 100644 --- a/lib/format_text/import_vsn1.c +++ b/lib/format_text/import_vsn1.c @@ -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; diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 90f48f7d5..d59211353 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -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); diff --git a/man/pvscan.8.in b/man/pvscan.8.in index 8d0126979..0b5ad7037 100644 --- a/man/pvscan.8.in +++ b/man/pvscan.8.in @@ -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), diff --git a/test/lib/aux.sh b/test/lib/aux.sh index 4ae596ddc..4543b413b 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -80,7 +80,7 @@ prepare_lvmetad() { notify_lvmetad() { if test -e LOCAL_LVMETAD; then - pvscan --lvmetad "$@" || true + pvscan --cache "$@" || true fi } diff --git a/tools/args.h b/tools/args.h index 1bd993d27..321f3f6fa 100644 --- a/tools/args.h +++ b/tools/args.h @@ -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) diff --git a/tools/commands.h b/tools/commands.h index 21f1adc16..073727f31 100644 --- a/tools/commands.h +++ b/tools/commands.h @@ -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", diff --git a/tools/pvscan.c b/tools/pvscan.c index 3a7c8ba9e..be5dc8496 100644 --- a/tools/pvscan.c +++ b/tools/pvscan.c @@ -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)) { diff --git a/udev/69-dm-lvm-metad.rules b/udev/69-dm-lvm-metad.rules index a4f52c3e0..e96c2c555 100644 --- a/udev/69-dm-lvm-metad.rules +++ b/udev/69-dm-lvm-metad.rules @@ -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"