*pv_max_name_len = 0;
dm_list_iterate_items(vginfo, &_vginfos) {
- len = strlen(vginfo->vgname);
- if (*vg_max_name_len < len)
- *vg_max_name_len = len;
+ if (!is_orphan_vg(vginfo->vgname)) {
+ len = strlen(vginfo->vgname);
+ if (*vg_max_name_len < len)
+ *vg_max_name_len = len;
+ }
dm_list_iterate_items(info, &vginfo->infos) {
len = strlen(dev_name(info->dev));
"Only select active VGs. The VG is considered active\n"
"if at least one of its LVs is active.\n")
+arg(allpvs_ARG, 'A', "allpvs", 0, 0, 0,
+ "#pvs\n"
+ "Show information about PVs outside the devices file.\n"
+ "Combine with with -a|--all to include devices that are not PVs.\n"
+ "#pvscan\n"
+ "Show information about PVs outside the devices file.\n"
+ "Displays the device ID for PVs included in the devices file.\n")
+
arg(background_ARG, 'b', "background", 0, 0, 0,
"If the operation requires polling, this option causes the command to\n"
"return before the operation is complete, and polling is done in the\n"
---
pvs
-OO: --segments, OO_REPORT
+OO: --segments, --allpvs, OO_REPORT
OP: PV|Tag ...
IO: --partial, --ignoreskippedcluster, --trustcache
ID: pvs_general
pvscan
OO: --ignorelockingfailure, --reportformat ReportFmt, --exported, --novolumegroup,
---short, --uuid
+--short, --uuid, --allpvs
ID: pvscan_display
DESC: Display PV information.
#include "lib/cache/lvmcache.h"
#include "lib/metadata/metadata.h"
#include "lib/label/hints.h"
+#include "lib/filters/filter.h"
#include "lib/device/online.h"
#include <dirent.h>
pv_len += suffix_len;
}
- if (is_orphan(pv))
+ if (arg_is_set(cmd, allpvs_ARG)) {
+ struct device *dev = pv->dev;
+ if (!cmd->enable_devices_file) {
+ if (is_orphan(pv)) {
+ log_print_unless_silent("PV %-*s %-*s",
+ pv_len, pvdevname,
+ params->vg_max_name_len, " ");
+ } else {
+ log_print_unless_silent("PV %-*s VG %-*s",
+ pv_len, pvdevname,
+ params->vg_max_name_len, pv_vg_name(pv));
+ }
+ } else if (!(dev->flags & DEV_MATCHED_USE_ID)) {
+ if (is_orphan(pv)) {
+ log_print_unless_silent("PV %-*s %-*s %-10s %s",
+ pv_len, pvdevname,
+ params->vg_max_name_len, " ",
+ "-", "-");
+ } else {
+ log_print_unless_silent("PV %-*s VG %-*s %-10s %s",
+ pv_len, pvdevname,
+ params->vg_max_name_len, pv_vg_name(pv),
+ "-", "-");
+ }
+ } else {
+ if (is_orphan(pv)) {
+ log_print_unless_silent("PV %-*s %-*s %-10s %s",
+ pv_len, pvdevname,
+ params->vg_max_name_len, " ",
+ idtype_to_str(dev->id->idtype),
+ dev->id->idname ?: "none");
+ } else {
+ log_print_unless_silent("PV %-*s VG %-*s %-10s %s",
+ pv_len, pvdevname,
+ params->vg_max_name_len, pv_vg_name(pv),
+ idtype_to_str(dev->id->idtype),
+ dev->id->idname ?: "none");
+ }
+ }
+ } else if (is_orphan(pv))
log_print_unless_silent("PV %-*s %-*s %s [%s]",
pv_len, pvdevname,
params->vg_max_name_len, " ",
arg_is_set(cmd, exported_ARG) ?
"of exported volume group(s)" : "in no volume group");
+ if (arg_is_set(cmd, allpvs_ARG)) {
+ cmd->filter_deviceid_skip = 1;
+ cmd->use_hints = 0;
+ }
+
if (!(handle = init_processing_handle(cmd, NULL))) {
log_error("Failed to initialize processing handle.");
ret = ECMD_FAILED;