mirror of
git://sourceware.org/git/lvm2.git
synced 2025-08-02 04:22:02 +03:00
vgdisplay: select only active volumes groups if -A option is used
Where "active" means "at least one LV is active in the volume group".
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.105 -
|
Version 2.02.105 -
|
||||||
=====================================
|
=====================================
|
||||||
|
Select only active volume groups if vgdisplay -A is used.
|
||||||
Add -p and LVM_LVMETAD_PID env var to lvmetad to change pid file.
|
Add -p and LVM_LVMETAD_PID env var to lvmetad to change pid file.
|
||||||
Allow lvmetad to reuse stale socket.
|
Allow lvmetad to reuse stale socket.
|
||||||
Only unlink lvmetad socket on error if created by the same process.
|
Only unlink lvmetad socket on error if created by the same process.
|
||||||
|
@ -57,7 +57,8 @@ See \fBlvm\fP(8) for common options and \fBvgs\fP(8) for options given with
|
|||||||
\fB\-\-columns\fP.
|
\fB\-\-columns\fP.
|
||||||
.TP
|
.TP
|
||||||
.BR \-A ", " \-\-activevolumegroups
|
.BR \-A ", " \-\-activevolumegroups
|
||||||
Only select the active volume groups.
|
Only select the active volume groups. The volume group is considered active
|
||||||
|
if at least one of its logical volumes is active.
|
||||||
.TP
|
.TP
|
||||||
.BR \-c ", " \-\-colon
|
.BR \-c ", " \-\-colon
|
||||||
Generate colon separated output for easier parsing in scripts or programs.
|
Generate colon separated output for easier parsing in scripts or programs.
|
||||||
|
@ -100,3 +100,25 @@ not lvmchange
|
|||||||
not lvrename $vg
|
not lvrename $vg
|
||||||
not lvrename $vg-xxx
|
not lvrename $vg-xxx
|
||||||
not lvrename $vg $vg/$lv-rename $vg/$lv
|
not lvrename $vg $vg/$lv-rename $vg/$lv
|
||||||
|
|
||||||
|
#test vgdisplay -A to select only active VGs
|
||||||
|
# all LVs active - VG considered active
|
||||||
|
pvcreate -f $dev1 $dev2 $dev3
|
||||||
|
|
||||||
|
vgcreate $vg1 $dev1
|
||||||
|
lvcreate -l1 $vg1
|
||||||
|
lvcreate -l1 $vg1
|
||||||
|
|
||||||
|
# at least one LV active - VG considered active
|
||||||
|
vgcreate $vg2 $dev2
|
||||||
|
lvcreate -l1 $vg2
|
||||||
|
lvcreate -l1 $vg2
|
||||||
|
|
||||||
|
# no LVs active - VG considered inactive
|
||||||
|
vgcreate $vg3 $dev3
|
||||||
|
lvcreate -l1 -an -Zn $vg3
|
||||||
|
lvcreate -l1 -an -Zn $vg3
|
||||||
|
|
||||||
|
vgdisplay -s -A | grep $vg1
|
||||||
|
vgdisplay -s -A | grep $vg2
|
||||||
|
vgdisplay -s -A | not grep $vg3
|
||||||
|
@ -19,7 +19,9 @@ static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name,
|
|||||||
struct volume_group *vg,
|
struct volume_group *vg,
|
||||||
void *handle __attribute__((unused)))
|
void *handle __attribute__((unused)))
|
||||||
{
|
{
|
||||||
/* FIXME Do the active check here if activevolumegroups_ARG ? */
|
if (arg_count(cmd, activevolumegroups_ARG) && !lvs_in_vg_activated(vg))
|
||||||
|
return ECMD_PROCESSED;
|
||||||
|
|
||||||
vg_check_status(vg, EXPORTED_VG);
|
vg_check_status(vg, EXPORTED_VG);
|
||||||
|
|
||||||
if (arg_count(cmd, colon_ARG)) {
|
if (arg_count(cmd, colon_ARG)) {
|
||||||
|
Reference in New Issue
Block a user