mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-13 17:18:32 +03:00
Permit --available with lvcreate so non-snapshot LVs need not be activated.
This commit is contained in:
parent
677ec408bf
commit
453cdee51c
@ -1,5 +1,6 @@
|
||||
Version 2.02.86 -
|
||||
=================================
|
||||
Permit --available with lvcreate so non-snapshot LVs need not be activated.
|
||||
Report sector containing label in verbose message.
|
||||
Clarify error message when unable to convert an LV into a snapshot of an LV.
|
||||
Add and use dev_open_readonly and variations.
|
||||
|
@ -3711,7 +3711,9 @@ int lv_create_single(struct volume_group *vg,
|
||||
"exception store.");
|
||||
goto revert_new_lv;
|
||||
}
|
||||
} else if (!activate_lv(cmd, lv)) {
|
||||
} else if ((lp->activate == CHANGE_AY && !activate_lv(cmd, lv)) ||
|
||||
(lp->activate == CHANGE_AE && !activate_lv_excl(cmd, lv)) ||
|
||||
(lp->activate == CHANGE_ALY && !activate_lv_local(cmd, lv))) {
|
||||
log_error("Failed to activate new LV.");
|
||||
if (lp->zero)
|
||||
goto deactivate_and_revert_new_lv;
|
||||
|
@ -78,6 +78,7 @@
|
||||
|
||||
#define REPLICATOR 0x20000000U /* LV -internal use only for replicator */
|
||||
#define REPLICATOR_LOG 0x40000000U /* LV -internal use only for replicator-dev */
|
||||
#define UNLABELLED_PV 0x80000000U /* PV -this PV had no label written yet */
|
||||
|
||||
#define LVM_READ 0x00000100U /* LV VG */
|
||||
#define LVM_WRITE 0x00000200U /* LV VG */
|
||||
@ -360,7 +361,8 @@ struct pvcreate_params {
|
||||
|
||||
struct physical_volume *pvcreate_single(struct cmd_context *cmd,
|
||||
const char *pv_name,
|
||||
struct pvcreate_params *pp);
|
||||
struct pvcreate_params *pp,
|
||||
int write_now);
|
||||
void pvcreate_params_set_defaults(struct pvcreate_params *pp);
|
||||
|
||||
/*
|
||||
@ -372,7 +374,7 @@ int vg_revert(struct volume_group *vg);
|
||||
struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vg_name,
|
||||
const char *vgid, int warnings, int *consistent);
|
||||
struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name,
|
||||
uint64_t *label_sector, int warnings,
|
||||
int warnings,
|
||||
int scan_label_only);
|
||||
struct dm_list *get_pvs(struct cmd_context *cmd);
|
||||
|
||||
@ -519,6 +521,17 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size,
|
||||
uint32_t extent_size);
|
||||
|
||||
/*
|
||||
* Activation options
|
||||
*/
|
||||
typedef enum {
|
||||
CHANGE_AY = 0,
|
||||
CHANGE_AN = 1,
|
||||
CHANGE_AE = 2,
|
||||
CHANGE_ALY = 3,
|
||||
CHANGE_ALN = 4
|
||||
} activation_change_t;
|
||||
|
||||
/* FIXME: refactor and reduce the size of this struct! */
|
||||
struct lvcreate_params {
|
||||
/* flags */
|
||||
@ -529,6 +542,7 @@ struct lvcreate_params {
|
||||
int log_count; /* mirror */
|
||||
int nosync; /* mirror */
|
||||
int activation_monitoring; /* all */
|
||||
activation_change_t activate; /* non-snapshot, non-mirror */
|
||||
|
||||
char *origin; /* snap */
|
||||
const char *vg_name; /* all */
|
||||
|
@ -111,6 +111,7 @@ static void _lv_set_default_params(struct lvcreate_params *lp,
|
||||
lp->major = -1;
|
||||
lp->minor = -1;
|
||||
lp->activation_monitoring = DEFAULT_DMEVENTD_MONITOR;
|
||||
lp->activate = CHANGE_AY;
|
||||
lp->vg_name = vg->name;
|
||||
lp->lv_name = lvname; /* FIXME: check this for safety */
|
||||
lp->pvh = &vg->pvs;
|
||||
|
@ -5,6 +5,7 @@ lvcreate \- create a logical volume in an existing volume group
|
||||
.B lvcreate
|
||||
[\-\-addtag Tag]
|
||||
[\-\-alloc AllocationPolicy]
|
||||
[\-a|\-\-available y|n|ey|en|ly|ln]
|
||||
[\-A|\-\-autobackup y|n] [\-C|\-\-contiguous y|n] [\-d|\-\-debug]
|
||||
[\-h|\-?|\-\-help] [\-\-noudevsync]
|
||||
[\-\-ignoremonitoring]
|
||||
@ -55,6 +56,18 @@ keep the contents of the original logical volume for backup purposes.
|
||||
.SH OPTIONS
|
||||
See \fBlvm\fP for common options.
|
||||
.TP
|
||||
.I \-a, \-\-available y|n|ey|en|ly|ln
|
||||
Controls the availability of the Logical Volumes for immediate use after
|
||||
the command finishes running.
|
||||
By default, new Logical Volumes are activated automatically (-ay).
|
||||
If it is possible technically, -an will leave the new Logical Volume inactive.
|
||||
But for example, snapshots can only be created
|
||||
in the active state so -an cannot be used with --snapshot.
|
||||
Normally the --zero n argument has to be supplied too because zeroing (the
|
||||
default behaviour) also requires activation.
|
||||
If clustered locking is enabled, -aey will activate exclusively
|
||||
on one node and -aly will activate only on the local node.
|
||||
.TP
|
||||
.I \-c, \-\-chunksize ChunkSize
|
||||
Power of 2 chunk size for the snapshot logical volume between 4k and 512k.
|
||||
.TP
|
||||
|
@ -148,6 +148,7 @@ xx(lvcreate,
|
||||
0,
|
||||
"lvcreate " "\n"
|
||||
"\t[-A|--autobackup {y|n}]\n"
|
||||
"\t[-a|--available [e|l]y|n]\n"
|
||||
"\t[--addtag Tag]\n"
|
||||
"\t[--alloc AllocationPolicy]\n"
|
||||
"\t[-C|--contiguous {y|n}]\n"
|
||||
@ -198,12 +199,12 @@ xx(lvcreate,
|
||||
|
||||
"\t[PhysicalVolumePath...]\n\n",
|
||||
|
||||
addtag_ARG, alloc_ARG, autobackup_ARG, chunksize_ARG, contiguous_ARG,
|
||||
corelog_ARG, extents_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG,
|
||||
mirrorlog_ARG, mirrors_ARG, monitor_ARG, name_ARG, nosync_ARG, noudevsync_ARG,
|
||||
permission_ARG, persistent_ARG, readahead_ARG, regionsize_ARG, size_ARG,
|
||||
snapshot_ARG, stripes_ARG, stripesize_ARG, test_ARG, type_ARG,
|
||||
virtualoriginsize_ARG, virtualsize_ARG, zero_ARG)
|
||||
addtag_ARG, alloc_ARG, autobackup_ARG, available_ARG, chunksize_ARG,
|
||||
contiguous_ARG, corelog_ARG, extents_ARG, ignoremonitoring_ARG, major_ARG,
|
||||
minor_ARG, mirrorlog_ARG, mirrors_ARG, monitor_ARG, name_ARG, nosync_ARG,
|
||||
noudevsync_ARG, permission_ARG, persistent_ARG, readahead_ARG,
|
||||
regionsize_ARG, size_ARG, snapshot_ARG, stripes_ARG, stripesize_ARG,
|
||||
test_ARG, type_ARG, virtualoriginsize_ARG, virtualsize_ARG, zero_ARG)
|
||||
|
||||
xx(lvdisplay,
|
||||
"Display information about a logical volume",
|
||||
|
@ -429,12 +429,21 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
||||
!_read_mirror_params(lp, cmd))
|
||||
return_0;
|
||||
|
||||
lp->activate = arg_uint_value(cmd, available_ARG, CHANGE_AY);
|
||||
|
||||
/*
|
||||
* Should we zero the lv.
|
||||
*/
|
||||
lp->zero = strcmp(arg_str_value(cmd, zero_ARG,
|
||||
(lp->segtype->flags & SEG_CANNOT_BE_ZEROED) ? "n" : "y"), "n");
|
||||
|
||||
if (lp->activate == CHANGE_AN || lp->activate == CHANGE_ALN) {
|
||||
if (lp->zero) {
|
||||
log_error("--available n requires --zero n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Alloc policy
|
||||
*/
|
||||
|
@ -87,14 +87,6 @@ typedef enum {
|
||||
PERCENT_ORIGIN
|
||||
} percent_type_t;
|
||||
|
||||
enum {
|
||||
CHANGE_AY = 0,
|
||||
CHANGE_AN = 1,
|
||||
CHANGE_AE = 2,
|
||||
CHANGE_ALY = 3,
|
||||
CHANGE_ALN = 4
|
||||
};
|
||||
|
||||
#define ARG_COUNTABLE 0x00000001 /* E.g. -vvvv */
|
||||
#define ARG_GROUPABLE 0x00000002 /* E.g. --addtag */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user