mirror of
				git://sourceware.org/git/lvm2.git
				synced 2025-11-04 12:23:49 +03:00 
			
		
		
		
	Compare commits
	
		
			40 Commits
		
	
	
		
			dev-dct-cm
			...
			dev-dct-cm
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					7a62bdc68a | ||
| 
						 | 
					1bef87796f | ||
| 
						 | 
					cfbbb4bee9 | ||
| 
						 | 
					058b53cdf4 | ||
| 
						 | 
					2b8019fd43 | ||
| 
						 | 
					c213aa76c4 | ||
| 
						 | 
					15e69fae19 | ||
| 
						 | 
					fe0ad1157d | ||
| 
						 | 
					88a2b1dc37 | ||
| 
						 | 
					03970369c5 | ||
| 
						 | 
					c2147bda74 | ||
| 
						 | 
					a61bc922a9 | ||
| 
						 | 
					d41a2e6f30 | ||
| 
						 | 
					55d6e9ebb7 | ||
| 
						 | 
					0a61ea395f | ||
| 
						 | 
					e61f84cd1f | ||
| 
						 | 
					ca8e344041 | ||
| 
						 | 
					14838f584f | ||
| 
						 | 
					6033e894e2 | ||
| 
						 | 
					9b4c2027bf | ||
| 
						 | 
					61e0925844 | ||
| 
						 | 
					214f48aa96 | ||
| 
						 | 
					29ee87987c | ||
| 
						 | 
					2391324196 | ||
| 
						 | 
					e8230719ee | ||
| 
						 | 
					2c5f6b8a02 | ||
| 
						 | 
					fe3b2f5ead | ||
| 
						 | 
					91a1273d56 | ||
| 
						 | 
					5507307b5f | ||
| 
						 | 
					91b71a8b02 | ||
| 
						 | 
					3057fe9fec | ||
| 
						 | 
					258027d1b1 | ||
| 
						 | 
					2da0f6110d | ||
| 
						 | 
					09d6229350 | ||
| 
						 | 
					6312e0872c | ||
| 
						 | 
					c752f4e1eb | ||
| 
						 | 
					cd36b1c698 | ||
| 
						 | 
					310d9a09fd | ||
| 
						 | 
					81e84556b5 | ||
| 
						 | 
					c903d0e4b3 | 
@@ -1,14 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
 | 
			
		||||
 * Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of LVM2.
 | 
			
		||||
 *
 | 
			
		||||
 * This copyrighted material is made available to anyone wishing to use,
 | 
			
		||||
 * modify, copy, or redistribute it subject to the terms and conditions
 | 
			
		||||
 * of the GNU Lesser General Public License v.2.1.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public License
 | 
			
		||||
 * along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
@@ -46,6 +46,8 @@ MAN8GEN=lvm-config.8 lvm-dumpconfig.8 lvm-fullreport.8 lvm-lvpoll.8 \
 | 
			
		||||
	vgrename.8 vgs.8 vgscan.8 vgsplit.8 \
 | 
			
		||||
	lvmsar.8 lvmsadc.8 lvmdiskscan.8 lvmchange.8
 | 
			
		||||
 | 
			
		||||
MAN8+=$(MAN8GEN)
 | 
			
		||||
 | 
			
		||||
ifeq ($(MAKECMDGOALS),all_man)
 | 
			
		||||
  MAN_ALL="yes"
 | 
			
		||||
endif
 | 
			
		||||
@@ -115,8 +117,8 @@ MAN8DIR=$(mandir)/man8
 | 
			
		||||
 | 
			
		||||
include $(top_builddir)/make.tmpl
 | 
			
		||||
 | 
			
		||||
CLEAN_TARGETS+=$(MAN5) $(MAN7) $(MAN8) $(MAN8GEN) $(MAN8CLUSTER) \
 | 
			
		||||
	$(MAN8SYSTEMD_GENERATORS) $(MAN8DM) *.gen man-generator
 | 
			
		||||
CLEAN_TARGETS+=$(MAN5) $(MAN7) $(MAN8) $(MAN8CLUSTER) \
 | 
			
		||||
	$(MAN8SYSTEMD_GENERATORS) $(MAN8DM)
 | 
			
		||||
DISTCLEAN_TARGETS+=$(FSADMMAN) $(BLKDEACTIVATEMAN) $(DMEVENTDMAN) \
 | 
			
		||||
	$(LVMETADMAN) $(LVMPOLLDMAN) $(LVMLOCKDMAN) $(CLVMDMAN) $(CMIRRORDMAN) \
 | 
			
		||||
	$(LVMCACHEMAN) $(LVMTHINMAN) $(LVMDBUSDMAN) $(LVMRAIDMAN)
 | 
			
		||||
@@ -127,11 +129,11 @@ all: man device-mapper
 | 
			
		||||
 | 
			
		||||
device-mapper: $(MAN8DM)
 | 
			
		||||
 | 
			
		||||
man: $(MAN5) $(MAN7) $(MAN8) $(MAN8GEN) $(MAN8CLUSTER) $(MAN8SYSTEMD_GENERATORS)
 | 
			
		||||
man: $(MAN5) $(MAN7) $(MAN8) $(MAN8CLUSTER) $(MAN8SYSTEMD_GENERATORS)
 | 
			
		||||
 | 
			
		||||
all_man: man
 | 
			
		||||
 | 
			
		||||
$(MAN5) $(MAN7) $(MAN8) $(MAN8GEN) $(MAN8DM) $(MAN8CLUSTER):	Makefile
 | 
			
		||||
$(MAN5) $(MAN7) $(MAN8) $(MAN8DM) $(MAN8CLUSTER):	Makefile
 | 
			
		||||
 | 
			
		||||
Makefile: Makefile.in
 | 
			
		||||
	@:
 | 
			
		||||
@@ -142,15 +144,14 @@ Makefile: Makefile.in
 | 
			
		||||
	  *) echo "Creating $@" ; $(SED) -e "s+#VERSION#+$(LVM_VERSION)+;s+#DEFAULT_SYS_DIR#+$(DEFAULT_SYS_DIR)+;s+#DEFAULT_ARCHIVE_DIR#+$(DEFAULT_ARCHIVE_DIR)+;s+#DEFAULT_BACKUP_DIR#+$(DEFAULT_BACKUP_DIR)+;s+#DEFAULT_PROFILE_DIR#+$(DEFAULT_PROFILE_DIR)+;s+#DEFAULT_CACHE_DIR#+$(DEFAULT_CACHE_DIR)+;s+#DEFAULT_LOCK_DIR#+$(DEFAULT_LOCK_DIR)+;s+#CLVMD_PATH#+@CLVMD_PATH@+;s+#LVM_PATH#+@LVM_PATH@+;s+#DEFAULT_RUN_DIR#+@DEFAULT_RUN_DIR@+;s+#DEFAULT_PID_DIR#+@DEFAULT_PID_DIR@+;s+#SYSTEMD_GENERATOR_DIR#+$(SYSTEMD_GENERATOR_DIR)+;s+#DEFAULT_MANGLING#+$(DEFAULT_MANGLING)+;" $< > $@ ;; \
 | 
			
		||||
	esac
 | 
			
		||||
 | 
			
		||||
man-generator:
 | 
			
		||||
	$(CC) -DMAN_PAGE_GENERATOR -I$(top_builddir)/tools $(CFLAGS) $(top_srcdir)/tools/command.c -o $@
 | 
			
		||||
generator:
 | 
			
		||||
	$(CC) -DMAN_PAGE_GENERATOR $(top_builddir)/tools/command.c -o man-generator
 | 
			
		||||
 | 
			
		||||
$(MAN8GEN): man-generator
 | 
			
		||||
$(MAN8GEN): generator
 | 
			
		||||
	echo "Generating $@" ;
 | 
			
		||||
	./man-generator $(basename $@) > $@.gen
 | 
			
		||||
	if [ -f $(top_srcdir)/man/$@.end ]; then cat $(top_srcdir)/man/$@.end >> $@.gen; fi;
 | 
			
		||||
	cat $(top_srcdir)/man/see_also.end >> $@.gen
 | 
			
		||||
	$(SED) -e "s+#VERSION#+$(LVM_VERSION)+;s+#DEFAULT_SYS_DIR#+$(DEFAULT_SYS_DIR)+;s+#DEFAULT_ARCHIVE_DIR#+$(DEFAULT_ARCHIVE_DIR)+;s+#DEFAULT_BACKUP_DIR#+$(DEFAULT_BACKUP_DIR)+;s+#DEFAULT_PROFILE_DIR#+$(DEFAULT_PROFILE_DIR)+;s+#DEFAULT_CACHE_DIR#+$(DEFAULT_CACHE_DIR)+;s+#DEFAULT_LOCK_DIR#+$(DEFAULT_LOCK_DIR)+;s+#CLVMD_PATH#+@CLVMD_PATH@+;s+#LVM_PATH#+@LVM_PATH@+;s+#DEFAULT_RUN_DIR#+@DEFAULT_RUN_DIR@+;s+#DEFAULT_PID_DIR#+@DEFAULT_PID_DIR@+;s+#SYSTEMD_GENERATOR_DIR#+$(SYSTEMD_GENERATOR_DIR)+;s+#DEFAULT_MANGLING#+$(DEFAULT_MANGLING)+;" $@.gen > $@
 | 
			
		||||
	./man-generator `basename -s .8 $@` > $@.in
 | 
			
		||||
	if [ -f $@.notes ]; then cat $@.notes >> $@.in; fi;
 | 
			
		||||
	$(SED) -e "s+#VERSION#+$(LVM_VERSION)+;s+#DEFAULT_SYS_DIR#+$(DEFAULT_SYS_DIR)+;s+#DEFAULT_ARCHIVE_DIR#+$(DEFAULT_ARCHIVE_DIR)+;s+#DEFAULT_BACKUP_DIR#+$(DEFAULT_BACKUP_DIR)+;s+#DEFAULT_PROFILE_DIR#+$(DEFAULT_PROFILE_DIR)+;s+#DEFAULT_CACHE_DIR#+$(DEFAULT_CACHE_DIR)+;s+#DEFAULT_LOCK_DIR#+$(DEFAULT_LOCK_DIR)+;s+#CLVMD_PATH#+@CLVMD_PATH@+;s+#LVM_PATH#+@LVM_PATH@+;s+#DEFAULT_RUN_DIR#+@DEFAULT_RUN_DIR@+;s+#DEFAULT_PID_DIR#+@DEFAULT_PID_DIR@+;s+#SYSTEMD_GENERATOR_DIR#+$(SYSTEMD_GENERATOR_DIR)+;s+#DEFAULT_MANGLING#+$(DEFAULT_MANGLING)+;" $@.in > $@
 | 
			
		||||
 | 
			
		||||
install_man5: $(MAN5)
 | 
			
		||||
	$(INSTALL) -d $(MAN5DIR)
 | 
			
		||||
@@ -163,7 +164,6 @@ install_man7: $(MAN7)
 | 
			
		||||
install_man8: $(MAN8) $(MAN8GEN)
 | 
			
		||||
	$(INSTALL) -d $(MAN8DIR)
 | 
			
		||||
	$(INSTALL_DATA) $(MAN8) $(MAN8DIR)/
 | 
			
		||||
	$(INSTALL_DATA) $(MAN8GEN) $(MAN8DIR)/
 | 
			
		||||
 | 
			
		||||
install_lvm2: install_man5 install_man7 install_man8
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,2 +0,0 @@
 | 
			
		||||
lvchange changes LV attributes in the VG, changes LV activation in the
 | 
			
		||||
kernel, and includes other utilities for LV maintenance.
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
.EXAMPLES
 | 
			
		||||
 | 
			
		||||
Change LV permission to read-only:
 | 
			
		||||
.sp
 | 
			
		||||
.B lvchange \-pr vg00/lvol1
 | 
			
		||||
 | 
			
		||||
@@ -1,53 +0,0 @@
 | 
			
		||||
lvconvert changes the LV type and includes utilities for LV data
 | 
			
		||||
maintenance. The LV type controls data layout and redundancy.
 | 
			
		||||
The LV type is also called the segment type or segtype.
 | 
			
		||||
 | 
			
		||||
To display the current LV type, run the command:
 | 
			
		||||
 | 
			
		||||
.B lvs \-o name,segtype
 | 
			
		||||
.I LV
 | 
			
		||||
 | 
			
		||||
A command to change the LV type uses the general pattern:
 | 
			
		||||
 | 
			
		||||
.B lvconvert \-\-type
 | 
			
		||||
.I NewType LV
 | 
			
		||||
 | 
			
		||||
LVs with the following types can be modified by lvconvert:
 | 
			
		||||
.B striped,
 | 
			
		||||
.B snapshot,
 | 
			
		||||
.B mirror,
 | 
			
		||||
.B raid*,
 | 
			
		||||
.B thin,
 | 
			
		||||
.B cache,
 | 
			
		||||
.B thin\-pool,
 | 
			
		||||
.B cache\-pool.
 | 
			
		||||
 | 
			
		||||
The
 | 
			
		||||
.B linear
 | 
			
		||||
type is equivalent to the
 | 
			
		||||
.B striped
 | 
			
		||||
type when one stripe exists.
 | 
			
		||||
In that case, the types can sometimes be used interchangably.
 | 
			
		||||
 | 
			
		||||
In most cases, the
 | 
			
		||||
.B mirror
 | 
			
		||||
type is deprecated and the
 | 
			
		||||
.B raid1
 | 
			
		||||
type should be used.  They are both implementations of mirroring.
 | 
			
		||||
 | 
			
		||||
The
 | 
			
		||||
.B raid*
 | 
			
		||||
type refers to one of many raid levels, e.g.
 | 
			
		||||
.B raid1,
 | 
			
		||||
.B raid5.
 | 
			
		||||
 | 
			
		||||
In some cases, an LV is a single device mapper (dm) layer above physical
 | 
			
		||||
devices.  In other cases, hidden LVs (dm devices) are layered between the
 | 
			
		||||
visible LV and physical devices.  LVs in the middle layers are called sub LVs.
 | 
			
		||||
A command run on a visible LV sometimes operates on a sub LV rather than
 | 
			
		||||
the specified LV.  In other cases, a sub LV must be specified directly on
 | 
			
		||||
the command line.
 | 
			
		||||
 | 
			
		||||
Sub LVs can be displayed with the command
 | 
			
		||||
.B lvs -a
 | 
			
		||||
 | 
			
		||||
@@ -1,95 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Convert a linear LV to a two-way mirror LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-type mirror \-\-mirrors 1 vg/lvol1
 | 
			
		||||
 | 
			
		||||
Convert a linear LV to a two-way RAID1 LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-type raid1 \-\-mirrors 1 vg/lvol1
 | 
			
		||||
 | 
			
		||||
Convert a mirror LV to use an in\-memory log:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-mirrorlog core vg/lvol1
 | 
			
		||||
 | 
			
		||||
Convert a mirror LV to use a disk log:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-mirrorlog disk vg/lvol1
 | 
			
		||||
 | 
			
		||||
Convert a mirror or raid1 LV to a linear LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert --type linear vg/lvol1
 | 
			
		||||
 | 
			
		||||
Convert a mirror LV to a raid1 LV with the same number of images:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-type raid1 vg/lvol1
 | 
			
		||||
 | 
			
		||||
Convert a linear LV to a two-way mirror LV, allocating new extents from specific
 | 
			
		||||
PV ranges:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-mirrors 1 vg/lvol1 /dev/sda:0\-15 /dev/sdb:0\-15
 | 
			
		||||
 | 
			
		||||
Convert a mirror LV to a linear LV, freeing physical extents from a specific PV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-type linear vg/lvol1 /dev/sda
 | 
			
		||||
 | 
			
		||||
Split one image from a mirror or raid1 LV, making it a new LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-splitmirrors 1 \-\-name lv_split vg/lvol1
 | 
			
		||||
 | 
			
		||||
Split one image from a raid1 LV, and track changes made to the raid1 LV
 | 
			
		||||
while the split image remains detached:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-splitmirrors 1 \-\-trackchanges vg/lvol1
 | 
			
		||||
 | 
			
		||||
Merge an image (that was previously created with \-\-splitmirrors and
 | 
			
		||||
\-\-trackchanges) back into the original raid1 LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-mergemirrors vg/lvol1_rimage_1
 | 
			
		||||
 | 
			
		||||
Replace PV /dev/sdb1 with PV /dev/sdf1 in a raid1/4/5/6/10 LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-replace /dev/sdb1 vg/lvol1 /dev/sdf1
 | 
			
		||||
 | 
			
		||||
Replace 3 PVs /dev/sd[b-d]1 with PVs /dev/sd[f-h]1 in a raid1 LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-replace /dev/sdb1 \-\-replace /dev/sdc1 \-\-replace /dev/sdd1
 | 
			
		||||
.RS
 | 
			
		||||
.B vg/lvol1 /dev/sd[fgh]1
 | 
			
		||||
.RE
 | 
			
		||||
 | 
			
		||||
Replace the maximum of 2 PVs /dev/sd[bc]1 with PVs /dev/sd[gh]1 in a raid6 LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-replace /dev/sdb1 \-\-replace /dev/sdc1 vg/lvol1 /dev/sd[gh]1
 | 
			
		||||
 | 
			
		||||
Convert an LV into a thin LV in the specified thin pool.  The existing LV
 | 
			
		||||
is used as an external read\-only origin for the new thin LV.
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-type thin \-\-thinpool vg/tpool1 vg/lvol1
 | 
			
		||||
 | 
			
		||||
Convert an LV into a thin LV in the specified thin pool.  The existing LV
 | 
			
		||||
is used as an external read\-only origin for the new thin LV, and is
 | 
			
		||||
renamed "external":
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-type thin \-\-thinpool vg/tpool1
 | 
			
		||||
.RS
 | 
			
		||||
.B \-\-originname external vg/lvol1
 | 
			
		||||
.RE
 | 
			
		||||
 | 
			
		||||
Convert an LV to a cache pool LV using another specified LV for cache pool
 | 
			
		||||
metadata:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-type cache-pool \-\-poolmetadata vg/poolmeta1 vg/lvol1
 | 
			
		||||
 | 
			
		||||
Convert an LV to a cache LV using the specified cache pool and chunk size:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-type cache \-\-cachepool vg/cpool1 \-c 128 vg/lvol1
 | 
			
		||||
 | 
			
		||||
Detach and keep the cache pool from a cache LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-splitcache vg/lvol1
 | 
			
		||||
 | 
			
		||||
Detach and remove the cache pool from a cache LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvconvert \-\-uncache vg/lvol1
 | 
			
		||||
 | 
			
		||||
@@ -1,28 +0,0 @@
 | 
			
		||||
lvcreate creates a new LV in a VG. For standard LVs, this requires
 | 
			
		||||
allocating logical extents from the VG's free physical extents. If there
 | 
			
		||||
is not enough free space, then the VG can be extended (see
 | 
			
		||||
\fBvgextend\fP(8)) with other PVs, or existing LVs can be reduced or
 | 
			
		||||
removed (see \fBlvremove\fP, \fBlvreduce\fP.)
 | 
			
		||||
 | 
			
		||||
To control which PVs a new LV will use, specify one or more PVs as
 | 
			
		||||
position args at the end of the command line. lvcreate will allocate
 | 
			
		||||
physical extents only from the specified PVs.
 | 
			
		||||
 | 
			
		||||
lvcreate can also create snapshots of existing LVs, e.g. for backup
 | 
			
		||||
purposes. The data in a new snapshot LV represents the content of the
 | 
			
		||||
original LV from the time the snapshot was created.
 | 
			
		||||
 | 
			
		||||
RAID LVs can be created by specifying an LV type when creating the LV (see
 | 
			
		||||
\fBlvmraid\fP(7)). Different RAID levels require different numbers of
 | 
			
		||||
unique PVs be available in the VG for allocation.
 | 
			
		||||
 | 
			
		||||
Thin pools (for thin provisioning) and cache pools (for caching) are
 | 
			
		||||
represented by special LVs with types thin-pool and cache-pool (see
 | 
			
		||||
\fBlvmthin\fP(7) and \fBlvmcache\fP(7)). The pool LVs are not usable as
 | 
			
		||||
standard block devices, but the LV names act references to the pools.
 | 
			
		||||
 | 
			
		||||
Thin LVs are thinly provisioned from a thin pool, and are created with a
 | 
			
		||||
virtual size rather than a physical size. A cache LV is the combination of
 | 
			
		||||
a standard LV with a cache pool, used to cache active portions of the LV
 | 
			
		||||
to improve performance.
 | 
			
		||||
 | 
			
		||||
@@ -1,98 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Create a striped LV with 3 stripes, a stripe size of 8KiB and a size of 100MiB.
 | 
			
		||||
The LV name is chosen by lvcreate.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-i 3 \-I 8 \-L 100m vg00
 | 
			
		||||
 | 
			
		||||
Create a raid1 LV with two images, and a useable size of 500 MiB. This
 | 
			
		||||
operation requires two devices, one for each mirror image. RAID metadata
 | 
			
		||||
(superblock and bitmap) is also included on the two devices.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-type raid1 \-m1 \-L 500m \-n mylv vg00
 | 
			
		||||
 | 
			
		||||
Create a mirror LV with two images, and a useable size of 500 MiB.
 | 
			
		||||
This operation requires three devices: two for mirror images and
 | 
			
		||||
one for a disk log.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-type mirror \-m1 \-L 500m \-n mylv vg00
 | 
			
		||||
 | 
			
		||||
Create a mirror LV with 2 images, and a useable size of 500 MiB.
 | 
			
		||||
This operation requires 2 devices because the log is in memory.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-type mirror \-m1 \-\-mirrorlog core \-L 500m \-n mylv vg00
 | 
			
		||||
 | 
			
		||||
Create a copy\-on\-write snapshot of an LV:
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-snapshot \-\-size 100m \-\-name mysnap vg00/mylv
 | 
			
		||||
 | 
			
		||||
Create a copy\-on\-write snapshot with a size sufficient
 | 
			
		||||
for overwriting 20% of the size of the original LV.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-s \-l 20%ORIGIN \-n mysnap vg00/mylv
 | 
			
		||||
 | 
			
		||||
Create a sparse LV with 1TiB of virtual space, and actual space just under
 | 
			
		||||
100MiB.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-snapshot \-\-virtualsize 1t \-\-size 100m \-\-name mylv vg00
 | 
			
		||||
 | 
			
		||||
Create a linear LV with a usable size of 64MiB on specific physical extents.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-L 64m \-n mylv vg00 /dev/sda:0\-7 /dev/sdb:0\-7
 | 
			
		||||
 | 
			
		||||
Create a RAID5 LV with a usable size of 5GiB, 3 stripes, a stripe size of
 | 
			
		||||
64KiB, using a total of 4 devices (including one for parity).
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-type raid5 \-L 5G \-i 3 \-I 64 \-n mylv vg00
 | 
			
		||||
 | 
			
		||||
Create a RAID5 LV using all of the free space in the VG and spanning all the
 | 
			
		||||
PVs in the VG (note that the command will fail if there are more than 8 PVs in
 | 
			
		||||
the VG, in which case \fB\-i 7\fP must be used to get to the current maximum of
 | 
			
		||||
8 devices including parity for RaidLVs).
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-config allocation/raid_stripe_all_devices=1
 | 
			
		||||
.RS
 | 
			
		||||
.B \-\-type raid5 \-l 100%FREE \-n mylv vg00
 | 
			
		||||
.RE
 | 
			
		||||
 | 
			
		||||
Create RAID10 LV with a usable size of 5GiB, using 2 stripes, each on
 | 
			
		||||
a two-image mirror. (Note that the \fB-i\fP and \fB-m\fP arguments behave
 | 
			
		||||
differently:
 | 
			
		||||
\fB-i\fP specifies the total number of stripes,
 | 
			
		||||
but \fB-m\fP specifies the number of images in addition
 | 
			
		||||
to the first image).
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-type raid10 \-L 5G \-i 2 \-m 1 \-n mylv vg00
 | 
			
		||||
 | 
			
		||||
Create a 1TiB thin LV, first creating a new thin pool for it, where
 | 
			
		||||
the thin pool has 100MiB of space, uses 2 stripes, has a 64KiB stripe
 | 
			
		||||
size, and 256KiB chunk size.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-type thin \-\-name mylv \-\-thinpool mypool
 | 
			
		||||
.RS
 | 
			
		||||
.B \-V 1t \-L 100m \-i 2 \-I 64 \-c 256 vg00
 | 
			
		||||
.RE
 | 
			
		||||
 | 
			
		||||
Create a thin snapshot of a thin LV (the size option must not be
 | 
			
		||||
used, otherwise a copy-on-write snapshot would be created).
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-snapshot \-\-name mysnap vg00/thinvol
 | 
			
		||||
 | 
			
		||||
Create a thin snapshot of the read-only inactive LV named "origin"
 | 
			
		||||
which becomes an external origin for the thin snapshot LV.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-snapshot \-\-name mysnap \-\-thinpool mypool vg00/origin
 | 
			
		||||
 | 
			
		||||
Create a cache pool from a fast physical device. The cache pool can
 | 
			
		||||
then be used to cache an LV.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-type cache-pool \-L 1G \-n my_cpool vg00 /dev/fast1
 | 
			
		||||
 | 
			
		||||
Create a cache LV, first creating a new origin LV on a slow physical device,
 | 
			
		||||
then combining the new origin LV with an existing cache pool.
 | 
			
		||||
.br
 | 
			
		||||
.B lvcreate \-\-type cache \-\-cachepool my_cpool
 | 
			
		||||
.RS
 | 
			
		||||
.B \-L 100G \-n mylv vg00 /dev/slow1
 | 
			
		||||
.RE
 | 
			
		||||
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
lvdisplay shows the attributes of LVs, like size, read/write status,
 | 
			
		||||
snapshot information, etc.
 | 
			
		||||
 | 
			
		||||
\fBlvs\fP(8) is a preferred alternative that shows the same information
 | 
			
		||||
and more, using a more compact and configurable output format.
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
lvextend extends the size of an LV. This requires allocating logical
 | 
			
		||||
extents from the VG's free physical extents. A copy\-on\-write snapshot LV
 | 
			
		||||
can also be extended to provide more space to hold COW blocks. Use
 | 
			
		||||
\fBlvconvert\fP(8) to change the number of data images in a RAID or
 | 
			
		||||
mirrored LV.
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Extend the size of an LV by 54MiB, using a specific PV.
 | 
			
		||||
.br
 | 
			
		||||
.B lvextend \-L +54 vg01/lvol10 /dev/sdk3
 | 
			
		||||
 | 
			
		||||
Extend the size of an LV by the amount of free
 | 
			
		||||
space on PV /dev/sdk3. This is equivalent to specifying
 | 
			
		||||
"\-l +100%PVS" on the command line.
 | 
			
		||||
.br
 | 
			
		||||
.B lvextend vg01/lvol01 /dev/sdk3
 | 
			
		||||
 | 
			
		||||
Extend an LV by 16MiB using specific physical extents.
 | 
			
		||||
.br
 | 
			
		||||
.B lvextend \-L+16m vg01/lvol01 /dev/sda:8\-9 /dev/sdb:8\-9
 | 
			
		||||
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
lvm fullreport produces formatted output about PVs, PV segments, VGs, LVs
 | 
			
		||||
and LV segments. The information is all gathered together for each VG
 | 
			
		||||
(under a per-VG lock) so it is consistent. Information gathered from
 | 
			
		||||
separate calls to \fBvgs\fP, \fBpvs\fP, and \fBlvs\fP can be inconsistent
 | 
			
		||||
if information changes between commands.
 | 
			
		||||
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
lvm lvpoll is an internal command used by \fBlvmpolld\fP(8) to monitor and
 | 
			
		||||
complete \fBlvconvert\fP(8) and \fBpvmove\fP(8) operations. lvpoll itself
 | 
			
		||||
does not initiate these operations and should not normally need to be run
 | 
			
		||||
directly.
 | 
			
		||||
@@ -1,34 +0,0 @@
 | 
			
		||||
.SH NOTES
 | 
			
		||||
 | 
			
		||||
.IP \[bu] 3
 | 
			
		||||
To find the name of the pvmove LV that was created by an original
 | 
			
		||||
\fBpvmove /dev/name\fP command, use the command:
 | 
			
		||||
.br
 | 
			
		||||
\fBlvs -a -S move_pv=/dev/name\fP.
 | 
			
		||||
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Continue polling a pvmove operation:
 | 
			
		||||
.br
 | 
			
		||||
.B lvm lvpoll --polloperation pvmove vg00/pvmove0
 | 
			
		||||
 | 
			
		||||
Abort a pvmove operation:
 | 
			
		||||
.br
 | 
			
		||||
.B lvm lvpoll --polloperation pvmove --abort vg00/pvmove0
 | 
			
		||||
 | 
			
		||||
Continue polling a mirror conversion:
 | 
			
		||||
.br
 | 
			
		||||
.B lvm lvpoll --polloperation convert vg00/lvmirror
 | 
			
		||||
 | 
			
		||||
Continue mirror repair:
 | 
			
		||||
.br
 | 
			
		||||
.B lvm lvpoll --polloperation convert vg/damaged_mirror --handlemissingpvs
 | 
			
		||||
 | 
			
		||||
Continue snapshot merge:
 | 
			
		||||
.br
 | 
			
		||||
.B lvm lvpoll --polloperation merge vg/snapshot_old
 | 
			
		||||
 | 
			
		||||
Continue thin snapshot merge:
 | 
			
		||||
.br
 | 
			
		||||
.B lvm lvpoll --polloperation merge_thin vg/thin_snapshot
 | 
			
		||||
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
lvmconfig produces formatted output from the LVM configuration tree. The
 | 
			
		||||
sources of the configuration data include \fBlvm.conf\fP(5) and command
 | 
			
		||||
line settings from \-\-config.
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
lvmdiskscan scans all SCSI, (E)IDE disks, multiple devices and a bunch of
 | 
			
		||||
other block devices in the system looking for LVM PVs. The size reported
 | 
			
		||||
is the real device size. Define a filter in \fBlvm.conf\fP(5) to restrict
 | 
			
		||||
the scan to avoid a CD ROM, for example.
 | 
			
		||||
 | 
			
		||||
This command is deprecated, use \fBpvs\fP instead.
 | 
			
		||||
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
lvreduce reduces the size of an LV. The freed logical extents are returned
 | 
			
		||||
to the VG to be used by other LVs. A copy\-on\-write snapshot LV can also
 | 
			
		||||
be reduced if less space is needed to hold COW blocks. Use
 | 
			
		||||
\fBlvconvert\fP(8) to change the number of data images in a RAID or
 | 
			
		||||
mirrored LV.
 | 
			
		||||
 | 
			
		||||
Be careful when reducing an LV's size, because data in the reduced area is
 | 
			
		||||
lost. Ensure that any file system on the LV is resized \fBbefore\fP
 | 
			
		||||
running lvreduce so that the removed extents are not in use by the file
 | 
			
		||||
system.
 | 
			
		||||
 | 
			
		||||
Sizes will be rounded if necessary. For example, the LV size must be an
 | 
			
		||||
exact number of extents, and the size of a striped segment must be a
 | 
			
		||||
multiple of the number of stripes.
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Reduce the size of an LV by 3 logical extents:
 | 
			
		||||
.br
 | 
			
		||||
.B lvreduce \-l \-3 vg00/lvol1
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
lvremove removes one or more LVs. For standard LVs, this returns the
 | 
			
		||||
logical extents that were used by the LV to the VG for use by other LVs.
 | 
			
		||||
 | 
			
		||||
Confirmation will be requested before deactivating any active LV prior to
 | 
			
		||||
removal.  LVs cannot be deactivated or removed while they are open (e.g.
 | 
			
		||||
if they contain a mounted filesystem). Removing an origin LV will also
 | 
			
		||||
remove all dependent snapshots.
 | 
			
		||||
 | 
			
		||||
\fBHistorical LVs\fP
 | 
			
		||||
 | 
			
		||||
If the configuration setting \fBmetadata/record_lvs_history\fP is enabled
 | 
			
		||||
and the LV being removed forms part of the history of at least one LV that
 | 
			
		||||
is still present, then a simplified representation of the LV will be
 | 
			
		||||
retained. This includes the time of removal (\fBlv_time_removed\fP
 | 
			
		||||
reporting field), creation time (\fBlv_time\fP), name (\fBlv_name\fP), LV
 | 
			
		||||
uuid (\fBlv_uuid\fP) and VG name (\fBvg_name\fP). This allows later
 | 
			
		||||
reporting to see the ancestry chain of thin snapshot volumes, even after
 | 
			
		||||
some intermediate LVs have been removed. The names of such historical LVs
 | 
			
		||||
acquire a hyphen as a prefix (e.g. '-lvol1') and cannot be reactivated.
 | 
			
		||||
Use lvremove a second time, with the hyphen, to remove the record of the
 | 
			
		||||
former LV completely.
 | 
			
		||||
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Remove an active LV without asking for confirmation.
 | 
			
		||||
.br
 | 
			
		||||
.B lvremove \-f vg00/lvol1
 | 
			
		||||
 | 
			
		||||
Remove all LVs the specified VG.
 | 
			
		||||
.br
 | 
			
		||||
.B lvremove vg00
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1,2 +0,0 @@
 | 
			
		||||
lvrename renames an existing LV or a historical LV (see \fBlvremove\fP for
 | 
			
		||||
historical LV information.)
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Rename "lvold" to "lvnew":
 | 
			
		||||
.br
 | 
			
		||||
.B lvrename /dev/vg02/lvold vg02/lvnew
 | 
			
		||||
 | 
			
		||||
An alternate syntax to rename "lvold" to "lvnew":
 | 
			
		||||
.br
 | 
			
		||||
.B lvrename vg02 lvold lvnew
 | 
			
		||||
 | 
			
		||||
@@ -1,2 +0,0 @@
 | 
			
		||||
lvresize resizes an LV in the same way as lvextend and lvreduce. See
 | 
			
		||||
\fBlvextend\fP(8) and \fBlvreduce\fP(8) for more information.
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Extend an LV by 16MB using specific physical extents:
 | 
			
		||||
.br
 | 
			
		||||
.B lvresize \-L+16M vg1/lv1 /dev/sda:0\-1 /dev/sdb:0\-1
 | 
			
		||||
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
lvs produces formatted output about LVs.
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
lvscan scans all VGs or all supported LVM block devices in the system for
 | 
			
		||||
LVs. The output consists of one line for each LV indicating whether or not
 | 
			
		||||
it is active, a snapshot or origin, the size of the device and its
 | 
			
		||||
allocation policy. Use \fBlvs\fP(8) or \fBlvdisplay\fP(8) to obtain more
 | 
			
		||||
comprehensive information about LVs.
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
pvchange changes PV attributes in the VG.
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Disallow the allocation of physical extents on a PV (e.g. because of
 | 
			
		||||
disk errors, or because it will be removed after freeing it).
 | 
			
		||||
.br
 | 
			
		||||
.B pvchange \-x n /dev/sdk1
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
pvck checks the LVM metadata for consistency on PVs.
 | 
			
		||||
@@ -1,8 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
If the partition table is corrupted or lost on /dev/sda, and you suspect
 | 
			
		||||
there was an LVM partition at approximately 100 MiB, then this
 | 
			
		||||
area of the disk can be scanned using the \fB\-\-labelsector\fP
 | 
			
		||||
parameter with a value of 204800 (100 * 1024 * 1024 / 512 = 204800).
 | 
			
		||||
.br
 | 
			
		||||
.B pvck \-\-labelsector 204800 /dev/sda
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
pvcreate initializes a PV so that it is recognized as belonging to LVM,
 | 
			
		||||
and allows the PV to be used in a VG. A PV can be a disk partition, whole
 | 
			
		||||
disk, meta device, or loopback file.
 | 
			
		||||
 | 
			
		||||
For DOS disk partitions, the partition id should be set to 0x8e using
 | 
			
		||||
.BR fdisk (8),
 | 
			
		||||
.BR cfdisk (8),
 | 
			
		||||
or a equivalent. For GUID Partition Table (GPT), the id is
 | 
			
		||||
E6D6D379-F507-44C2-A23C-238F2A3DF928. For
 | 
			
		||||
whole disk devices only
 | 
			
		||||
the partition table must be erased, which will effectively destroy all
 | 
			
		||||
data on that disk. This can be done by zeroing the first sector with:
 | 
			
		||||
 | 
			
		||||
.BI "dd if=/dev/zero of=" PhysicalVolume " bs=512 count=1"
 | 
			
		||||
 | 
			
		||||
Use \fBvgcreate\fP(8) to create a new VG on the PV, or \fBvgextend\fP(8)
 | 
			
		||||
to add the PV to existing VG.
 | 
			
		||||
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Initialize a partition and a full device.
 | 
			
		||||
.br
 | 
			
		||||
.B pvcreate /dev/sdc4 /dev/sde
 | 
			
		||||
 | 
			
		||||
If a device is a 4KiB sector drive that compensates for windows
 | 
			
		||||
partitioning (sector 7 is the lowest aligned logical block, the 4KiB
 | 
			
		||||
sectors start at LBA -1, and consequently sector 63 is aligned on a 4KiB
 | 
			
		||||
boundary) manually account for this when initializing for use by LVM.
 | 
			
		||||
.br
 | 
			
		||||
.B pvcreate \-\-dataalignmentoffset 7s /dev/sdb
 | 
			
		||||
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
pvdisplay shows the attributes of PVs, like size, physical extent size,
 | 
			
		||||
space used for the VG descriptor area, etc.
 | 
			
		||||
 | 
			
		||||
\fBpvs\fP(8) is a preferred alternative that shows the same information
 | 
			
		||||
and more, using a more compact and configurable output format.
 | 
			
		||||
@@ -45,49 +45,3 @@ LVs are removed, leaving behind the segments on the destination PV.  If an
 | 
			
		||||
abort is issued during the move, all LVs being moved will remain on the
 | 
			
		||||
source PV.
 | 
			
		||||
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Move all physical extents that are used by simple LVs on the specified PV to
 | 
			
		||||
free physical extents elsewhere in the VG.
 | 
			
		||||
.br
 | 
			
		||||
.B pvmove /dev/sdb1
 | 
			
		||||
 | 
			
		||||
Use a specific destination PV when moving physical extents.
 | 
			
		||||
.br
 | 
			
		||||
.B pvmove /dev/sdb1 /dev/sdc1
 | 
			
		||||
 | 
			
		||||
Move extents belonging to a single LV.
 | 
			
		||||
.br
 | 
			
		||||
.B pvmove \-n lvol1 /dev/sdb1 /dev/sdc1
 | 
			
		||||
 | 
			
		||||
Rather than moving the contents of an entire device, it is possible to
 | 
			
		||||
move a range of physical extents, for example numbers 1000 to 1999
 | 
			
		||||
inclusive on the specified PV.
 | 
			
		||||
.br
 | 
			
		||||
.B pvmove /dev/sdb1:1000\-1999
 | 
			
		||||
 | 
			
		||||
A range of physical extents to move can be specified as start+length. For
 | 
			
		||||
example, starting from PE 1000. (Counting starts from 0, so this refers to the
 | 
			
		||||
1001st to the 2000th PE inclusive.)
 | 
			
		||||
.br
 | 
			
		||||
.B pvmove /dev/sdb1:1000+1000
 | 
			
		||||
 | 
			
		||||
Move a range of physical extents to a specific PV (which must have
 | 
			
		||||
sufficient free extents).
 | 
			
		||||
.br
 | 
			
		||||
.B pvmove /dev/sdb1:1000\-1999 /dev/sdc1
 | 
			
		||||
 | 
			
		||||
Move a range of physical extents to specific new extents on a new PV.
 | 
			
		||||
.br
 | 
			
		||||
.B pvmove /dev/sdb1:1000\-1999 /dev/sdc1:0\-999
 | 
			
		||||
 | 
			
		||||
If the source and destination are on the same disk, the
 | 
			
		||||
\fBanywhere\fP allocation policy is needed.
 | 
			
		||||
.br
 | 
			
		||||
.B pvmove \-\-alloc anywhere /dev/sdb1:1000\-1999 /dev/sdb1:0\-999
 | 
			
		||||
 | 
			
		||||
The part of a specific LV present within in a range of physical
 | 
			
		||||
extents can also be picked out and moved.
 | 
			
		||||
.br
 | 
			
		||||
.B pvmove \-n lvol1 /dev/sdb1:1000\-1999 /dev/sdc1
 | 
			
		||||
 | 
			
		||||
@@ -1,17 +0,0 @@
 | 
			
		||||
.SH NOTES
 | 
			
		||||
 | 
			
		||||
.IP \[bu] 3
 | 
			
		||||
pvresize will refuse to shrink a PV if it has allocated extents beyond the
 | 
			
		||||
new end.
 | 
			
		||||
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Expand a PV after enlarging the partition.
 | 
			
		||||
.br
 | 
			
		||||
.B pvresize /dev/sda1
 | 
			
		||||
 | 
			
		||||
Shrink a PV prior to shrinking the partition (ensure that the PV size is
 | 
			
		||||
appropriate for the intended new partition size).
 | 
			
		||||
.br
 | 
			
		||||
.B pvresize \-\-setphysicalvolumesize 40G /dev/sda1
 | 
			
		||||
 | 
			
		||||
@@ -1,67 +0,0 @@
 | 
			
		||||
.SH SEE ALSO
 | 
			
		||||
 | 
			
		||||
.BR lvm (8)
 | 
			
		||||
.BR lvm.conf (5)
 | 
			
		||||
.BR lvmconfig (8)
 | 
			
		||||
 | 
			
		||||
.BR pvchange (8)
 | 
			
		||||
.BR pvck (8)
 | 
			
		||||
.BR pvcreate (8)
 | 
			
		||||
.BR pvdisplay (8)
 | 
			
		||||
.BR pvmove (8)
 | 
			
		||||
.BR pvremove (8)
 | 
			
		||||
.BR pvresize (8)
 | 
			
		||||
.BR pvs (8)
 | 
			
		||||
.BR pvscan (8) 
 | 
			
		||||
 | 
			
		||||
.BR vgcfgbackup (8)
 | 
			
		||||
.BR vgcfgrestore (8)
 | 
			
		||||
.BR vgchange (8)
 | 
			
		||||
.BR vgck (8)
 | 
			
		||||
.BR vgcreate (8)
 | 
			
		||||
.BR vgconvert (8)
 | 
			
		||||
.BR vgdisplay (8)
 | 
			
		||||
.BR vgexport (8)
 | 
			
		||||
.BR vgextend (8)
 | 
			
		||||
.BR vgimport (8)
 | 
			
		||||
.BR vgimportclone (8)
 | 
			
		||||
.BR vgmerge (8)
 | 
			
		||||
.BR vgmknodes (8)
 | 
			
		||||
.BR vgreduce (8)
 | 
			
		||||
.BR vgremove (8)
 | 
			
		||||
.BR vgrename (8)
 | 
			
		||||
.BR vgs (8)
 | 
			
		||||
.BR vgscan (8)
 | 
			
		||||
.BR vgsplit (8) 
 | 
			
		||||
 | 
			
		||||
.BR lvcreate (8)
 | 
			
		||||
.BR lvchange (8)
 | 
			
		||||
.BR lvconvert (8)
 | 
			
		||||
.BR lvdisplay (8)
 | 
			
		||||
.BR lvextend (8)
 | 
			
		||||
.BR lvreduce (8)
 | 
			
		||||
.BR lvremove (8)
 | 
			
		||||
.BR lvrename (8)
 | 
			
		||||
.BR lvresize (8)
 | 
			
		||||
.BR lvs (8)
 | 
			
		||||
.BR lvscan (8)
 | 
			
		||||
 | 
			
		||||
.BR lvm2-activation-generator (8)
 | 
			
		||||
.BR blkdeactivate (8)
 | 
			
		||||
.BR lvmdump (8)
 | 
			
		||||
 | 
			
		||||
.BR dmeventd (8)
 | 
			
		||||
.BR lvmetad (8)
 | 
			
		||||
.BR lvmpolld (8)
 | 
			
		||||
.BR lvmlockd (8)
 | 
			
		||||
.BR lvmlockctl (8)
 | 
			
		||||
.BR clvmd (8)
 | 
			
		||||
.BR cmirrord (8)
 | 
			
		||||
.BR lvmdbusd (8)
 | 
			
		||||
 | 
			
		||||
.BR lvmsystemid (7)
 | 
			
		||||
.BR lvmreport (7)
 | 
			
		||||
.BR lvmraid (7)
 | 
			
		||||
.BR lvmthin (7)
 | 
			
		||||
.BR lvmcache (7)
 | 
			
		||||
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
.SH NOTES
 | 
			
		||||
 | 
			
		||||
.IP \[bu] 3
 | 
			
		||||
To replace PVs, \fBvgdisplay \-\-partial \-\-verbose\fP will show the
 | 
			
		||||
UUIDs and sizes of any PVs that are no longer present. If a PV in the VG
 | 
			
		||||
is lost and you wish to substitute another of the same size, use
 | 
			
		||||
\fBpvcreate \-\-restorefile filename \-\-uuid uuid\fP (plus additional
 | 
			
		||||
arguments as appropriate) to initialise it with the same UUID as the
 | 
			
		||||
missing PV. Repeat for all other missing PVs in the VG.  Then use
 | 
			
		||||
\fBvgcfgrestore \-\-file filename\fP to restore the volume group's
 | 
			
		||||
metadata.
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
.EXAMPLES
 | 
			
		||||
 | 
			
		||||
Activate all LVs in all VGs on all existing devices.
 | 
			
		||||
.br
 | 
			
		||||
.B vgchange \-a y
 | 
			
		||||
 | 
			
		||||
Change the maximum number of LVs for an inactive VG.
 | 
			
		||||
.br
 | 
			
		||||
.B vgchange \-l 128 vg00
 | 
			
		||||
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
.EXAMPLES
 | 
			
		||||
 | 
			
		||||
Create a VG with two PVs, using the default physical extent size.
 | 
			
		||||
.br
 | 
			
		||||
.B vgcreate myvg /dev/sdk1 /dev/sdl1
 | 
			
		||||
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
.SH NOTES
 | 
			
		||||
 | 
			
		||||
If the specified PVs have not yet been initialized with pvcreate,
 | 
			
		||||
vgextend will initialize them. In this case the PV options apply,
 | 
			
		||||
e.g. \-\-labelsector, \-\-metadatasize, \-\-metadataignore,
 | 
			
		||||
\-\-pvmetadatacopies, \-\-dataalignment, \-\-dataalignmentoffset.
 | 
			
		||||
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Add two PVs to a VG.
 | 
			
		||||
.br
 | 
			
		||||
.B vgextend vg00 /dev/sda4 /dev/sdn1
 | 
			
		||||
 | 
			
		||||
@@ -1,20 +0,0 @@
 | 
			
		||||
.SH NOTES
 | 
			
		||||
 | 
			
		||||
.IP \[bu] 3
 | 
			
		||||
vgimportclone can be used to import a VG from duplicated PVs (e.g. created
 | 
			
		||||
by a hardware snapshot of the PV devices).
 | 
			
		||||
 | 
			
		||||
.IP \[bu] 3
 | 
			
		||||
A duplicated VG cannot used until it is made to coexist with the original
 | 
			
		||||
VG.  vgimportclone renames the VG associated with the specified PVs and
 | 
			
		||||
changes the associated VG and PV UUIDs.
 | 
			
		||||
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
An original VG "vg00" has PVs "/dev/sda" and "/dev/sdb".
 | 
			
		||||
The corresponding PVs from a hardware snapshot are "/dev/sdc" and "/dev/sdd".
 | 
			
		||||
Rename the VG associated with "/dev/sdc" and "/dev/sdd" from "vg00" to "vg00_snap"
 | 
			
		||||
(and change associated UUIDs).
 | 
			
		||||
.br
 | 
			
		||||
.B vgimportclone \-\-basevgname vg00_snap /dev/sdc /dev/sdd
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										9
									
								
								man/vgimportclone.8.notes
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								man/vgimportclone.8.notes
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
.SH NOTES
 | 
			
		||||
.
 | 
			
		||||
vgimportclone can be used to import a VG from duplicated PVs (e.g. created
 | 
			
		||||
by a hardware snapshot of the PV devices).
 | 
			
		||||
 | 
			
		||||
A duplicated VG cannot used until it is made to coexist with the original
 | 
			
		||||
VG.  vgimportclone renames the VG associated with the specified PVs and
 | 
			
		||||
changes the associated VG and PV UUIDs.
 | 
			
		||||
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Merge an inactive VG named "vg00" into the active or inactive VG named
 | 
			
		||||
"databases", giving verbose runtime information.
 | 
			
		||||
.br
 | 
			
		||||
.B vgmerge \-v databases vg00
 | 
			
		||||
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
.SH EXAMPLES
 | 
			
		||||
 | 
			
		||||
Rename VG "vg02" to "myvg":
 | 
			
		||||
.br
 | 
			
		||||
.B vgrename "vg02" "myvg"
 | 
			
		||||
 | 
			
		||||
Rename the VG with the specified UUID to "myvg".
 | 
			
		||||
.br
 | 
			
		||||
.B vgrename Zvlifi\-Ep3t\-e0Ng\-U42h\-o0ye\-KHu1\-nl7Ns4 myvg
 | 
			
		||||
 | 
			
		||||
@@ -1,3 +1,4 @@
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
 | 
			
		||||
# Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
 | 
			
		||||
@@ -77,6 +78,9 @@ SOURCES2 =\
 | 
			
		||||
 | 
			
		||||
TARGETS =\
 | 
			
		||||
	.commands \
 | 
			
		||||
	cmds.h \
 | 
			
		||||
	command-count.h \
 | 
			
		||||
	command-lines-input.h \
 | 
			
		||||
	liblvm2cmd.a \
 | 
			
		||||
	lvm
 | 
			
		||||
 | 
			
		||||
@@ -101,7 +105,7 @@ CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) $(TARGETS_DM) \
 | 
			
		||||
	liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION) lvm-static.o \
 | 
			
		||||
	liblvm2cmd-static.a dmsetup.static lvm.static \
 | 
			
		||||
	$(LDDEPS) .exported_symbols_generated \
 | 
			
		||||
	cmds.h command-lines-input.h command-count.h
 | 
			
		||||
	command-lines-input.h command-lines-count.h
 | 
			
		||||
 | 
			
		||||
ifeq ("@CMDLIB@", "yes")
 | 
			
		||||
	TARGETS += liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION)
 | 
			
		||||
@@ -181,34 +185,26 @@ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
 | 
			
		||||
WC = /usr/bin/wc
 | 
			
		||||
GREP = /bin/grep
 | 
			
		||||
SORT = /bin/sort
 | 
			
		||||
CUT = /bin/cut
 | 
			
		||||
SED = /bin/sed
 | 
			
		||||
 | 
			
		||||
# FIXME Add licence text from template file
 | 
			
		||||
 | 
			
		||||
command-count.h: $(srcdir)/command-lines.in Makefile
 | 
			
		||||
	set -o pipefail && \
 | 
			
		||||
	( cat $(top_srcdir)/doc/license.txt && \
 | 
			
		||||
	  echo "/* Do not edit. This file is generated by the Makefile. */" && \
 | 
			
		||||
	  echo -n "#define COMMAND_COUNT " && \
 | 
			
		||||
	  $(GREP) '^ID:' $(srcdir)/command-lines.in | $(WC) -l \
 | 
			
		||||
	(echo -n "#define COMMAND_COUNT " && \
 | 
			
		||||
	$(GREP) '^ID:' $(srcdir)/command-lines.in | $(WC) -l \
 | 
			
		||||
	) > $@
 | 
			
		||||
 | 
			
		||||
cmds.h: $(srcdir)/command-lines.in Makefile
 | 
			
		||||
	set -o pipefail && \
 | 
			
		||||
	( cat $(top_srcdir)/doc/license.txt && \
 | 
			
		||||
	  echo "/* Do not edit. This file is generated by the Makefile. */" && \
 | 
			
		||||
	  echo "cmd(CMD_NONE, none)" && \
 | 
			
		||||
	  $(GREP) '^ID:' $(srcdir)/command-lines.in | $(SORT) -u | $(AWK) '{print "cmd(" $$2 "_CMD, " $$2 ")"}' && \
 | 
			
		||||
	  echo "cmd(CMD_COUNT, count)" \
 | 
			
		||||
	) > $@
 | 
			
		||||
	echo "cmd(CMD_NONE, none)" > cmds.h
 | 
			
		||||
	cat command-lines.in | grep '^ID:' | sort | uniq | awk '{print "cmd(" $$2 "_CMD, " $$2 ")"}' >> cmds.h
 | 
			
		||||
	echo "cmd(CMD_COUNT, count)" >> cmds.h
 | 
			
		||||
 | 
			
		||||
command-lines-input.h: $(srcdir)/command-lines.in Makefile
 | 
			
		||||
	set -o pipefail && \
 | 
			
		||||
	( cat $(top_srcdir)/doc/license.txt && \
 | 
			
		||||
	  echo "/* Do not edit. This file is generated by the Makefile. */" && \
 | 
			
		||||
	  echo -en "const char _command_input[] =\n\n\"" && \
 | 
			
		||||
	  $(GREP) -Ev '^#|\-\-\-|^$$' $(srcdir)/command-lines.in | $(AWK) 'BEGIN {ORS = "\\n\"\n\""} //' && \
 | 
			
		||||
	  echo "\\n\";" \
 | 
			
		||||
	) > $@
 | 
			
		||||
	$(srcdir)/command-lines-input.sh
 | 
			
		||||
 | 
			
		||||
$(SOURCES:%.c=%.d) $(SOURCES2:%.c=%.d): command-lines-input.h command-count.h cmds.h
 | 
			
		||||
$(SOURCES:%.c=%.d): command-lines-input.h command-count.h cmds.h
 | 
			
		||||
 | 
			
		||||
ifneq ("$(CFLOW_CMD)", "")
 | 
			
		||||
CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								tools/command-lines-input.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										11
									
								
								tools/command-lines-input.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
cat command-lines.in | grep -v '^#' | grep -v '\-\-\-' | grep -v '^$' > command-lines.tmp
 | 
			
		||||
echo "" >> command-lines.tmp
 | 
			
		||||
echo "const char _command_input[] =" > command-lines-input.h
 | 
			
		||||
while read -r line; do
 | 
			
		||||
	echo "" >> command-lines-input.h
 | 
			
		||||
	printf '\"%s\\n\"' "$line" >> command-lines-input.h
 | 
			
		||||
done < command-lines.tmp
 | 
			
		||||
echo ";" >> command-lines-input.h
 | 
			
		||||
 | 
			
		||||
@@ -1,15 +1,3 @@
 | 
			
		||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
 | 
			
		||||
# Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved.
 | 
			
		||||
#
 | 
			
		||||
# This file is part of LVM2.
 | 
			
		||||
#
 | 
			
		||||
# This copyrighted material is made available to anyone wishing to use,
 | 
			
		||||
# modify, copy, or redistribute it subject to the terms and conditions
 | 
			
		||||
# of the GNU Lesser General Public License v.2.1.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU Lesser General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
			
		||||
#
 | 
			
		||||
# Syntax
 | 
			
		||||
#
 | 
			
		||||
@@ -264,7 +252,7 @@ RULE: --permission not lv_is_external_origin lv_is_raid_metadata lv_is_raid_imag
 | 
			
		||||
RULE: --alloc --contiguous --metadataprofile --permission --persistent --profile --readahead not lv_is_thick_origin
 | 
			
		||||
RULE: --alloc --discards --zero --cachemode --cachepolicy --cachesettings not lv_is_partial
 | 
			
		||||
 | 
			
		||||
# It's unfortunate that activate needs to be optionally allowed here,
 | 
			
		||||
# It's unfortunate that acativate needs to be optionally allowed here,
 | 
			
		||||
# like above, it was previouly allowed in combination.
 | 
			
		||||
 | 
			
		||||
lvchange --resync VG|LV_raid_mirror|Tag|Select ...
 | 
			
		||||
 
 | 
			
		||||
@@ -1316,9 +1316,7 @@ int define_commands(void)
 | 
			
		||||
				return 0;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			cmd = &commands[cmd_count];
 | 
			
		||||
			cmd->command_index = cmd_count;
 | 
			
		||||
			cmd_count++;
 | 
			
		||||
			cmd = &commands[cmd_count++];
 | 
			
		||||
			cmd->name = strdup(name);
 | 
			
		||||
			cmd->pos_count = 1;
 | 
			
		||||
			add_required_line(cmd, line_argc, line_argv);
 | 
			
		||||
@@ -1358,7 +1356,7 @@ int define_commands(void)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (is_id_line(line_argv[0])) {
 | 
			
		||||
			cmd->command_id = strdup(line_argv[1]);
 | 
			
		||||
			cmd->command_line_id = strdup(line_argv[1]);
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -1474,7 +1472,7 @@ static void _print_usage_description(struct command *cmd)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void print_usage_def(struct arg_def *def)
 | 
			
		||||
static void print_usage_def(struct arg_def *def, int usage)
 | 
			
		||||
{
 | 
			
		||||
	int val_enum;
 | 
			
		||||
	int lvt_enum;
 | 
			
		||||
@@ -1492,7 +1490,7 @@ static void print_usage_def(struct arg_def *def)
 | 
			
		||||
			else {
 | 
			
		||||
				if (sep) printf("|");
 | 
			
		||||
 | 
			
		||||
				if (!val_names[val_enum].usage)
 | 
			
		||||
				if (!usage || !val_names[val_enum].usage)
 | 
			
		||||
					printf("%s", val_names[val_enum].name);
 | 
			
		||||
				else
 | 
			
		||||
					printf("%s", val_names[val_enum].usage);
 | 
			
		||||
@@ -1544,7 +1542,7 @@ void print_usage(struct command *cmd)
 | 
			
		||||
			printf(" %s", opt_names[cmd->required_opt_args[ro].opt].long_opt);
 | 
			
		||||
			if (cmd->required_opt_args[ro].def.val_bits) {
 | 
			
		||||
				printf(" ");
 | 
			
		||||
				print_usage_def(&cmd->required_opt_args[ro].def);
 | 
			
		||||
				print_usage_def(&cmd->required_opt_args[ro].def, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (onereq)
 | 
			
		||||
@@ -1557,7 +1555,7 @@ void print_usage(struct command *cmd)
 | 
			
		||||
		for (rp = 0; rp < cmd->rp_count; rp++) {
 | 
			
		||||
			if (cmd->required_pos_args[rp].def.val_bits) {
 | 
			
		||||
				printf(" ");
 | 
			
		||||
				print_usage_def(&cmd->required_pos_args[rp].def);
 | 
			
		||||
				print_usage_def(&cmd->required_pos_args[rp].def, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -1590,7 +1588,7 @@ void print_usage(struct command *cmd)
 | 
			
		||||
			printf(" %s", opt_names[opt_enum].long_opt);
 | 
			
		||||
			if (cmd->optional_opt_args[oo].def.val_bits) {
 | 
			
		||||
				printf(" ");
 | 
			
		||||
				print_usage_def(&cmd->optional_opt_args[oo].def);
 | 
			
		||||
				print_usage_def(&cmd->optional_opt_args[oo].def, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -1611,7 +1609,7 @@ void print_usage(struct command *cmd)
 | 
			
		||||
		for (op = 0; op < cmd->op_count; op++) {
 | 
			
		||||
			if (cmd->optional_pos_args[op].def.val_bits) {
 | 
			
		||||
				printf(" ");
 | 
			
		||||
				print_usage_def(&cmd->optional_pos_args[op].def);
 | 
			
		||||
				print_usage_def(&cmd->optional_pos_args[op].def, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -1659,7 +1657,7 @@ void print_usage_common(struct command_name *cname, struct command *cmd)
 | 
			
		||||
			printf(" %s", opt_names[opt_enum].long_opt);
 | 
			
		||||
			if (cmd->optional_opt_args[oo].def.val_bits) {
 | 
			
		||||
				printf(" ");
 | 
			
		||||
				print_usage_def(&cmd->optional_opt_args[oo].def);
 | 
			
		||||
				print_usage_def(&cmd->optional_opt_args[oo].def, 1);
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
@@ -1680,7 +1678,7 @@ void print_usage_common(struct command_name *cname, struct command *cmd)
 | 
			
		||||
		printf(" %s", opt_names[opt_enum].long_opt);
 | 
			
		||||
		if (lvm_all.optional_opt_args[oo].def.val_bits) {
 | 
			
		||||
			printf(" ");
 | 
			
		||||
			print_usage_def(&lvm_all.optional_opt_args[oo].def);
 | 
			
		||||
			print_usage_def(&lvm_all.optional_opt_args[oo].def, 1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1851,17 +1849,16 @@ static char *man_long_opt_name(const char *cmdname, int opt_enum)
 | 
			
		||||
	return long_opt_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void print_man_usage(char *lvmname, struct command *cmd)
 | 
			
		||||
void print_man_usage(struct command *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct command_name *cname;
 | 
			
		||||
	int onereq = (cmd->cmd_flags & CMD_FLAG_ONE_REQUIRED_OPT) ? 1 : 0;
 | 
			
		||||
	int i, sep, ro, rp, oo, op, opt_enum;
 | 
			
		||||
	int need_ro_indent_end = 0;
 | 
			
		||||
 | 
			
		||||
	if (!(cname = find_command_name(cmd->name)))
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	printf("\\fB%s\\fP", lvmname);
 | 
			
		||||
	printf("\\fB%s\\fP", cmd->name);
 | 
			
		||||
 | 
			
		||||
	if (!onereq)
 | 
			
		||||
		goto ro_normal;
 | 
			
		||||
@@ -1911,7 +1908,7 @@ void print_man_usage(char *lvmname, struct command *cmd)
 | 
			
		||||
				print_def_man(&cmd->required_opt_args[ro].def, 1);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			sep++;
 | 
			
		||||
			sep = 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* print required options without a short opt */
 | 
			
		||||
@@ -1935,7 +1932,7 @@ void print_man_usage(char *lvmname, struct command *cmd)
 | 
			
		||||
				print_def_man(&cmd->required_opt_args[ro].def, 1);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			sep++;
 | 
			
		||||
			sep = 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		printf(" )\n");
 | 
			
		||||
@@ -1969,16 +1966,7 @@ void print_man_usage(char *lvmname, struct command *cmd)
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	if (cmd->ro_count) {
 | 
			
		||||
		sep = 0;
 | 
			
		||||
 | 
			
		||||
		for (ro = 0; ro < cmd->ro_count; ro++) {
 | 
			
		||||
 | 
			
		||||
			/* avoid long line wrapping */
 | 
			
		||||
			if ((cmd->ro_count > 2) && (sep == 2)) {
 | 
			
		||||
				printf("\n.RS 5\n");
 | 
			
		||||
				need_ro_indent_end = 1;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			opt_enum = cmd->required_opt_args[ro].opt;
 | 
			
		||||
 | 
			
		||||
			if (opt_names[opt_enum].short_opt) {
 | 
			
		||||
@@ -1993,8 +1981,6 @@ void print_man_usage(char *lvmname, struct command *cmd)
 | 
			
		||||
				printf(" ");
 | 
			
		||||
				print_def_man(&cmd->required_opt_args[ro].def, 1);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			sep++;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -2012,9 +1998,6 @@ void print_man_usage(char *lvmname, struct command *cmd)
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (need_ro_indent_end)
 | 
			
		||||
		printf(".RE\n");
 | 
			
		||||
 | 
			
		||||
	printf(".br\n");
 | 
			
		||||
 | 
			
		||||
 oo_count:
 | 
			
		||||
@@ -2430,6 +2413,9 @@ void print_man_all_options_desc(struct command_name *cname)
 | 
			
		||||
		if (print_common && !is_lvm_all_opt(opt_enum))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if (sep)
 | 
			
		||||
			printf("\n.br\n");
 | 
			
		||||
 | 
			
		||||
		printf("\n.TP\n");
 | 
			
		||||
 | 
			
		||||
		if (opt_names[opt_enum].short_opt) {
 | 
			
		||||
@@ -2520,21 +2506,15 @@ static char *upper_command_name(char *str)
 | 
			
		||||
	return str_upper;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void print_man(char *name, int include_primary, int include_secondary)
 | 
			
		||||
void print_man(char *man_command_name, int include_primary, int include_secondary)
 | 
			
		||||
{
 | 
			
		||||
	struct command_name *cname;
 | 
			
		||||
	struct command_name *cname = find_command_name(man_command_name);
 | 
			
		||||
	struct command *cmd, *prev_cmd = NULL;
 | 
			
		||||
	char *lvmname = name;
 | 
			
		||||
	const char *desc;
 | 
			
		||||
	int i, j, ro, rp, oo, op;
 | 
			
		||||
 | 
			
		||||
	if (!strncmp(name, "lvm-", 4))
 | 
			
		||||
		name += 4;
 | 
			
		||||
 | 
			
		||||
	cname = find_command_name(name);
 | 
			
		||||
 | 
			
		||||
	printf(".TH %s 8 \"LVM TOOLS #VERSION#\" \"Sistina Software UK\"\n",
 | 
			
		||||
		upper_command_name(lvmname));
 | 
			
		||||
		man_command_name ? upper_command_name(man_command_name) : "LVM_COMMANDS");
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < COMMAND_COUNT; i++) {
 | 
			
		||||
 | 
			
		||||
@@ -2559,16 +2539,16 @@ void print_man(char *name, int include_primary, int include_secondary)
 | 
			
		||||
		if (!(cmd->cmd_flags & CMD_FLAG_SECONDARY_SYNTAX) && !include_primary)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if (name && strcmp(name, cmd->name))
 | 
			
		||||
		if (man_command_name && strcmp(man_command_name, cmd->name))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if (!prev_cmd || strcmp(prev_cmd->name, cmd->name)) {
 | 
			
		||||
			printf(".SH NAME\n");
 | 
			
		||||
			printf(".\n");
 | 
			
		||||
			if (cname->desc)
 | 
			
		||||
				printf("%s \\- %s\n", lvmname, cname->desc);
 | 
			
		||||
				printf("%s \\- %s\n", cmd->name, cname->desc);
 | 
			
		||||
			else
 | 
			
		||||
				printf("%s\n", lvmname);
 | 
			
		||||
				printf("%s\n", cmd->name);
 | 
			
		||||
			printf(".br\n");
 | 
			
		||||
			printf(".P\n");
 | 
			
		||||
			printf(".\n");
 | 
			
		||||
@@ -2582,13 +2562,13 @@ void print_man(char *name, int include_primary, int include_secondary)
 | 
			
		||||
				return;
 | 
			
		||||
 | 
			
		||||
			if (cname->variant_has_ro && cname->variant_has_rp)
 | 
			
		||||
				printf("\\fB%s\\fP \\fIrequired_option_args\\fP \\fIrequired_position_args\\fP\n", lvmname);
 | 
			
		||||
				printf("\\fB%s\\fP \\fIrequired_option_args\\fP \\fIrequired_position_args\\fP\n", cmd->name);
 | 
			
		||||
			else if (cname->variant_has_ro && !cname->variant_has_rp)
 | 
			
		||||
				printf("\\fB%s\\fP \\fIrequired_option_args\\fP\n", lvmname);
 | 
			
		||||
				printf("\\fB%s\\fP \\fIrequired_option_args\\fP\n", cmd->name);
 | 
			
		||||
			else if (!cname->variant_has_ro && cname->variant_has_rp)
 | 
			
		||||
				printf("\\fB%s\\fP \\fIrequired_position_args\\fP\n", lvmname);
 | 
			
		||||
				printf("\\fB%s\\fP \\fIrequired_position_args\\fP\n", cmd->name);
 | 
			
		||||
			else if (!cname->variant_has_ro && !cname->variant_has_rp)
 | 
			
		||||
				printf("\\fB%s\\fP\n", lvmname);
 | 
			
		||||
				printf("\\fB%s\\fP\n", cmd->name);
 | 
			
		||||
 | 
			
		||||
			printf(".br\n");
 | 
			
		||||
 | 
			
		||||
@@ -2625,7 +2605,7 @@ void print_man(char *name, int include_primary, int include_secondary)
 | 
			
		||||
			printf(".P\n");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		print_man_usage(lvmname, cmd);
 | 
			
		||||
		print_man_usage(cmd);
 | 
			
		||||
 | 
			
		||||
		if (i == (COMMAND_COUNT - 1)) {
 | 
			
		||||
			printf("Common options:\n");
 | 
			
		||||
 
 | 
			
		||||
@@ -22,11 +22,11 @@ struct cmd_context;
 | 
			
		||||
typedef int (*command_fn) (struct cmd_context *cmd, int argc, char **argv);
 | 
			
		||||
 | 
			
		||||
/* new per-command-line-id functions */
 | 
			
		||||
typedef int (*command_id_fn) (struct cmd_context *cmd, int argc, char **argv);
 | 
			
		||||
typedef int (*command_line_fn) (struct cmd_context *cmd, int argc, char **argv);
 | 
			
		||||
 | 
			
		||||
struct command_function {
 | 
			
		||||
	int command_enum;
 | 
			
		||||
	command_id_fn fn;
 | 
			
		||||
	int command_line_enum;
 | 
			
		||||
	command_line_fn fn;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define MAX_COMMAND_NAMES 64
 | 
			
		||||
@@ -170,10 +170,9 @@ struct cmd_rule {
 | 
			
		||||
/* a register of the lvm commands */
 | 
			
		||||
struct command {
 | 
			
		||||
	const char *name;
 | 
			
		||||
	const char *desc; /* specific command description from command-lines.in */
 | 
			
		||||
	const char *command_id; /* ID string in command-lines.in */
 | 
			
		||||
	int command_enum; /* <command_id>_CMD */
 | 
			
		||||
	int command_index; /* position in commands[] */
 | 
			
		||||
	const char *desc; /* specific command description from command-lines.h */
 | 
			
		||||
	const char *command_line_id; /* ID string in command-lines.in */
 | 
			
		||||
	int command_line_enum; /* <command_line_id>_CMD */
 | 
			
		||||
 | 
			
		||||
	struct command_function *functions; /* new style */
 | 
			
		||||
	command_fn fn;                      /* old style */
 | 
			
		||||
 
 | 
			
		||||
@@ -1016,7 +1016,9 @@ static int _lvchange_properties_check(struct cmd_context *cmd,
 | 
			
		||||
{
 | 
			
		||||
	if (!lv_is_visible(lv)) {
 | 
			
		||||
		if (lv_is_named_arg)
 | 
			
		||||
			log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
 | 
			
		||||
			log_error("Operation not permitted (%s %d) on hidden LV %s.",
 | 
			
		||||
				  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
				  display_lvname(lv));
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1127,7 +1129,9 @@ static int _lvchange_activate_check(struct cmd_context *cmd,
 | 
			
		||||
{
 | 
			
		||||
	if (!lv_is_visible(lv)) {
 | 
			
		||||
		if (lv_is_named_arg)
 | 
			
		||||
			log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
 | 
			
		||||
			log_error("Operation not permitted (%s %d) on hidden LV %s.",
 | 
			
		||||
				  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
				  display_lvname(lv));
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1181,7 +1185,9 @@ static int _lvchange_refresh_check(struct cmd_context *cmd,
 | 
			
		||||
{
 | 
			
		||||
	if (!lv_is_visible(lv)) {
 | 
			
		||||
		if (lv_is_named_arg)
 | 
			
		||||
			log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
 | 
			
		||||
			log_error("Operation not permitted (%s %d) on hidden LV %s.",
 | 
			
		||||
				  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
				  display_lvname(lv));
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1361,7 +1367,9 @@ static int _lvchange_persistent_check(struct cmd_context *cmd,
 | 
			
		||||
{
 | 
			
		||||
	if (!lv_is_visible(lv)) {
 | 
			
		||||
		if (lv_is_named_arg)
 | 
			
		||||
			log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
 | 
			
		||||
			log_error("Operation not permitted (%s %d) on hidden LV %s.",
 | 
			
		||||
				  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
				  display_lvname(lv));
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1377,8 +1385,8 @@ int lvchange_persistent_cmd(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
int lvchange(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	log_error(INTERNAL_ERROR "Missing function for command definition %d:%s.",
 | 
			
		||||
		  cmd->command->command_index, cmd->command->command_id);
 | 
			
		||||
	log_error(INTERNAL_ERROR "Missing function for command definition %s.",
 | 
			
		||||
		  cmd->command->command_line_id);
 | 
			
		||||
	return ECMD_FAILED;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3718,7 +3718,7 @@ static int _lvconvert_to_pool_single(struct cmd_context *cmd,
 | 
			
		||||
	int to_thinpool = 0;
 | 
			
		||||
	int to_cachepool = 0;
 | 
			
		||||
 | 
			
		||||
	switch (cmd->command->command_enum) {
 | 
			
		||||
	switch (cmd->command->command_line_enum) {
 | 
			
		||||
	case lvconvert_to_thinpool_CMD:
 | 
			
		||||
		to_thinpool = 1;
 | 
			
		||||
		break;
 | 
			
		||||
@@ -3767,7 +3767,7 @@ int lvconvert_to_pool_noarg_cmd(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
	char *pool_data_name;
 | 
			
		||||
	int i, p;
 | 
			
		||||
 | 
			
		||||
	switch (cmd->command->command_enum) {
 | 
			
		||||
	switch (cmd->command->command_line_enum) {
 | 
			
		||||
	case lvconvert_to_thinpool_noarg_CMD:
 | 
			
		||||
		pool_data_name = (char *)arg_str_value(cmd, thinpool_ARG, NULL);
 | 
			
		||||
		new_command = get_command(lvconvert_to_thinpool_CMD);
 | 
			
		||||
@@ -3781,9 +3781,9 @@ int lvconvert_to_pool_noarg_cmd(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
		return 0;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	log_debug("Changing command %d:%s to standard form %d:%s",
 | 
			
		||||
		  cmd->command->command_index, cmd->command->command_id,
 | 
			
		||||
		  new_command->command_index, new_command->command_id);
 | 
			
		||||
	log_debug("Changing command line id %s %d to standard form %s %d",
 | 
			
		||||
		  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
		  new_command->command_line_id, new_command->command_line_enum);
 | 
			
		||||
 | 
			
		||||
	/* Make the LV the first position arg. */
 | 
			
		||||
 | 
			
		||||
@@ -4046,7 +4046,7 @@ int lvconvert_swap_pool_metadata_noarg_cmd(struct cmd_context *cmd, int argc, ch
 | 
			
		||||
	struct command *new_command;
 | 
			
		||||
	char *pool_name;
 | 
			
		||||
 | 
			
		||||
	switch (cmd->command->command_enum) {
 | 
			
		||||
	switch (cmd->command->command_line_enum) {
 | 
			
		||||
	case lvconvert_swap_thinpool_metadata_CMD:
 | 
			
		||||
		pool_name = (char *)arg_str_value(cmd, thinpool_ARG, NULL);
 | 
			
		||||
		break;
 | 
			
		||||
@@ -4060,9 +4060,9 @@ int lvconvert_swap_pool_metadata_noarg_cmd(struct cmd_context *cmd, int argc, ch
 | 
			
		||||
 | 
			
		||||
	new_command = get_command(lvconvert_swap_pool_metadata_CMD);
 | 
			
		||||
 | 
			
		||||
	log_debug("Changing command %d:%s to standard form %d:%s",
 | 
			
		||||
		  cmd->command->command_index, cmd->command->command_id,
 | 
			
		||||
		  new_command->command_index, new_command->command_id);
 | 
			
		||||
	log_debug("Changing command line id %s %d to standard form %s %d",
 | 
			
		||||
		  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
		  new_command->command_line_id, new_command->command_line_enum);
 | 
			
		||||
 | 
			
		||||
	/* Make the LV the first position arg. */
 | 
			
		||||
 | 
			
		||||
@@ -4126,7 +4126,7 @@ static int _lvconvert_split_cachepool_single(struct cmd_context *cmd,
 | 
			
		||||
		return ECMD_FAILED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	switch (cmd->command->command_enum) {
 | 
			
		||||
	switch (cmd->command->command_line_enum) {
 | 
			
		||||
	case lvconvert_split_and_keep_cachepool_CMD:
 | 
			
		||||
		ret = _lvconvert_split_and_keep_cachepool(cmd, cache_lv, cachepool_lv);
 | 
			
		||||
		break;
 | 
			
		||||
@@ -4147,7 +4147,7 @@ static int _lvconvert_split_cachepool_single(struct cmd_context *cmd,
 | 
			
		||||
 | 
			
		||||
int lvconvert_split_cachepool_cmd(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	if (cmd->command->command_enum == lvconvert_split_and_remove_cachepool_CMD) {
 | 
			
		||||
	if (cmd->command->command_line_enum == lvconvert_split_and_remove_cachepool_CMD) {
 | 
			
		||||
		cmd->handles_missing_pvs = 1;
 | 
			
		||||
		cmd->partial_activation = 1;
 | 
			
		||||
	}
 | 
			
		||||
@@ -4226,7 +4226,8 @@ static int _lvconvert_raid_types_check(struct cmd_context *cmd, struct logical_v
 | 
			
		||||
	case thinpool_LVT:
 | 
			
		||||
	case cachepool_LVT:
 | 
			
		||||
	case snapshot_LVT:
 | 
			
		||||
		log_error("Operation not permitted on LV %s type %s.",
 | 
			
		||||
		log_error("Operation not permitted (%s %d) on LV %s type %s.",
 | 
			
		||||
			  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
			  display_lvname(lv), lvtype ? lvtype->name : "unknown");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
@@ -4234,7 +4235,9 @@ static int _lvconvert_raid_types_check(struct cmd_context *cmd, struct logical_v
 | 
			
		||||
	return 1;
 | 
			
		||||
 | 
			
		||||
 fail_hidden:
 | 
			
		||||
	log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
 | 
			
		||||
	log_error("Operation not permitted (%s %d) on hidden LV %s.",
 | 
			
		||||
		  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
		  display_lvname(lv));
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -4293,7 +4296,9 @@ static int _lvconvert_visible_check(struct cmd_context *cmd, struct logical_volu
 | 
			
		||||
			int lv_is_named_arg)
 | 
			
		||||
{
 | 
			
		||||
	if (!lv_is_visible(lv)) {
 | 
			
		||||
		log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
 | 
			
		||||
		log_error("Operation not permitted (%s %d) on hidden LV %s.",
 | 
			
		||||
			  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
			  display_lvname(lv));
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -4511,8 +4516,8 @@ int lvconvert_merge_cmd(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
int lvconvert(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	log_error(INTERNAL_ERROR "Missing function for command definition %d:%s.",
 | 
			
		||||
		  cmd->command->command_index, cmd->command->command_id);
 | 
			
		||||
	log_error(INTERNAL_ERROR "Missing function for command definition %s.",
 | 
			
		||||
		  cmd->command->command_line_id);
 | 
			
		||||
	return ECMD_FAILED;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -806,7 +806,7 @@ int regionsize_arg(struct cmd_context *cmd, struct arg_values *av)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	if (av->sign == SIGN_MINUS) {
 | 
			
		||||
		log_error("Region size may not be negative.");
 | 
			
		||||
		log_error("Region size cannot be negative.");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -818,7 +818,7 @@ int regionsize_arg(struct cmd_context *cmd, struct arg_values *av)
 | 
			
		||||
	num = av->ui_value;
 | 
			
		||||
 | 
			
		||||
	if (!num) {
 | 
			
		||||
		log_error("Region size may not be zero.");
 | 
			
		||||
		log_error("Region size cannot be zero.");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1112,15 +1112,15 @@ static struct command_name *find_command_name(const char *name)
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static struct command_function *_find_command_id_function(int command_enum)
 | 
			
		||||
static struct command_function *_find_command_id_function(int command_line_enum)
 | 
			
		||||
{
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	if (!command_enum)
 | 
			
		||||
	if (!command_line_enum)
 | 
			
		||||
		return NULL;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < CMD_COUNT; i++) {
 | 
			
		||||
		if (command_functions[i].command_enum == command_enum)
 | 
			
		||||
		if (command_functions[i].command_line_enum == command_line_enum)
 | 
			
		||||
			return &command_functions[i];
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
@@ -1145,10 +1145,10 @@ void lvm_register_commands(void)
 | 
			
		||||
	_cmdline.num_commands = COMMAND_COUNT;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < COMMAND_COUNT; i++) {
 | 
			
		||||
		commands[i].command_enum = command_id_to_enum(commands[i].command_id);
 | 
			
		||||
		commands[i].command_line_enum = command_id_to_enum(commands[i].command_line_id);
 | 
			
		||||
 | 
			
		||||
		/* new style */
 | 
			
		||||
		commands[i].functions = _find_command_id_function(commands[i].command_enum);
 | 
			
		||||
		commands[i].functions = _find_command_id_function(commands[i].command_line_enum);
 | 
			
		||||
 | 
			
		||||
		/* old style */
 | 
			
		||||
		if (!commands[i].functions) {
 | 
			
		||||
@@ -1188,7 +1188,7 @@ struct command *get_command(int cmd_enum)
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < COMMAND_COUNT; i++) {
 | 
			
		||||
		if (commands[i].command_enum == cmd_enum)
 | 
			
		||||
		if (commands[i].command_line_enum == cmd_enum)
 | 
			
		||||
			return &commands[i];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1559,7 +1559,8 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
 | 
			
		||||
 | 
			
		||||
	if (best_unused_count) {
 | 
			
		||||
		for (i = 0; i < best_unused_count; i++) {
 | 
			
		||||
			log_error("Invalid option for command: %s.",
 | 
			
		||||
			log_error("Invalid option for command (%s %d): %s.",
 | 
			
		||||
				  commands[best_i].command_line_id, best_i,
 | 
			
		||||
				  arg_long_option_name(best_unused_options[i]));
 | 
			
		||||
		}
 | 
			
		||||
		return NULL;
 | 
			
		||||
@@ -1589,7 +1590,8 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
		if (count >= (commands[best_i].rp_count + commands[best_i].op_count)) {
 | 
			
		||||
			log_error("Invalid positional argument for command: %s.", argv[count]);
 | 
			
		||||
			log_error("Invalid positional argument for command (%s %d): %s.",
 | 
			
		||||
				  commands[best_i].command_line_id, best_i, argv[count]);
 | 
			
		||||
 | 
			
		||||
			/* FIXME: to warn/ignore, clear so it can't be used when processing. */
 | 
			
		||||
			/*
 | 
			
		||||
@@ -1633,21 +1635,22 @@ out:
 | 
			
		||||
			if (opts_match_count && (rule->rule == RULE_INVALID)) {
 | 
			
		||||
				memset(buf, 0, sizeof(buf));
 | 
			
		||||
				opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, buf, sizeof(buf));
 | 
			
		||||
				log_error("Invalid options for command: %s", buf);
 | 
			
		||||
				log_error("Invalid options for command (%s %d): %s",
 | 
			
		||||
					  commands[best_i].command_line_id, best_i, buf);
 | 
			
		||||
				return NULL;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (opts_unmatch_count && (rule->rule == RULE_REQUIRE)) {
 | 
			
		||||
				memset(buf, 0, sizeof(buf));
 | 
			
		||||
				opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, buf, sizeof(buf));
 | 
			
		||||
				log_error("Required options for command: %s", buf);
 | 
			
		||||
				log_error("Required options for command (%s %d): %s",
 | 
			
		||||
					  commands[best_i].command_line_id, best_i, buf);
 | 
			
		||||
				return NULL;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log_debug("Using command index %d id %s enum %d.",
 | 
			
		||||
		  best_i, commands[best_i].command_id, commands[best_i].command_enum);
 | 
			
		||||
	log_debug("command line id: %s %d", commands[best_i].command_line_id, best_i);
 | 
			
		||||
 | 
			
		||||
	return &commands[best_i];
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2688,8 +2688,8 @@ static int _check_lv_types(struct cmd_context *cmd, struct logical_volume *lv, i
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
	if (!val_bit_is_set(cmd->command->required_pos_args[pos-1].def.val_bits, lv_VAL)) {
 | 
			
		||||
		log_error(INTERNAL_ERROR "Command %d:%s arg position %d does not permit an LV (%llx)",
 | 
			
		||||
			  cmd->command->command_index, cmd->command->command_id,
 | 
			
		||||
		log_error(INTERNAL_ERROR "Command (%s %d) arg position %d does not permit an LV (%llx)",
 | 
			
		||||
			  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
			  pos, (unsigned long long)cmd->command->required_pos_args[pos-1].def.val_bits);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
@@ -3105,7 +3105,9 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
 | 
			
		||||
		if (!_check_lv_types(cmd, lvl->lv, lv_arg_pos)) {
 | 
			
		||||
			/* FIXME: include this result in report log? */
 | 
			
		||||
			if (lv_is_named_arg) {
 | 
			
		||||
				log_error("Operation not permitted on LV %s.", display_lvname(lvl->lv));
 | 
			
		||||
				log_error("Operation not permitted (%s %d) on LV %s.",
 | 
			
		||||
					  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
					  display_lvname(lvl->lv));
 | 
			
		||||
				ret_max = ECMD_FAILED;
 | 
			
		||||
			}
 | 
			
		||||
			continue;
 | 
			
		||||
@@ -3114,7 +3116,9 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
 | 
			
		||||
		if (!_check_lv_rules(cmd, lvl->lv)) {
 | 
			
		||||
			/* FIXME: include this result in report log? */
 | 
			
		||||
			if (lv_is_named_arg) {
 | 
			
		||||
				log_error("Operation not permitted on LV %s.", display_lvname(lvl->lv));
 | 
			
		||||
				log_error("Operation not permitted (%s %d) on LV %s.",
 | 
			
		||||
					  cmd->command->command_line_id, cmd->command->command_line_enum,
 | 
			
		||||
					  display_lvname(lvl->lv));
 | 
			
		||||
				ret_max = ECMD_FAILED;
 | 
			
		||||
			} 
 | 
			
		||||
			continue;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user