mirror of
git://sourceware.org/git/lvm2.git
synced 2025-09-30 17:44:21 +03:00
Compare commits
40 Commits
dev-dct-cm
...
dev-dct-lv
Author | SHA1 | Date | |
---|---|---|---|
|
7497bca317 | ||
|
4dc5d4ac7e | ||
|
fcbed26393 | ||
|
9cdd4dcca7 | ||
|
64a8505b96 | ||
|
05eb90db68 | ||
|
fccd6e0346 | ||
|
348c46c8fc | ||
|
a21028dea7 | ||
|
579c941321 | ||
|
6f61de3009 | ||
|
f678052385 | ||
|
6a099707c4 | ||
|
49caa9f3b1 | ||
|
51fd232b8e | ||
|
21bdd0a359 | ||
|
8f85834a33 | ||
|
25b672417e | ||
|
395ce6c2bb | ||
|
2b3dcd754f | ||
|
86a3a0c765 | ||
|
e1287c3b71 | ||
|
04fd55a0c9 | ||
|
cdcd8011d0 | ||
|
d388b36da2 | ||
|
d95b26fae0 | ||
|
ece80cd0fb | ||
|
bf461b99c6 | ||
|
7e13586837 | ||
|
d7237ca63a | ||
|
3d96203e21 | ||
|
7e77e250a9 | ||
|
d1f9845c96 | ||
|
cfe26470e3 | ||
|
2b90466f78 | ||
|
80ef913872 | ||
|
65c4f81dc2 | ||
|
5e8307f4bf | ||
|
66dd481f46 | ||
|
d651b340e6 |
@@ -1,5 +1,6 @@
|
||||
Version 2.03.12 -
|
||||
===================================
|
||||
Fix memleak when generating list of outdated pvs.
|
||||
Better hyphenation usage in man pages.
|
||||
Replace use of deprecated security_context_t with char*.
|
||||
Configure supports AIO_LIBS and AIO_CFLAGS.
|
||||
|
@@ -1084,13 +1084,14 @@ global {
|
||||
|
||||
# Configuration option global/event_activation.
|
||||
# Activate LVs based on system-generated device events.
|
||||
# When a device appears on the system, a system-generated event runs
|
||||
# the pvscan command to activate LVs if the new PV completes the VG.
|
||||
# When event_activation is disabled, the system will generally run
|
||||
# a direct activation command to activate LVs in complete VGs.
|
||||
# Activation commands that are run by the system, either from events
|
||||
# or at fixed points during startup, use autoactivation (-aay). See
|
||||
# the --setautoactivation option or the auto_activation_volume_list
|
||||
# When a PV appears on the system, a system-generated uevent triggers
|
||||
# the lvm2-pvscan service which runs the pvscan --cache -aay command.
|
||||
# If the new PV completes a VG, pvscan autoactivates LVs in the VG.
|
||||
# When event_activation is disabled, the lvm2-activation services are
|
||||
# generated and run at fixed points during system startup. These
|
||||
# services run vgchange -aay to autoactivate LVs in VGs that happen
|
||||
# to be present at that point in time.
|
||||
# See the --setautoactivation option or the auto_activation_volume_list
|
||||
# setting to configure autoactivation for specific VGs or LVs.
|
||||
# This configuration option has an automatic default value.
|
||||
# event_activation = 1
|
||||
|
@@ -1742,7 +1742,8 @@ static void _init_thread_signals(void)
|
||||
sigset_t my_sigset;
|
||||
struct sigaction act = { .sa_handler = _sig_alarm };
|
||||
|
||||
sigaction(SIGALRM, &act, NULL);
|
||||
if (sigaction(SIGALRM, &act, NULL))
|
||||
log_sys_debug("sigaction", "SIGLARM");
|
||||
sigfillset(&my_sigset);
|
||||
|
||||
/* These are used for exiting */
|
||||
|
@@ -987,18 +987,22 @@ static int read_options(int argc, char *argv[])
|
||||
break;
|
||||
case 'k':
|
||||
kill_vg = 1;
|
||||
free(arg_vg_name);
|
||||
arg_vg_name = strdup(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
drop_vg = 1;
|
||||
free(arg_vg_name);
|
||||
arg_vg_name = strdup(optarg);
|
||||
break;
|
||||
case 'E':
|
||||
gl_enable = 1;
|
||||
free(arg_vg_name);
|
||||
arg_vg_name = strdup(optarg);
|
||||
break;
|
||||
case 'D':
|
||||
gl_disable = 1;
|
||||
free(arg_vg_name);
|
||||
arg_vg_name = strdup(optarg);
|
||||
break;
|
||||
case 'S':
|
||||
|
@@ -1800,9 +1800,7 @@ static void res_process(struct lockspace *ls, struct resource *r,
|
||||
act->result = -EINVAL;
|
||||
list_del(&act->list);
|
||||
add_client_result(act);
|
||||
}
|
||||
|
||||
if (act->op == LD_OP_LOCK && act->mode == LD_LK_UN) {
|
||||
} else if (act->op == LD_OP_LOCK && act->mode == LD_LK_UN) {
|
||||
rv = res_unlock(ls, r, act);
|
||||
|
||||
if (rv == -ENOENT && (act->flags & LD_AF_UNLOCK_CANCEL))
|
||||
@@ -4968,7 +4966,7 @@ static void *client_thread_main(void *arg_in)
|
||||
}
|
||||
out:
|
||||
if (adopt_opt && lock_acquire_written)
|
||||
unlink(adopt_file);
|
||||
(void) unlink(adopt_file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -5740,13 +5738,13 @@ static void adopt_locks(void)
|
||||
if (count_start_fail || count_adopt_fail)
|
||||
goto fail;
|
||||
|
||||
unlink(adopt_file);
|
||||
(void) unlink(adopt_file);
|
||||
write_adopt_file();
|
||||
log_debug("adopt_locks done");
|
||||
return;
|
||||
|
||||
fail:
|
||||
unlink(adopt_file);
|
||||
(void) unlink(adopt_file);
|
||||
log_error("adopt_locks failed, reset host");
|
||||
}
|
||||
|
||||
|
@@ -3774,7 +3774,7 @@ static struct selection_node *_parse_selection(struct dm_report *rh,
|
||||
struct field_selection *fs;
|
||||
struct selection_node *sn;
|
||||
const char *ws, *we; /* field name */
|
||||
const char *vs, *ve; /* value */
|
||||
const char *vs = NULL, *ve = NULL; /* value */
|
||||
const char *last;
|
||||
uint32_t flags, field_num;
|
||||
int implicit;
|
||||
|
2
lib/cache/lvmcache.c
vendored
2
lib/cache/lvmcache.c
vendored
@@ -2818,7 +2818,7 @@ void lvmcache_get_outdated_devs(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
dm_list_iterate_items(info, &vginfo->outdated_infos) {
|
||||
if (!(devl = zalloc(sizeof(*devl))))
|
||||
if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
|
||||
return;
|
||||
devl->dev = info->dev;
|
||||
dm_list_add(devs, &devl->list);
|
||||
|
@@ -293,13 +293,13 @@ static int _compare_paths(const char *path0, const char *path1)
|
||||
/* We prefer symlinks - they exist for a reason!
|
||||
* So we prefer a shorter path before the first symlink in the name.
|
||||
* FIXME Configuration option to invert this? */
|
||||
while (s0) {
|
||||
s0 = strchr(s0, '/');
|
||||
s1 = strchr(s1, '/');
|
||||
if (s0) {
|
||||
while (s0 && s1) {
|
||||
if ((s0 = strchr(s0, '/')))
|
||||
*s0 = '\0';
|
||||
|
||||
if ((s1 = strchr(s1, '/')))
|
||||
*s1 = '\0';
|
||||
}
|
||||
|
||||
if (lstat(p0, &stat0)) {
|
||||
log_sys_very_verbose("lstat", p0);
|
||||
return 1;
|
||||
@@ -312,10 +312,10 @@ static int _compare_paths(const char *path0, const char *path1)
|
||||
return 0;
|
||||
if (!S_ISLNK(stat0.st_mode) && S_ISLNK(stat1.st_mode))
|
||||
return 1;
|
||||
if (s0) {
|
||||
if (s0)
|
||||
*s0++ = '/';
|
||||
if (s1)
|
||||
*s1++ = '/';
|
||||
}
|
||||
}
|
||||
|
||||
/* ASCII comparison */
|
||||
@@ -1490,7 +1490,7 @@ struct device *dev_cache_get(struct cmd_context *cmd, const char *name, struct d
|
||||
* Remove incorrect info and then add new dev-cache entry.
|
||||
*/
|
||||
if (dev && (st.st_rdev != dev->dev)) {
|
||||
log_print("Device path %s does not match %d:%d %s.",
|
||||
log_debug("Device path %s does not match %d:%d %s.",
|
||||
name, (int)MAJOR(dev->dev), (int)MINOR(dev->dev), dev_name(dev));
|
||||
|
||||
dm_hash_remove(_cache.names, name);
|
||||
@@ -1510,7 +1510,8 @@ struct device *dev_cache_get(struct cmd_context *cmd, const char *name, struct d
|
||||
* for st_rdev.
|
||||
*/
|
||||
if (!dev) {
|
||||
_insert_dev(name, st.st_rdev);
|
||||
if (!_insert_dev(name, st.st_rdev))
|
||||
return_NULL;
|
||||
|
||||
/* Get the struct dev that was just added. */
|
||||
dev = (struct device *) dm_hash_lookup(_cache.names, name);
|
||||
@@ -1710,13 +1711,11 @@ static int _setup_devices_list(struct cmd_context *cmd)
|
||||
*/
|
||||
|
||||
dm_list_iterate_items(strl, &cmd->deviceslist) {
|
||||
if (!(du = zalloc(sizeof(struct dev_use))))
|
||||
if (!(du = dm_pool_zalloc(cmd->mem, sizeof(struct dev_use))))
|
||||
return_0;
|
||||
|
||||
if (!(du->devname = strdup(strl->str))) {
|
||||
free(du);
|
||||
if (!(du->devname = dm_pool_strdup(cmd->mem, strl->str)))
|
||||
return_0;
|
||||
}
|
||||
|
||||
dm_list_add(&cmd->use_devices, &du->list);
|
||||
}
|
||||
|
@@ -55,7 +55,7 @@ static int _dev_has_md_magic(struct device *dev, uint64_t sb_offset)
|
||||
static int _dev_has_imsm_magic(struct device *dev, uint64_t devsize_sectors)
|
||||
{
|
||||
char imsm_signature[IMSM_SIG_LEN];
|
||||
uint64_t off = (devsize_sectors * 512) - 1024;
|
||||
uint64_t off;
|
||||
unsigned int physical_block_size = 0;
|
||||
unsigned int logical_block_size = 0;
|
||||
|
||||
|
@@ -725,6 +725,39 @@ int get_fs_block_size(struct device *dev, uint32_t *fs_block_size)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BLKID_WIPING_SUPPORT
|
||||
int get_fs_can_reduce(const char *pathname, int *fs_can_reduce, char *fs_buf, int fs_buf_len)
|
||||
{
|
||||
char *fs_str = NULL;
|
||||
|
||||
if ((fs_str = blkid_get_tag_value(NULL, "TYPE", pathname))) {
|
||||
if (fs_buf && fs_buf_len)
|
||||
strncpy(fs_buf, fs_str, fs_buf_len-1);
|
||||
|
||||
log_debug("Found blkid filesystem TYPE %s on %s", fs_str, pathname);
|
||||
|
||||
if (fs_str && !strcmp(fs_str, "ext4"))
|
||||
*fs_can_reduce = 1;
|
||||
else
|
||||
*fs_can_reduce = 0;
|
||||
|
||||
free(fs_str);
|
||||
return 1;
|
||||
} else {
|
||||
log_debug("No blkid filesystem TYPE found for %s", pathname);;
|
||||
*fs_can_reduce = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
int get_fs_can_reduce(const char *pathname, int *fs_can_reduce, char *fs_buf, int fs_buf_len)
|
||||
{
|
||||
log_warn("Disabled blkid for fs type check.");
|
||||
*fs_can_reduce = 0;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BLKID_WIPING_SUPPORT
|
||||
|
||||
static inline int _type_in_flag_list(const char *type, uint32_t flag_list)
|
||||
|
@@ -102,4 +102,6 @@ int dev_is_lv(struct device *dev);
|
||||
|
||||
int get_fs_block_size(struct device *dev, uint32_t *fs_block_size);
|
||||
|
||||
int get_fs_can_reduce(const char *pathname, int *fs_can_reduce, char *fs_buf, int fs_buf_len);
|
||||
|
||||
#endif
|
||||
|
@@ -523,7 +523,7 @@ int device_ids_read(struct cmd_context *cmd)
|
||||
_copy_idline_str(line, _devices_file_systemid, sizeof(_devices_file_systemid));
|
||||
log_debug("read devices file systemid %s", _devices_file_systemid);
|
||||
if ((!cmd->system_id && _devices_file_systemid[0]) ||
|
||||
strcmp(cmd->system_id, _devices_file_systemid)) {
|
||||
(cmd->system_id && strcmp(cmd->system_id, _devices_file_systemid))) {
|
||||
log_warn("WARNING: ignoring devices file with wrong system id %s vs local %s.",
|
||||
_devices_file_systemid[0] ? _devices_file_systemid : "none", cmd->system_id ?: "none");
|
||||
free_dus(&cmd->use_devices);
|
||||
@@ -679,7 +679,7 @@ int device_ids_write(struct cmd_context *cmd)
|
||||
goto out;
|
||||
}
|
||||
|
||||
unlink(tmppath); /* in case a previous file was left */
|
||||
(void) unlink(tmppath); /* in case a previous file was left */
|
||||
|
||||
if (!(fp = fopen(tmppath, "w+"))) {
|
||||
log_warn("Cannot open tmp devices_file to write.");
|
||||
@@ -1008,21 +1008,24 @@ id_done:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found_id && !strcmp(id->idname, idname)) {
|
||||
free((char *)idname);
|
||||
} else if (found_id && strcmp(id->idname, idname)) {
|
||||
|
||||
if (found_id && idname && strcmp(id->idname, idname)) {
|
||||
dm_list_del(&id->list);
|
||||
free_did(id);
|
||||
found_id = 0;
|
||||
}
|
||||
if (!found_id) {
|
||||
if (!(id = zalloc(sizeof(struct dev_id))))
|
||||
if (!(id = zalloc(sizeof(struct dev_id)))) {
|
||||
free((char *)idname);
|
||||
return_0;
|
||||
}
|
||||
id->idtype = idtype;
|
||||
id->idname = (char *)idname;
|
||||
id->dev = dev;
|
||||
dm_list_add(&dev->ids, &id->list);
|
||||
}
|
||||
} else
|
||||
free((char*)idname);
|
||||
|
||||
dev->id = id;
|
||||
dev->flags |= DEV_MATCHED_USE_ID;
|
||||
|
||||
@@ -1074,7 +1077,8 @@ id_done:
|
||||
if (du_devid && (du_devid != du_dev)) {
|
||||
log_warn("WARNING: device %s (%s) and %s (%s) have duplicate device ID.",
|
||||
dev_name(dev), id->idname,
|
||||
du_pvid->dev ? dev_name(du_pvid->dev) : "none", du_pvid->idname);
|
||||
(du_pvid && du_pvid->dev) ? dev_name(du_pvid->dev) : "none",
|
||||
du_pvid ? du_pvid->idname : "");
|
||||
}
|
||||
|
||||
if (du_pvid && (du_pvid != du_dev)) {
|
||||
@@ -1908,6 +1912,7 @@ void device_ids_find_renamed_devs(struct cmd_context *cmd, struct dm_list *dev_l
|
||||
*/
|
||||
dm_list_iterate_items(devl, &search_devs) {
|
||||
dev = devl->dev;
|
||||
int has_pvid;
|
||||
|
||||
/*
|
||||
* We only need to check devs that would use ID_TYPE_DEVNAME
|
||||
@@ -1931,11 +1936,17 @@ void device_ids_find_renamed_devs(struct cmd_context *cmd, struct dm_list *dev_l
|
||||
|
||||
/*
|
||||
* Reads 4K from the start of the disk.
|
||||
* Returns 0 if the dev cannot be read.
|
||||
* Looks for LVM header, and sets dev->pvid if the device is a PV.
|
||||
* Returns 0 if the dev has no lvm label or no PVID.
|
||||
* Sets has_pvid=1 if the dev has an lvm PVID.
|
||||
* This loop may look at and skip many non-LVM devices.
|
||||
*/
|
||||
if (!label_read_pvid(dev)) {
|
||||
if (!label_read_pvid(dev, &has_pvid)) {
|
||||
no_pvid++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!has_pvid) {
|
||||
no_pvid++;
|
||||
continue;
|
||||
}
|
||||
|
@@ -128,7 +128,7 @@ static int _read_id(struct id *id, const struct dm_config_node *cn, const char *
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _read_flag_config(const struct dm_config_node *n, uint64_t *status, int type)
|
||||
static int _read_flag_config(const struct dm_config_node *n, uint64_t *status, enum pv_vg_lv_e type)
|
||||
{
|
||||
const struct dm_config_value *cv;
|
||||
*status = 0;
|
||||
|
@@ -1097,7 +1097,7 @@ int label_scan(struct cmd_context *cmd)
|
||||
* so this will usually do nothing.
|
||||
*/
|
||||
label_scan_invalidate(dev);
|
||||
};
|
||||
}
|
||||
dev_iter_destroy(iter);
|
||||
|
||||
/*
|
||||
@@ -1277,7 +1277,7 @@ int label_scan(struct cmd_context *cmd)
|
||||
* Read the header of the disk and if it's a PV
|
||||
* save the pvid in dev->pvid.
|
||||
*/
|
||||
int label_read_pvid(struct device *dev)
|
||||
int label_read_pvid(struct device *dev, int *has_pvid)
|
||||
{
|
||||
char buf[4096] __attribute__((aligned(8)));
|
||||
struct label_header *lh;
|
||||
@@ -1296,14 +1296,17 @@ int label_read_pvid(struct device *dev)
|
||||
*/
|
||||
if (!dev_read_bytes(dev, 0, 4096, buf)) {
|
||||
label_scan_invalidate(dev);
|
||||
return 0;
|
||||
return_0;
|
||||
}
|
||||
|
||||
if (has_pvid)
|
||||
*has_pvid = 0;
|
||||
|
||||
lh = (struct label_header *)(buf + 512);
|
||||
if (memcmp(lh->id, LABEL_ID, sizeof(lh->id))) {
|
||||
/* Not an lvm deice */
|
||||
label_scan_invalidate(dev);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1313,9 +1316,12 @@ int label_read_pvid(struct device *dev)
|
||||
if (memcmp(lh->type, LVM2_LABEL, sizeof(lh->type))) {
|
||||
/* Not an lvm deice */
|
||||
label_scan_invalidate(dev);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (has_pvid)
|
||||
*has_pvid = 1;
|
||||
|
||||
pvh = (struct pv_header *)(buf + 512 + 32);
|
||||
memcpy(dev->pvid, pvh->pv_uuid, ID_LEN);
|
||||
return 1;
|
||||
@@ -1657,7 +1663,7 @@ bool dev_write_bytes(struct device *dev, uint64_t start, size_t len, void *data)
|
||||
_scan_dev_close(dev);
|
||||
|
||||
dev->flags |= DEV_BCACHE_WRITE;
|
||||
label_scan_open(dev);
|
||||
(void) label_scan_open(dev); /* checked later */
|
||||
}
|
||||
|
||||
if (dev->bcache_di < 0) {
|
||||
|
@@ -117,7 +117,7 @@ int label_scan_open(struct device *dev);
|
||||
int label_scan_open_excl(struct device *dev);
|
||||
int label_scan_open_rw(struct device *dev);
|
||||
int label_scan_reopen_rw(struct device *dev);
|
||||
int label_read_pvid(struct device *dev);
|
||||
int label_read_pvid(struct device *dev, int *has_pvid);
|
||||
|
||||
int label_scan_for_pvid(struct cmd_context *cmd, char *pvid, struct device **dev_out);
|
||||
|
||||
|
@@ -6050,6 +6050,55 @@ int lv_resize(struct logical_volume *lv,
|
||||
(pvh != &vg->pvs))
|
||||
log_print_unless_silent("Ignoring PVs on command line when reducing.");
|
||||
|
||||
if (lp->detectfs) {
|
||||
char pathname[PATH_MAX];
|
||||
char *dmname;
|
||||
char fs_buf[16] = {0};
|
||||
int fs_can_reduce = 0;
|
||||
|
||||
/* if lv is not active, activate it */
|
||||
if (!lv_is_active(lv)) {
|
||||
if (!activate_lv(cmd, lv)) {
|
||||
log_error("Failed to activate %s for --detectfs.", display_lvname(lv));
|
||||
return 0;
|
||||
}
|
||||
if (!sync_local_dev_names(cmd))
|
||||
return_0;
|
||||
activated = 1;
|
||||
}
|
||||
|
||||
if (!(dmname = dm_build_dm_name(cmd->mem, vg->name, lv->name, NULL)))
|
||||
return_0;
|
||||
|
||||
if (dm_snprintf(pathname, sizeof(pathname), "%s/%s", dm_dir(), dmname) < 0)
|
||||
return_0;
|
||||
|
||||
/* use blkid to check fs type, we know which types can reduce */
|
||||
if (!get_fs_can_reduce(pathname, &fs_can_reduce, fs_buf, sizeof(fs_buf))) {
|
||||
log_error("Failed to find file system type for --detectfs.");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (!fs_can_reduce) {
|
||||
log_error("Detected file system type %s that cannot be reduced (from --detectfs).",
|
||||
fs_buf[0] ? fs_buf : "unknown");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/*
|
||||
* We've checked that the fs can reduce, but if the user has
|
||||
* not set --resizefs to actually do the fs reduction, then
|
||||
* report an error since it would unnecessarily cause data
|
||||
* loss. i.e. require the user to add either --detectfs n or
|
||||
* --resizefs.
|
||||
*/
|
||||
if (!lp->resizefs) {
|
||||
log_error("Detected file system type %s that can be reduced (see --resizefs).",
|
||||
fs_buf[0] ? fs_buf : "unknown");
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
|
||||
/* Request confirmation before operations that are often mistakes. */
|
||||
/* aux_lv never resize fs */
|
||||
if ((lp->resizefs || (lp->resize == LV_REDUCE)) &&
|
||||
@@ -6558,7 +6607,7 @@ static int _lv_remove_check_in_use(struct logical_volume *lv, force_t force)
|
||||
{
|
||||
struct volume_group *vg = lv->vg;
|
||||
const char *volume_type = "";
|
||||
char buffer[50 * NAME_LEN * 2] = "";
|
||||
char buffer[50 + NAME_LEN * 2] = "";
|
||||
int active;
|
||||
int issue_discards =
|
||||
(vg->cmd->current_settings.issue_discards &&
|
||||
@@ -6821,7 +6870,8 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
display_lvname(pool_lv));
|
||||
}
|
||||
|
||||
lockd_lv(cmd, lock_lv, "un", LDLV_PERSISTENT);
|
||||
if (!lockd_lv(cmd, lv, "un", LDLV_PERSISTENT))
|
||||
log_warn("WARNING: Failed to unlock %s.", display_lvname(lv));
|
||||
lockd_free_lv(cmd, vg, lv->name, &lv->lvid.id[1], lv->lock_args);
|
||||
|
||||
if (!suppress_remove_message && (visible || historical)) {
|
||||
@@ -8858,7 +8908,8 @@ deactivate_and_revert_new_lv:
|
||||
}
|
||||
|
||||
revert_new_lv:
|
||||
lockd_lv(cmd, lv, "un", LDLV_PERSISTENT);
|
||||
if (!lockd_lv(cmd, lv, "un", LDLV_PERSISTENT))
|
||||
log_warn("WARNING: Failed to unlock %s.", display_lvname(lv));
|
||||
lockd_free_lv(vg->cmd, vg, lv->name, &lv->lvid.id[1], lv->lock_args);
|
||||
|
||||
/* FIXME Better to revert to backup of metadata? */
|
||||
|
@@ -687,6 +687,7 @@ struct lvresize_params {
|
||||
int nosync;
|
||||
int nofsck;
|
||||
int resizefs;
|
||||
int detectfs;
|
||||
|
||||
unsigned mirrors;
|
||||
uint32_t stripes;
|
||||
|
@@ -4954,7 +4954,8 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
|
||||
log_very_verbose("Reading orphan VG %s.", vg_name);
|
||||
vg = vg_read_orphans(cmd, vg_name);
|
||||
*error_flags = 0;
|
||||
*error_vg = NULL;
|
||||
if (error_vg)
|
||||
*error_vg = NULL;
|
||||
return vg;
|
||||
}
|
||||
|
||||
|
@@ -653,18 +653,21 @@ static int _daemonise(struct filemap_monitor *fm)
|
||||
}
|
||||
|
||||
if (!_verbose) {
|
||||
if (close(STDIN_FILENO))
|
||||
_early_log("Error closing stdin");
|
||||
if (close(STDOUT_FILENO))
|
||||
_early_log("Error closing stdout");
|
||||
if (close(STDERR_FILENO))
|
||||
_early_log("Error closing stderr");
|
||||
if ((open("/dev/null", O_RDONLY) < 0) ||
|
||||
(open("/dev/null", O_WRONLY) < 0) ||
|
||||
(open("/dev/null", O_WRONLY) < 0)) {
|
||||
_early_log("Error opening stdio streams.");
|
||||
if ((fd = open("/dev/null", O_RDWR)) == -1) {
|
||||
_early_log("Error opening /dev/null.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((dup2(fd, STDIN_FILENO) == -1) ||
|
||||
(dup2(fd, STDOUT_FILENO) == -1) ||
|
||||
(dup2(fd, STDERR_FILENO) == -1)) {
|
||||
if (fd > STDERR_FILENO)
|
||||
(void) close(fd);
|
||||
_early_log("Error redirecting stdin/out/err to null.");
|
||||
return 0;
|
||||
}
|
||||
if (fd > STDERR_FILENO)
|
||||
(void) close(fd);
|
||||
}
|
||||
/* TODO: Use libdaemon/server/daemon-server.c _daemonise() */
|
||||
for (fd = (int) sysconf(_SC_OPEN_MAX) - 1; fd > STDERR_FILENO; fd--) {
|
||||
|
@@ -3773,7 +3773,7 @@ static struct selection_node *_parse_selection(struct dm_report *rh,
|
||||
struct field_selection *fs;
|
||||
struct selection_node *sn;
|
||||
const char *ws, *we; /* field name */
|
||||
const char *vs, *ve; /* value */
|
||||
const char *vs = NULL, *ve = NULL; /* value */
|
||||
const char *last;
|
||||
uint32_t flags, field_num;
|
||||
int implicit;
|
||||
|
@@ -128,6 +128,10 @@ all_man: man
|
||||
|
||||
$(MAN5) $(MAN7) $(MAN8) $(MAN8SO) $(MAN8DM) $(MAN8CLUSTER) $(MAN8SYSTEMD_GENERATORS): Makefile
|
||||
|
||||
$(MANGENERATOR):
|
||||
@echo " [MAKE] $<"
|
||||
$(Q) $(MAKE) -C $(top_builddir) tools
|
||||
|
||||
# Test whether or not the man page generator works
|
||||
$(TESTMAN): $(MANGENERATOR) Makefile
|
||||
@echo " [TSTMAN] $@"
|
||||
|
@@ -25,13 +25,14 @@ fsadm \(em utility to resize or check filesystem on a device
|
||||
.
|
||||
.SH DESCRIPTION
|
||||
.
|
||||
fsadm utility checks or resizes the filesystem on a device.
|
||||
fsadm utility checks or resizes the filesystem on a device (can be
|
||||
also dm-crypt encrypted device).
|
||||
It tries to use the same API for
|
||||
.BR ext2 ,
|
||||
.BR ext3 ,
|
||||
.BR ext4 ,
|
||||
.BR ReiserFS
|
||||
.RB and
|
||||
and
|
||||
.BR XFS
|
||||
filesystem.
|
||||
.
|
||||
@@ -50,6 +51,12 @@ Bypass some sanity checks.
|
||||
Display the help text.
|
||||
.
|
||||
.TP
|
||||
.BR -l | --lvresize
|
||||
Resize also given lvm2 logical volume. More volume management
|
||||
functionality is provided with complementary \fBlvresize\fP(8) and the option
|
||||
.BR -r | --resizefs.
|
||||
.
|
||||
.TP
|
||||
.BR -n | --dry-run
|
||||
Print commands without running them.
|
||||
.
|
||||
|
@@ -1650,23 +1650,22 @@ LV1 types: mirror
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Convert LV to a thin LV, using the original LV as an external origin
|
||||
.br
|
||||
(infers --type thin).
|
||||
Convert LV to a thin LV, using the original LV as an external origin.
|
||||
.br
|
||||
.P
|
||||
\fBlvconvert\fP \fB-T\fP|\fB--thin\fP \fB--thinpool\fP \fILV\fP \fILV1\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type thin\fP ] (implied)
|
||||
.br
|
||||
.br
|
||||
[ \fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP ]
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB-Z\fP|\fB--zero\fP \fBy\fP|\fBn\fP ]
|
||||
.br
|
||||
[ \fB--type\fP \fBthin\fP ]
|
||||
.br
|
||||
[ \fB--originname\fP \fILV\fP\fI_new\fP ]
|
||||
.br
|
||||
[ \fB--poolmetadata\fP \fILV\fP ]
|
||||
@@ -1687,21 +1686,22 @@ LV1 types: linear striped thin cache raid error zero
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Attach a cache pool to an LV (infers --type cache).
|
||||
Attach a cache pool to an LV.
|
||||
.br
|
||||
.P
|
||||
\fBlvconvert\fP \fB-H\fP|\fB--cache\fP \fB--cachepool\fP \fILV\fP \fILV1\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type cache\fP ] (implied)
|
||||
.br
|
||||
.br
|
||||
[ \fB-Z\fP|\fB--zero\fP \fBy\fP|\fBn\fP ]
|
||||
.br
|
||||
[ \fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP ]
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBcache\fP ]
|
||||
.br
|
||||
[ \fB--cachemetadataformat\fP \fBauto\fP|\fB1\fP|\fB2\fP ]
|
||||
.br
|
||||
[ \fB--cachemode\fP \fBwritethrough\fP|\fBwriteback\fP|\fBpassthrough\fP ]
|
||||
@@ -1766,6 +1766,9 @@ Convert LV to type vdopool.
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type vdo-pool\fP ] (implied)
|
||||
.br
|
||||
.br
|
||||
[ \fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP ]
|
||||
.br
|
||||
[ \fB-Z\fP|\fB--zero\fP \fBy\fP|\fBn\fP ]
|
||||
@@ -1774,8 +1777,6 @@ Convert LV to type vdopool.
|
||||
.br
|
||||
[ \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBvdo-pool\fP ]
|
||||
.br
|
||||
[ \fB--metadataprofile\fP \fIString\fP ]
|
||||
.br
|
||||
[ \fB--compression\fP \fBy\fP|\fBn\fP ]
|
||||
@@ -1875,12 +1876,13 @@ origin LV (first arg) to reverse a splitsnapshot command.
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type snapshot\fP ] (implied)
|
||||
.br
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB-Z\fP|\fB--zero\fP \fBy\fP|\fBn\fP ]
|
||||
.br
|
||||
[ \fB--type\fP \fBsnapshot\fP ]
|
||||
.br
|
||||
[ COMMON_OPTIONS ]
|
||||
.ad b
|
||||
.RE
|
||||
|
@@ -225,9 +225,9 @@ Create a linear LV.
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
[ \fB--type linear\fP ] (implied)
|
||||
.br
|
||||
[ \fB--type\fP \fBlinear\fP ]
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ COMMON_OPTIONS ]
|
||||
.ad b
|
||||
@@ -238,19 +238,19 @@ Create a linear LV.
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Create a striped LV (infers --type striped).
|
||||
Create a striped LV.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-i\fP|\fB--stripes\fP \fINumber\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fIVG\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type striped\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBstriped\fP ]
|
||||
.br
|
||||
[ COMMON_OPTIONS ]
|
||||
.ad b
|
||||
.RE
|
||||
@@ -260,16 +260,16 @@ Create a striped LV (infers --type striped).
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Create a raid1 or mirror LV (infers --type raid1|mirror).
|
||||
Create a raid1 or mirror LV.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-m\fP|\fB--mirrors\fP \fINumber\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fIVG\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
[ \fB--type raid1\fP|\fBmirror\fP ] (implied)
|
||||
.br
|
||||
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
@@ -336,6 +336,8 @@ Create a raid10 LV.
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type raid10\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
|
||||
@@ -362,6 +364,8 @@ Create a COW snapshot LV of an origin LV.
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type snapshot\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
|
||||
@@ -370,8 +374,6 @@ Create a COW snapshot LV of an origin LV.
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBsnapshot\fP ]
|
||||
.br
|
||||
[ COMMON_OPTIONS ]
|
||||
.ad b
|
||||
.RE
|
||||
@@ -455,16 +457,17 @@ Create a cache pool.
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Create a thin LV in a thin pool (infers --type thin).
|
||||
Create a thin LV in a thin pool.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] \fB--thinpool\fP \fILV\fP \fIVG\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB-T\fP|\fB--thin\fP ]
|
||||
[ \fB--type thin\fP ] (implied)
|
||||
.br
|
||||
[ \fB--type\fP \fBthin\fP ]
|
||||
.br
|
||||
[ \fB-T\fP|\fB--thin\fP ]
|
||||
.br
|
||||
[ COMMON_OPTIONS ]
|
||||
.ad b
|
||||
@@ -472,16 +475,15 @@ Create a thin LV in a thin pool (infers --type thin).
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Create a thin LV that is a snapshot of an existing thin LV
|
||||
.br
|
||||
(infers --type thin).
|
||||
Create a thin LV that is a snapshot of an existing thin LV.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-s\fP|\fB--snapshot\fP \fILV1\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type\fP \fBthin\fP ]
|
||||
[ \fB--type thin\fP ] (implied)
|
||||
.br
|
||||
.br
|
||||
[ COMMON_OPTIONS ]
|
||||
.ad b
|
||||
@@ -1685,13 +1687,15 @@ Create a sparse COW snapshot LV of a virtual origin LV
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Create a thin pool (infers --type thin-pool).
|
||||
Create a thin pool.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-T\fP|\fB--thin\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fIVG\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type thin-pool\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
|
||||
@@ -1700,8 +1704,6 @@ Create a thin pool (infers --type thin-pool).
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBthin-pool\fP ]
|
||||
.br
|
||||
[ \fB--discards\fP \fBpassdown\fP|\fBnopassdown\fP|\fBignore\fP ]
|
||||
.br
|
||||
[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
|
||||
@@ -1719,15 +1721,15 @@ Create a thin pool (infers --type thin-pool).
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Create a thin pool named by the --thinpool arg
|
||||
.br
|
||||
(infers --type thin-pool).
|
||||
Create a thin pool named in --thinpool.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fB--thinpool\fP \fILV\fP\fI_new\fP \fIVG\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type thin-pool\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
|
||||
@@ -1738,8 +1740,6 @@ Create a thin pool named by the --thinpool arg
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBthin-pool\fP ]
|
||||
.br
|
||||
[ \fB--discards\fP \fBpassdown\fP|\fBnopassdown\fP|\fBignore\fP ]
|
||||
.br
|
||||
[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
|
||||
@@ -1841,18 +1841,17 @@ LV1 types: thinpool
|
||||
.P
|
||||
Create a thin LV in the thin pool named in the first arg
|
||||
.br
|
||||
(variant, infers --type thin, also see --thinpool for
|
||||
.br
|
||||
naming pool.)
|
||||
(also see --thinpool for naming pool.)
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] \fILV1\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB-T\fP|\fB--thin\fP ]
|
||||
[ \fB--type thin\fP ] (implied)
|
||||
.br
|
||||
[ \fB--type\fP \fBthin\fP ]
|
||||
.br
|
||||
[ \fB-T\fP|\fB--thin\fP ]
|
||||
.br
|
||||
[ COMMON_OPTIONS ]
|
||||
.ad b
|
||||
@@ -1883,16 +1882,15 @@ LV1 types: thin
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Create a thin LV that is a snapshot of an existing thin LV
|
||||
.br
|
||||
(infers --type thin).
|
||||
Create a thin LV that is a snapshot of an existing thin LV.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-T\fP|\fB--thin\fP \fILV1\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type\fP \fBthin\fP ]
|
||||
[ \fB--type thin\fP ] (implied)
|
||||
.br
|
||||
.br
|
||||
[ COMMON_OPTIONS ]
|
||||
.ad b
|
||||
@@ -1904,16 +1902,15 @@ LV1 types: thin
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Create a thin LV that is a snapshot of an external origin LV
|
||||
.br
|
||||
(infers --type thin).
|
||||
Create a thin LV that is a snapshot of an external origin LV.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-s\fP|\fB--snapshot\fP \fB--thinpool\fP \fILV\fP \fILV\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type\fP \fBthin\fP ]
|
||||
[ \fB--type thin\fP ] (implied)
|
||||
.br
|
||||
.br
|
||||
[ COMMON_OPTIONS ]
|
||||
.ad b
|
||||
@@ -1928,6 +1925,8 @@ Create a VDO LV with VDO pool.
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type vdo\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
|
||||
@@ -1936,8 +1935,6 @@ Create a VDO LV with VDO pool.
|
||||
.br
|
||||
[ \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBvdo\fP ]
|
||||
.br
|
||||
[ \fB--vdopool\fP \fILV\fP\fI_new\fP ]
|
||||
.br
|
||||
[ \fB--compression\fP \fBy\fP|\fBn\fP ]
|
||||
@@ -1960,6 +1957,8 @@ Create a VDO LV with VDO pool.
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type vdo\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
|
||||
@@ -1968,10 +1967,6 @@ Create a VDO LV with VDO pool.
|
||||
.br
|
||||
[ \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] ]
|
||||
.br
|
||||
[ \fB--vdo\fP ]
|
||||
.br
|
||||
[ \fB--type\fP \fBvdo\fP ]
|
||||
.br
|
||||
[ \fB--compression\fP \fBy\fP|\fBn\fP ]
|
||||
.br
|
||||
[ \fB--deduplication\fP \fBy\fP|\fBn\fP ]
|
||||
@@ -2026,9 +2021,7 @@ where the new thin pool is named by the --thinpool arg.
|
||||
.P
|
||||
Create a thin LV, first creating a thin pool for it,
|
||||
.br
|
||||
where the new thin pool is named by the --thinpool arg
|
||||
.br
|
||||
(variant, infers --type thin).
|
||||
where the new thin pool is named by --thinpool.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT]
|
||||
@@ -2038,6 +2031,8 @@ where the new thin pool is named by the --thinpool arg
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type thin\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
|
||||
@@ -2048,8 +2043,6 @@ where the new thin pool is named by the --thinpool arg
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBthin\fP ]
|
||||
.br
|
||||
[ \fB--discards\fP \fBpassdown\fP|\fBnopassdown\fP|\fBignore\fP ]
|
||||
.br
|
||||
[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
|
||||
@@ -2116,7 +2109,7 @@ where the new thin pool is named in the first arg,
|
||||
.br
|
||||
or the new thin pool name is generated when the first
|
||||
.br
|
||||
arg is a VG name (variant, infers --type thin).
|
||||
arg is a VG name.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-T\fP|\fB--thin\fP \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT]
|
||||
@@ -2126,6 +2119,8 @@ arg is a VG name (variant, infers --type thin).
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type thin\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
|
||||
@@ -2134,8 +2129,6 @@ arg is a VG name (variant, infers --type thin).
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBthin\fP ]
|
||||
.br
|
||||
[ \fB--discards\fP \fBpassdown\fP|\fBnopassdown\fP|\fBignore\fP ]
|
||||
.br
|
||||
[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
|
||||
@@ -2153,15 +2146,11 @@ arg is a VG name (variant, infers --type thin).
|
||||
.P
|
||||
\(em
|
||||
.P
|
||||
Create a thin LV, first creating a thin pool for it
|
||||
.br
|
||||
(infers --type thin).
|
||||
Create a thin LV, first creating a thin pool for it.
|
||||
.br
|
||||
Create a sparse snapshot of a virtual origin LV
|
||||
.br
|
||||
(infers --type snapshot).
|
||||
.br
|
||||
Chooses --type thin or --type snapshot according to
|
||||
Chooses type thin or snapshot according to
|
||||
.br
|
||||
config setting sparse_segtype_default.
|
||||
.br
|
||||
@@ -2170,6 +2159,8 @@ config setting sparse_segtype_default.
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type thin\fP|\fBsnapshot\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
|
||||
@@ -2182,8 +2173,6 @@ config setting sparse_segtype_default.
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fIString\fP ]
|
||||
.br
|
||||
[ \fB--discards\fP \fBpassdown\fP|\fBnopassdown\fP|\fBignore\fP ]
|
||||
.br
|
||||
[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
|
||||
@@ -2203,15 +2192,15 @@ config setting sparse_segtype_default.
|
||||
.P
|
||||
Create a new LV, then attach the specified cachepool
|
||||
.br
|
||||
which converts the new LV to type cache
|
||||
.br
|
||||
(variant, infers --type cache.)
|
||||
which converts the new LV to type cache.
|
||||
.br
|
||||
.P
|
||||
\fBlvcreate\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fB--cachepool\fP \fILV\fP \fIVG\fP
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type cache\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
|
||||
@@ -2222,8 +2211,6 @@ which converts the new LV to type cache
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBcache\fP ]
|
||||
.br
|
||||
[ \fB--cachemode\fP \fBwritethrough\fP|\fBwriteback\fP|\fBpassthrough\fP ]
|
||||
.br
|
||||
[ \fB--cachepolicy\fP \fIString\fP ]
|
||||
@@ -2302,6 +2289,8 @@ and attach it to the LV arg (alternative, use lvconvert.)
|
||||
.br
|
||||
.RS 4
|
||||
.ad l
|
||||
[ \fB--type cache\fP ] (implied)
|
||||
.br
|
||||
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
|
||||
.br
|
||||
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
|
||||
@@ -2310,8 +2299,6 @@ and attach it to the LV arg (alternative, use lvconvert.)
|
||||
.br
|
||||
[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
|
||||
.br
|
||||
[ \fB--type\fP \fBcache\fP ]
|
||||
.br
|
||||
[ \fB--cachemode\fP \fBwritethrough\fP|\fBwriteback\fP|\fBpassthrough\fP ]
|
||||
.br
|
||||
[ \fB--cachepolicy\fP \fIString\fP ]
|
||||
|
@@ -14,3 +14,9 @@ space on PV /dev/sdk3. This is equivalent to specifying
|
||||
Extend an LV by 16MiB using specific physical extents.
|
||||
.br
|
||||
.B lvextend -L+16m vg01/lvol01 /dev/sda:8-9 /dev/sdb:8-9
|
||||
.P
|
||||
Extend an LV to use all remaining free space in volume group
|
||||
and all resize its filesystem with
|
||||
.BR fsadm (8).
|
||||
.br
|
||||
.B lvextend -l+100%FREE -r vg01/lvol01
|
||||
|
@@ -456,7 +456,7 @@ output in JSON format. See \fBlvmreport\fP(7) for more information.
|
||||
.HP
|
||||
\fB-r\fP|\fB--resizefs\fP
|
||||
.br
|
||||
Resize underlying filesystem together with the LV using fsadm(8).
|
||||
Resize underlying filesystem together with the LV using \fBfsadm\fP(8).
|
||||
.
|
||||
.HP
|
||||
\fB-L\fP|\fB--size\fP [\fB+\fP]\fISize\fP[m|UNIT]
|
||||
|
@@ -288,6 +288,7 @@ The LV name may also not contain any of the following strings:
|
||||
.RB ' _cdata ',
|
||||
.RB ' _cmeta ',
|
||||
.RB ' _corig ',
|
||||
.RB ' _iorig ',
|
||||
.RB ' _mimage ',
|
||||
.RB ' _mlog ',
|
||||
.RB ' _pmspare ',
|
||||
|
@@ -234,7 +234,7 @@ output in JSON format. See \fBlvmreport\fP(7) for more information.
|
||||
.HP
|
||||
\fB-r\fP|\fB--resizefs\fP
|
||||
.br
|
||||
Resize underlying filesystem together with the LV using fsadm(8).
|
||||
Resize underlying filesystem together with the LV using \fBfsadm\fP(8).
|
||||
.
|
||||
.HP
|
||||
\fB-L\fP|\fB--size\fP [\fB-\fP]\fISize\fP[m|UNIT]
|
||||
|
@@ -1,6 +1,10 @@
|
||||
.
|
||||
.SH EXAMPLES
|
||||
.
|
||||
Extend an LV by 16MB using specific physical extents:
|
||||
Extend an LV by 16MB using specific physical extents.
|
||||
.br
|
||||
.B lvresize -L+16M vg1/lv1 /dev/sda:0-1 /dev/sdb:0-1
|
||||
.P
|
||||
Resize an LV to use 50% of the size volume group.
|
||||
.br
|
||||
.B lvresize -l50%VG vg1/lv1
|
||||
|
@@ -409,7 +409,7 @@ output in JSON format. See \fBlvmreport\fP(7) for more information.
|
||||
.HP
|
||||
\fB-r\fP|\fB--resizefs\fP
|
||||
.br
|
||||
Resize underlying filesystem together with the LV using fsadm(8).
|
||||
Resize underlying filesystem together with the LV using \fBfsadm\fP(8).
|
||||
.
|
||||
.HP
|
||||
\fB-L\fP|\fB--size\fP [\fB+\fP|\fB-\fP]\fISize\fP[m|UNIT]
|
||||
|
@@ -63,6 +63,7 @@
|
||||
.BR lvmlockctl (8),
|
||||
.BR cmirrord (8),
|
||||
.BR lvmdbusd (8),
|
||||
.BR fsadm (8),
|
||||
.P
|
||||
.BR lvmsystemid (7),
|
||||
.BR lvmreport (7),
|
||||
|
@@ -383,7 +383,7 @@ detect_device_size() {
|
||||
test -n "$DEVSIZE" || error "Cannot read size of device \"$VOLUME\"."
|
||||
SSSIZE=$("$BLOCKDEV" --getss "$VOLUME" || true)
|
||||
test -n "$SSSIZE" || error "Cannot read sector size of device \"$VOLUME\"."
|
||||
DEVSIZE=$(( $DEVSIZE * $SSSIZE ))
|
||||
DEVSIZE=$(( DEVSIZE * SSSIZE ))
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -163,7 +163,7 @@ if (( clustered )); then
|
||||
|
||||
{
|
||||
for i in nodes status services; do
|
||||
cap_i=$(echo "$i"|tr a-z A-Z)
|
||||
cap_i=$(echo "$i"|tr "[:lower:]" "[:upper:]")
|
||||
echo "$cap_i:"
|
||||
echo "----------------------------------"
|
||||
log "cman_tool $i 2>> \"$log\""
|
||||
|
@@ -18,11 +18,11 @@
|
||||
|
||||
# following external commands are used throughout the script
|
||||
# echo and test are internal in bash at least
|
||||
RM=rm
|
||||
BASENAME=basename
|
||||
MKTEMP=mktemp
|
||||
READLINK=readlink
|
||||
GETOPT=getopt
|
||||
RM="rm"
|
||||
BASENAME="basename"
|
||||
MKTEMP="mktemp"
|
||||
READLINK="readlink"
|
||||
GETOPT="getopt"
|
||||
|
||||
# user may override lvm location by setting LVM_BINARY
|
||||
LVM=${LVM_BINARY:-lvm}
|
||||
@@ -145,7 +145,7 @@ do
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
let VERBOSE_COUNT=VERBOSE_COUNT+1
|
||||
VERBOSE_COUNT=$(( VERBOSE_COUNT + 1 ))
|
||||
if [ -z "$VERBOSE" ]
|
||||
then
|
||||
VERBOSE="-v"
|
||||
|
@@ -18,7 +18,7 @@ SKIP_WITH_CLVMD=1
|
||||
. lib/inittest
|
||||
|
||||
# Unsupported with valgrid testing
|
||||
test ${LVM_VALGRIND:-0} -eq 0 || skip "Unsupported with valgrind"
|
||||
test "${LVM_VALGRIND:-0}" -eq 0 || skip "Unsupported with valgrind"
|
||||
|
||||
# NOTE: Some tests, namely anything with vdo, and
|
||||
# api/dbus_test_lv_interface_cache_lv.sh, require larger PVs
|
||||
|
@@ -586,7 +586,7 @@ teardown() {
|
||||
}
|
||||
|
||||
# Remove any metadata archives and backups from this test on system
|
||||
rm -f /etc/lvm/archive/${PREFIX}* /etc/lvm/backup/${PREFIX}*
|
||||
rm -f /etc/lvm/archive/"${PREFIX}"* /etc/lvm/backup/"${PREFIX}"*
|
||||
|
||||
echo "ok"
|
||||
}
|
||||
@@ -669,7 +669,7 @@ prepare_real_devs() {
|
||||
aux extend_filter "a|$path|"
|
||||
dd if=/dev/zero of="$path" bs=32k count=1
|
||||
wipefs -a "$path" 2>/dev/null || true
|
||||
done < $LVM_TEST_DEVICE_LIST
|
||||
done < "$LVM_TEST_DEVICE_LIST"
|
||||
fi
|
||||
printf "%s\\n" "${REAL_DEVICES[@]}" > REAL_DEVICES
|
||||
}
|
||||
@@ -810,9 +810,9 @@ cleanup_md_dev() {
|
||||
# try to find and remove any DM device on top of cleaned MD
|
||||
# assume /dev/mdXXX is 9:MINOR
|
||||
local minor=${mddev##/dev/md}
|
||||
for i in $(dmsetup table | grep 9:$minor | cut -d: -f1) ; do
|
||||
dmsetup remove $i || {
|
||||
dmsetup --force remove $i || true
|
||||
for i in $(dmsetup table | grep 9:"$minor" | cut -d: -f1) ; do
|
||||
dmsetup remove "$i" || {
|
||||
dmsetup --force remove "$i" || true
|
||||
}
|
||||
done
|
||||
|
||||
@@ -842,7 +842,7 @@ wipefs_a() {
|
||||
shift
|
||||
|
||||
if test -n "$LVM_TEST_DEVICES_FILE"; then
|
||||
lvmdevices --deldev $dev || true
|
||||
lvmdevices --deldev "$dev" || true
|
||||
fi
|
||||
|
||||
if test -f HAVE_WIPEFS ; then
|
||||
@@ -866,7 +866,7 @@ wipefs_a() {
|
||||
fi
|
||||
|
||||
if test -n "$LVM_TEST_DEVICES_FILE"; then
|
||||
lvmdevices --adddev $dev || true
|
||||
lvmdevices --adddev "$dev" || true
|
||||
fi
|
||||
|
||||
udev_wait
|
||||
@@ -954,10 +954,10 @@ prepare_devs() {
|
||||
done
|
||||
|
||||
if test -n "$LVM_TEST_DEVICES_FILE"; then
|
||||
mkdir -p $TESTDIR/etc/lvm/devices || true
|
||||
rm $TESTDIR/etc/lvm/devices/system.devices || true
|
||||
mkdir -p "$TESTDIR/etc/lvm/devices" || true
|
||||
rm "$TESTDIR/etc/lvm/devices/system.devices" || true
|
||||
for d in "${DEVICES[@]}"; do
|
||||
lvmdevices --adddev $dev || true
|
||||
lvmdevices --adddev "$dev" || true
|
||||
done
|
||||
fi
|
||||
|
||||
|
@@ -157,7 +157,7 @@ mirror_nonredundant() {
|
||||
attr=$(get lv_field "$lv" attr)
|
||||
(echo "$attr" | grep "^......m...$" >/dev/null) || {
|
||||
if (echo "$attr" | grep "^o.........$" >/dev/null) &&
|
||||
lvs -a $1 | grep -F "[${2}_mimage" >/dev/null; then
|
||||
lvs -a "$1" | grep -F "[${2}_mimage" >/dev/null; then
|
||||
echo "TEST WARNING: $lv is a snapshot origin and looks like a mirror,"
|
||||
echo "assuming it is actually a mirror"
|
||||
else
|
||||
@@ -439,7 +439,7 @@ raid_leg_status() {
|
||||
|
||||
# Ignore inconsisten raid status 0/xxxxx idle
|
||||
for i in {100..0} ; do
|
||||
st=( $(dmsetup status $1-$2) ) || die "Unable to get status of $vg/$lv1"
|
||||
st=( $(dmsetup status "$1-$2") ) || die "Unable to get status of $vg/$lv1"
|
||||
b=( $(echo "${st[6]}" | sed s:/:' ':) )
|
||||
[ "${b[0]}" = "0" ] || {
|
||||
test "${st[5]}" = "$3" || break
|
||||
@@ -448,7 +448,7 @@ raid_leg_status() {
|
||||
sleep .1
|
||||
done
|
||||
|
||||
die "$1-$2 status ${st[5]} != $3 ($st)"
|
||||
die "$1-$2 status ${st[5]} != $3 (${st[*]})"
|
||||
}
|
||||
|
||||
grep_dmsetup() {
|
||||
|
@@ -279,7 +279,7 @@ prepare_test_vars() {
|
||||
while read path; do
|
||||
count=$(( count + 1 ))
|
||||
eval "dev$count=\"$path\""
|
||||
done < $LVM_TEST_DEVICE_LIST
|
||||
done < "$LVM_TEST_DEVICE_LIST"
|
||||
else
|
||||
for i in {1..16}; do
|
||||
eval "dev$i=\"$DM_DEV_DIR/mapper/${PREFIX}pv$i\""
|
||||
|
@@ -60,7 +60,7 @@ done
|
||||
|
||||
# raid1 supports resynchronization
|
||||
lvcreate --type raid1 -m 2 -Zn -l 4 -n $lv1 $vg
|
||||
check raid_leg_status $vg $lv1 "aaa"
|
||||
should check raid_leg_status $vg $lv1 "aaa"
|
||||
_sync "AAA"
|
||||
|
||||
# raid1 supports --nosync
|
||||
@@ -72,7 +72,7 @@ for r in $segtypes
|
||||
do
|
||||
# raid4/5 support resynchronization
|
||||
lvcreate --type $r -Zn -i 3 -L10 -n $lv1 $vg
|
||||
check raid_leg_status $vg $lv1 "aaaa"
|
||||
should check raid_leg_status $vg $lv1 "aaaa"
|
||||
_sync "AAAA"
|
||||
|
||||
# raid4/5 support --nosync
|
||||
@@ -83,7 +83,7 @@ done
|
||||
|
||||
# raid6 supports resynchronization
|
||||
lvcreate --type raid6 -Zn -i 3 -l 4 -n $lv1 $vg
|
||||
check raid_leg_status $vg $lv1 "aaaaa"
|
||||
should check raid_leg_status $vg $lv1 "aaaaa"
|
||||
_sync "AAAAA"
|
||||
|
||||
# raid6 rejects --nosync; it has to initialize P- and Q-Syndromes
|
||||
@@ -91,7 +91,7 @@ not lvcreate --type raid6 --nosync -Zn -i 3 -l 1 -n $lv1 $vg
|
||||
|
||||
# raid10 supports resynchronization
|
||||
lvcreate --type raid10 -m 1 -Zn -i 3 -L10 -n $lv1 $vg
|
||||
check raid_leg_status $vg $lv1 "aaaaaa"
|
||||
should check raid_leg_status $vg $lv1 "aaaaaa"
|
||||
_sync "AAAAAA"
|
||||
|
||||
# raid10 supports --nosync
|
||||
|
@@ -155,6 +155,10 @@ arg(cachesize_ARG, '\0', "cachesize", sizemb_VAL, 0, 0,
|
||||
arg(check_ARG, '\0', "check", 0, 0, 0,
|
||||
"Check the content of the devices file.\n")
|
||||
|
||||
arg(detectfs_ARG, '\0', "detectfs", bool_VAL, 0, 0,
|
||||
"Check the LV for file system information. This activates the LV if\n"
|
||||
"needed so that the LV can be read to look for fs superblocks.\n")
|
||||
|
||||
arg(commandprofile_ARG, '\0', "commandprofile", string_VAL, 0, 0,
|
||||
"The command profile to use for command configuration.\n"
|
||||
"See \\fBlvm.conf\\fP(5) for more information about profiles.\n")
|
||||
@@ -1386,7 +1390,7 @@ arg(readahead_ARG, 'r', "readahead", readahead_VAL, 0, 0,
|
||||
"\\fBnone\\fP is equivalent to zero.\n")
|
||||
|
||||
arg(resizefs_ARG, 'r', "resizefs", 0, 0, 0,
|
||||
"Resize underlying filesystem together with the LV using fsadm(8).\n")
|
||||
"Resize underlying filesystem together with the LV using \\fBfsadm\\fP(8).\n")
|
||||
|
||||
/* Not used */
|
||||
arg(reset_ARG, 'R', "reset", 0, 0, 0, NULL)
|
||||
|
@@ -163,6 +163,22 @@
|
||||
# RULE: LV_type1 and lv_is_prop1
|
||||
#
|
||||
#
|
||||
# AUTOTYPE: <segtype>
|
||||
# The cmd def implies the type. Optionally using --type foo
|
||||
# is not wrong, but it's redundant. If --type is specified
|
||||
# it is not used in matching a user command to the cmd def,
|
||||
# but once a user cmd is matched to the cmd def, a specified
|
||||
# type is compared to the AUTOTYPE to ensure they match.
|
||||
# We avoid including --type foo in the OO list because doing
|
||||
# so often makes the cmd def redundant with another cmd def
|
||||
# that has --type foo in its required_options. We want a user
|
||||
# command to only match a single cmd def.
|
||||
# Usually, a user command with --type foo will match a cmd def
|
||||
# that includes --type foo in its required_options.
|
||||
#
|
||||
# For lvcreate cmd defs, each should either include --type foo
|
||||
# in required_options, or it should include AUTOTYPE foo
|
||||
# (and not include --type in OO).
|
||||
|
||||
#
|
||||
# For efficiency, sets of options can be defined and reused
|
||||
@@ -445,11 +461,11 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
|
||||
|
||||
# alternate form of lvconvert --type thin
|
||||
lvconvert --thin --thinpool LV LV_linear_striped_raid_cache_thin_error_zero
|
||||
OO: --type thin, --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||
OO: --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||
ID: lvconvert_to_thin_with_external
|
||||
DESC: Convert LV to a thin LV, using the original LV as an external origin
|
||||
DESC: (infers --type thin).
|
||||
DESC: Convert LV to a thin LV, using the original LV as an external origin.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: thin
|
||||
RULE: all and lv_is_visible
|
||||
RULE: all not lv_is_locked lv_is_raid_with_integrity
|
||||
RULE: --poolmetadata not --readahead --stripesize --stripes_long
|
||||
@@ -466,13 +482,14 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
|
||||
|
||||
# alternate form of lvconvert --type cache
|
||||
lvconvert --cache --cachepool LV LV_linear_striped_raid_thinpool_vdo_vdopool_vdopooldata
|
||||
OO: --type cache, OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||
OO: OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||
ID: lvconvert_to_cache_with_cachepool
|
||||
DESC: Attach a cache pool to an LV (infers --type cache).
|
||||
DESC: Attach a cache pool to an LV.
|
||||
RULE: all and lv_is_visible
|
||||
RULE: all not lv_is_raid_with_integrity
|
||||
RULE: --poolmetadata not --readahead --stripesize --stripes_long
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: cache
|
||||
|
||||
---
|
||||
|
||||
@@ -550,7 +567,7 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
|
||||
# of creating a pool or swapping metadata should be used.
|
||||
|
||||
lvconvert --thinpool LV_linear_striped_raid_cache_thinpool
|
||||
OO: --type thin-pool, --stripes_long Number, --stripesize SizeKB,
|
||||
OO: --stripes_long Number, --stripesize SizeKB,
|
||||
OO_LVCONVERT_THINPOOL, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||
OP: PV ...
|
||||
ID: lvconvert_to_thinpool_or_swap_metadata
|
||||
@@ -560,6 +577,7 @@ FLAGS: PREVIOUS_SYNTAX
|
||||
RULE: all and lv_is_visible
|
||||
RULE: all not lv_is_raid_with_integrity
|
||||
RULE: --poolmetadata not --readahead --stripesize --stripes_long
|
||||
AUTOTYPE: thin-pool
|
||||
|
||||
---
|
||||
|
||||
@@ -593,6 +611,17 @@ RULE: all not lv_is_raid_with_integrity
|
||||
# This command syntax is deprecated, and the primary forms
|
||||
# of creating a pool or swapping metadata should be used.
|
||||
|
||||
# FIXME
|
||||
# AUTOTYPE: cache-pool doesn't work here.
|
||||
# A strange command matches this cmd def:
|
||||
# lvconvert --type cache-pool --cachepool LV
|
||||
# where the LV is already a cache pool. That command
|
||||
# seems to be used to change properties on an existing cache pool.
|
||||
# The command lvconvert --type cache-pool LV will also change
|
||||
# properties on an existing cache pool.
|
||||
# Neither seems like a logical command to change properties
|
||||
# of an LV, wouldn't lvchange do that?
|
||||
|
||||
lvconvert --cachepool LV_linear_striped_raid_cachepool_error_zero
|
||||
OO: --type cache-pool, OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||
OP: PV ...
|
||||
@@ -614,12 +643,13 @@ RULE: all and lv_is_visible
|
||||
RULE: all not lv_is_locked lv_is_origin lv_is_merging_origin lv_is_external_origin lv_is_virtual lv_is_raid_with_integrity
|
||||
|
||||
lvconvert --vdopool LV_linear_striped_raid_cache
|
||||
OO: --type vdo-pool, OO_LVCONVERT_VDO, OO_LVCONVERT, --name LV_new, --virtualsize SizeMB,
|
||||
OO: OO_LVCONVERT_VDO, OO_LVCONVERT, --name LV_new, --virtualsize SizeMB,
|
||||
ID: lvconvert_to_vdopool_param
|
||||
DESC: Convert LV to type vdopool.
|
||||
RULE: all and lv_is_visible
|
||||
RULE: all not lv_is_locked lv_is_origin lv_is_merging_origin lv_is_external_origin lv_is_virtual lv_is_raid_with_integrity
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: vdo-pool
|
||||
|
||||
---
|
||||
|
||||
@@ -712,13 +742,14 @@ RULE: all not lv_is_locked lv_is_pvmove
|
||||
RULE: all and lv_is_visible
|
||||
|
||||
lvconvert --snapshot LV LV_linear_striped
|
||||
OO: --type snapshot, --chunksize SizeKB, --zero Bool, OO_LVCONVERT
|
||||
OO: --chunksize SizeKB, --zero Bool, OO_LVCONVERT
|
||||
ID: lvconvert_combine_split_snapshot
|
||||
DESC: Combine a former COW snapshot (second arg) with a former
|
||||
DESC: origin LV (first arg) to reverse a splitsnapshot command.
|
||||
RULE: all not lv_is_locked lv_is_pvmove
|
||||
RULE: all and lv_is_visible
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: snapshot
|
||||
|
||||
---
|
||||
|
||||
@@ -836,11 +867,12 @@ DESC: Create a linear LV.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
|
||||
lvcreate --size SizeMB VG
|
||||
OO: --type linear, OO_LVCREATE
|
||||
OO: OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --mirrors 0, --stripes 1
|
||||
ID: lvcreate_linear
|
||||
DESC: Create a linear LV.
|
||||
AUTOTYPE: linear
|
||||
|
||||
---
|
||||
|
||||
@@ -880,10 +912,11 @@ FLAGS: SECONDARY_SYNTAX
|
||||
|
||||
# R13 (just --stripes)
|
||||
lvcreate --stripes Number --size SizeMB VG
|
||||
OO: --stripesize SizeKB, --type striped, OO_LVCREATE
|
||||
OO: --stripesize SizeKB, OO_LVCREATE
|
||||
OP: PV ...
|
||||
ID: lvcreate_striped
|
||||
DESC: Create a striped LV (infers --type striped).
|
||||
DESC: Create a striped LV.
|
||||
AUTOTYPE: striped
|
||||
|
||||
# R5,R7 (--type mirror with or without --mirrors)
|
||||
lvcreate --type mirror --size SizeMB VG
|
||||
@@ -897,11 +930,13 @@ FLAGS: SECONDARY_SYNTAX
|
||||
# R14 (just --mirrors)
|
||||
# alternate form of lvcreate --type raid1|mirror
|
||||
lvcreate --mirrors PNumber --size SizeMB VG
|
||||
OO: --stripes Number, --stripesize SizeKB,
|
||||
--mirrorlog MirrorLog, --regionsize RegionSize, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB, OO_LVCREATE
|
||||
OO: --stripesize SizeKB, --mirrorlog MirrorLog, --regionsize RegionSize, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB, OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --stripes 1
|
||||
ID: lvcreate_mirror_or_raid1
|
||||
DESC: Create a raid1 or mirror LV (infers --type raid1|mirror).
|
||||
DESC: Create a raid1 or mirror LV.
|
||||
AUTOTYPE: raid1
|
||||
AUTOTYPE: mirror
|
||||
|
||||
# R9,R10,R11,R12 (--type raid with any use of --stripes/--mirrors)
|
||||
lvcreate --type raid --size SizeMB VG
|
||||
@@ -913,11 +948,14 @@ ID: lvcreate_raid_any
|
||||
DESC: Create a raid LV (a specific raid level must be used, e.g. raid1).
|
||||
|
||||
# R15 (--stripes and --mirrors which implies raid10)
|
||||
# FIXME: --mirrors N --stripes 1 is raid1|mirror and should only
|
||||
# match the cmd def above for raid1|mirror with IO: --stripes 1
|
||||
lvcreate --mirrors PNumber --stripes Number --size SizeMB VG
|
||||
OO: --stripesize SizeKB, --regionsize RegionSize, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB, OO_LVCREATE
|
||||
OP: PV ...
|
||||
ID: lvcreate_raid_any
|
||||
DESC: Create a raid10 LV.
|
||||
AUTOTYPE: raid10
|
||||
|
||||
---
|
||||
|
||||
@@ -937,11 +975,12 @@ DESC: (also see --snapshot).
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
|
||||
lvcreate --snapshot --size SizeMB LV
|
||||
OO: --type snapshot, --stripes Number, --stripesize SizeKB,
|
||||
OO: --stripes Number, --stripesize SizeKB,
|
||||
--chunksize SizeKB, OO_LVCREATE
|
||||
OP: PV ...
|
||||
ID: lvcreate_cow_snapshot
|
||||
DESC: Create a COW snapshot LV of an origin LV.
|
||||
AUTOTYPE: snapshot
|
||||
|
||||
---
|
||||
|
||||
@@ -966,24 +1005,24 @@ DESC: Create a thin pool.
|
||||
|
||||
# alternate form of lvcreate --type thin-pool
|
||||
lvcreate --thin --size SizeMB VG
|
||||
OO: --stripes Number, --stripesize SizeKB,
|
||||
--type thin-pool, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
|
||||
OO: --stripes Number, --stripesize SizeKB, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thinpool
|
||||
DESC: Create a thin pool (infers --type thin-pool).
|
||||
DESC: Create a thin pool.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: thin-pool
|
||||
|
||||
# alternate form of lvcreate --type thin-pool
|
||||
lvcreate --size SizeMB --thinpool LV_new VG
|
||||
OO: --stripes Number, --stripesize SizeKB,
|
||||
--thin, --type thin-pool, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
|
||||
--thin, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thinpool
|
||||
DESC: Create a thin pool named by the --thinpool arg
|
||||
DESC: (infers --type thin-pool).
|
||||
DESC: Create a thin pool named in --thinpool.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: thin-pool
|
||||
|
||||
---
|
||||
|
||||
@@ -1032,20 +1071,21 @@ FLAGS: SECONDARY_SYNTAX
|
||||
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --virtualsize SizeMB --thinpool LV_thinpool VG
|
||||
OO: --type thin, --thin, OO_LVCREATE
|
||||
OO: --thin, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol
|
||||
DESC: Create a thin LV in a thin pool (infers --type thin).
|
||||
DESC: Create a thin LV in a thin pool.
|
||||
AUTOTYPE: thin
|
||||
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --virtualsize SizeMB LV_thinpool
|
||||
OO: --type thin, --thin, OO_LVCREATE
|
||||
OO: --thin, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol
|
||||
DESC: Create a thin LV in the thin pool named in the first arg
|
||||
DESC: (variant, infers --type thin, also see --thinpool for
|
||||
DESC: naming pool.)
|
||||
DESC: (also see --thinpool for naming pool.)
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: thin
|
||||
|
||||
---
|
||||
|
||||
@@ -1058,20 +1098,20 @@ FLAGS: SECONDARY_SYNTAX
|
||||
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --thin LV_thin
|
||||
OO: --type thin, OO_LVCREATE
|
||||
OO: OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_snapshot
|
||||
DESC: Create a thin LV that is a snapshot of an existing thin LV
|
||||
DESC: (infers --type thin).
|
||||
DESC: Create a thin LV that is a snapshot of an existing thin LV.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: thin
|
||||
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --snapshot LV_thin
|
||||
OO: --type thin, OO_LVCREATE
|
||||
OO: OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_snapshot
|
||||
DESC: Create a thin LV that is a snapshot of an existing thin LV
|
||||
DESC: (infers --type thin).
|
||||
DESC: Create a thin LV that is a snapshot of an existing thin LV.
|
||||
AUTOTYPE: thin
|
||||
|
||||
lvcreate --type thin --thinpool LV_thinpool LV
|
||||
OO: --thin, OO_LVCREATE
|
||||
@@ -1081,12 +1121,12 @@ DESC: Create a thin LV that is a snapshot of an external origin LV.
|
||||
|
||||
# alternate form of lvcreate --type thin --thinpool LV_thinpool LV
|
||||
lvcreate --snapshot --thinpool LV_thinpool LV
|
||||
OO: --type thin, OO_LVCREATE
|
||||
OO: OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_snapshot_of_external
|
||||
DESC: Create a thin LV that is a snapshot of an external origin LV
|
||||
DESC: (infers --type thin).
|
||||
DESC: Create a thin LV that is a snapshot of an external origin LV.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: thin
|
||||
|
||||
---
|
||||
|
||||
@@ -1100,21 +1140,23 @@ DESC: Create a LV that returns VDO when used.
|
||||
|
||||
lvcreate --vdo --size SizeMB VG
|
||||
OO: --stripes Number, --stripesize SizeKB,
|
||||
--type vdo, --virtualsize SizeMB, --vdopool LV_new, OO_LVCREATE_VDO, OO_LVCREATE
|
||||
--virtualsize SizeMB, --vdopool LV_new, OO_LVCREATE_VDO, OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_vdo_vol
|
||||
DESC: Create a VDO LV with VDO pool.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: vdo
|
||||
|
||||
lvcreate --vdopool LV_new --size SizeMB VG
|
||||
OO: --stripes Number, --stripesize SizeKB,
|
||||
--vdo, --type vdo, --virtualsize SizeMB, OO_LVCREATE_VDO, OO_LVCREATE
|
||||
--virtualsize SizeMB, OO_LVCREATE_VDO, OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_vdo_vol
|
||||
DESC: Create a VDO LV with VDO pool.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: vdo
|
||||
|
||||
---
|
||||
|
||||
@@ -1147,14 +1189,14 @@ FLAGS: SECONDARY_SYNTAX
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --virtualsize SizeMB --size SizeMB --thinpool LV_new VG
|
||||
OO: --stripes Number, --stripesize SizeKB,
|
||||
--type thin, --thin, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
|
||||
--thin, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol_and_thinpool
|
||||
DESC: Create a thin LV, first creating a thin pool for it,
|
||||
DESC: where the new thin pool is named by the --thinpool arg
|
||||
DESC: (variant, infers --type thin).
|
||||
DESC: where the new thin pool is named by --thinpool.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: thin
|
||||
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --type thin --virtualsize SizeMB --size SizeMB LV_new|VG
|
||||
@@ -1172,32 +1214,32 @@ FLAGS: SECONDARY_SYNTAX
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --thin --virtualsize SizeMB --size SizeMB LV_new|VG
|
||||
OO: --stripes Number, --stripesize SizeKB,
|
||||
--type thin, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
|
||||
OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol_and_thinpool
|
||||
DESC: Create a thin LV, first creating a thin pool for it,
|
||||
DESC: where the new thin pool is named in the first arg,
|
||||
DESC: or the new thin pool name is generated when the first
|
||||
DESC: arg is a VG name (variant, infers --type thin).
|
||||
DESC: arg is a VG name.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: thin
|
||||
|
||||
---
|
||||
|
||||
lvcreate --size SizeMB --virtualsize SizeMB VG
|
||||
OO: --stripes Number, --stripesize SizeKB,
|
||||
--type String, --snapshot, --thin,
|
||||
OO: --stripes Number, --stripesize SizeKB, --snapshot, --thin,
|
||||
OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol_with_thinpool_or_sparse_snapshot
|
||||
DESC: Create a thin LV, first creating a thin pool for it
|
||||
DESC: (infers --type thin).
|
||||
DESC: Create a thin LV, first creating a thin pool for it.
|
||||
DESC: Create a sparse snapshot of a virtual origin LV
|
||||
DESC: (infers --type snapshot).
|
||||
DESC: Chooses --type thin or --type snapshot according to
|
||||
DESC: Chooses type thin or snapshot according to
|
||||
DESC: config setting sparse_segtype_default.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: thin
|
||||
AUTOTYPE: snapshot
|
||||
|
||||
---
|
||||
|
||||
@@ -1217,13 +1259,13 @@ DESC: which converts the new LV to type cache.
|
||||
# (omits the --type cache option which is inferred)
|
||||
lvcreate --size SizeMB --cachepool LV_cachepool VG
|
||||
OO: --stripes Number, --stripesize SizeKB,
|
||||
--cache, --type cache, OO_LVCREATE_CACHE, OO_LVCREATE
|
||||
--cache, OO_LVCREATE_CACHE, OO_LVCREATE
|
||||
OP: PV ...
|
||||
ID: lvcreate_and_attach_cachepool_v2
|
||||
DESC: Create a new LV, then attach the specified cachepool
|
||||
DESC: which converts the new LV to type cache
|
||||
DESC: (variant, infers --type cache.)
|
||||
DESC: which converts the new LV to type cache.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: cache
|
||||
|
||||
# alternate form of lvcreate --type cache
|
||||
# (moves cachepool from option arg to position arg,
|
||||
@@ -1260,7 +1302,7 @@ FLAGS: SECONDARY_SYNTAX
|
||||
# the LV type is known.
|
||||
|
||||
lvcreate --cache --size SizeMB LV
|
||||
OO: --type cache, OO_LVCREATE_CACHE, OO_LVCREATE_POOL, OO_LVCREATE,
|
||||
OO: OO_LVCREATE_CACHE, OO_LVCREATE_POOL, OO_LVCREATE,
|
||||
--stripes Number, --stripesize SizeKB
|
||||
OP: PV ...
|
||||
ID: lvcreate_new_plus_old_cachepool_or_lvconvert_old_plus_new_cachepool
|
||||
@@ -1270,6 +1312,7 @@ DESC: (variant, use --type cache and --cachepool.)
|
||||
DESC: When the LV arg is not a cachepool, then create a new cachepool
|
||||
DESC: and attach it to the LV arg (alternative, use lvconvert.)
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
AUTOTYPE: cache
|
||||
|
||||
---
|
||||
|
||||
@@ -1406,7 +1449,7 @@ DESC: Remove the devices file entry for the given PVID.
|
||||
|
||||
lvreduce --size NSizeMB LV
|
||||
OO: --autobackup Bool, --force, --nofsck, --noudevsync,
|
||||
--reportformat ReportFmt, --resizefs
|
||||
--reportformat ReportFmt, --resizefs, --detectfs Bool
|
||||
ID: lvreduce_general
|
||||
|
||||
---
|
||||
@@ -1436,7 +1479,7 @@ lvresize --size SSizeMB LV
|
||||
OO: --alloc Alloc, --autobackup Bool, --force,
|
||||
--nofsck, --nosync, --noudevsync, --reportformat ReportFmt, --resizefs,
|
||||
--stripes Number, --stripesize SizeKB, --poolmetadatasize PSizeMB,
|
||||
--type SegType
|
||||
--type SegType, --detectfs Bool
|
||||
OP: PV ...
|
||||
ID: lvresize_by_size
|
||||
DESC: Resize an LV by a specified size.
|
||||
@@ -1445,7 +1488,7 @@ lvresize LV PV ...
|
||||
OO: --alloc Alloc, --autobackup Bool, --force,
|
||||
--nofsck, --nosync, --noudevsync,
|
||||
--reportformat ReportFmt, --resizefs, --stripes Number, --stripesize SizeKB,
|
||||
--type SegType
|
||||
--type SegType, --detectfs Bool
|
||||
ID: lvresize_by_pv
|
||||
DESC: Resize an LV by specified PV extents.
|
||||
|
||||
|
@@ -645,6 +645,13 @@ static int _is_desc_line(char *str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _is_autotype_line(char *str)
|
||||
{
|
||||
if (!strncmp(str, "AUTOTYPE:", 6))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _is_flags_line(char *str)
|
||||
{
|
||||
if (!strncmp(str, "FLAGS:", 6))
|
||||
@@ -1209,6 +1216,19 @@ static void _add_flags(struct command *cmd, char *line)
|
||||
cmd->cmd_flags |= CMD_FLAG_PREVIOUS_SYNTAX;
|
||||
}
|
||||
|
||||
static void _add_autotype(struct cmd_context *cmdtool, struct command *cmd, char *line)
|
||||
{
|
||||
int line_argc;
|
||||
char *line_argv[MAX_LINE_ARGC];
|
||||
|
||||
_split_line(line, &line_argc, line_argv, ' ');
|
||||
|
||||
if (cmd->autotype)
|
||||
cmd->autotype2 = dm_pool_strdup(cmdtool->libmem, line_argv[1]);
|
||||
else
|
||||
cmd->autotype = dm_pool_strdup(cmdtool->libmem, line_argv[1]);
|
||||
}
|
||||
|
||||
#define MAX_RULE_OPTS 64
|
||||
|
||||
static void _add_rule(struct cmd_context *cmdtool, struct command *cmd, char *line)
|
||||
@@ -1535,6 +1555,11 @@ int define_commands(struct cmd_context *cmdtool, const char *run_name)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_is_autotype_line(line_argv[0]) && !skip && cmd) {
|
||||
_add_autotype(cmdtool, cmd, line_orig);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_is_flags_line(line_argv[0]) && !skip && cmd) {
|
||||
_add_flags(cmd, line_orig);
|
||||
continue;
|
||||
@@ -1951,6 +1976,14 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
|
||||
goto op_count;
|
||||
|
||||
if (cmd->oo_count) {
|
||||
if (cmd->autotype) {
|
||||
printf("\n\t");
|
||||
if (!cmd->autotype2)
|
||||
printf("[ --type %s ] (implied)", cmd->autotype);
|
||||
else
|
||||
printf("[ --type %s|%s ] (implied)", cmd->autotype, cmd->autotype2);
|
||||
}
|
||||
|
||||
if (include_extents) {
|
||||
printf("\n\t[ -l|--extents ");
|
||||
_print_val_usage(cmd, extents_ARG, opt_names[extents_ARG].val_enum);
|
||||
@@ -2489,7 +2522,7 @@ static const char *_man_long_opt_name(const char *cmdname, int opt_enum)
|
||||
}
|
||||
|
||||
if (strchr(long_opt, '[')) {
|
||||
for (i = 0; i < sizeof(long_opt_name); ++long_opt, ++i) {
|
||||
for (i = 0; i < sizeof(long_opt_name) - 1; ++long_opt, ++i) {
|
||||
if (i < (sizeof(long_opt_name) - 8))
|
||||
switch(*long_opt) {
|
||||
case '[':
|
||||
@@ -2727,6 +2760,15 @@ static void _print_man_usage(char *lvmname, struct command *cmd)
|
||||
printf(".RS 4\n");
|
||||
printf(".ad l\n");
|
||||
|
||||
if (cmd->autotype) {
|
||||
if (!cmd->autotype2)
|
||||
printf("[ \\fB--type %s\\fP ] (implied)\n", cmd->autotype);
|
||||
else
|
||||
printf("[ \\fB--type %s\\fP|\\fB%s\\fP ] (implied)\n", cmd->autotype, cmd->autotype2);
|
||||
printf(".br\n");
|
||||
sep = 1;
|
||||
}
|
||||
|
||||
if (include_extents) {
|
||||
/*
|
||||
* NB we don't just pass extents_VAL here because the
|
||||
|
@@ -208,6 +208,10 @@ struct command {
|
||||
|
||||
struct cmd_rule rules[CMD_MAX_RULES];
|
||||
|
||||
/* usually only one autotype, in one case there are two */
|
||||
char *autotype;
|
||||
char *autotype2;
|
||||
|
||||
int any_ro_count;
|
||||
|
||||
int ro_count;
|
||||
|
@@ -1373,7 +1373,8 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
|
||||
|
||||
if (!*lp->type_str) {
|
||||
lp->type_str = SEG_TYPE_NAME_RAID1;
|
||||
lp->segtype = get_segtype_from_string(lv->vg->cmd, SEG_TYPE_NAME_RAID1);
|
||||
if (!(lp->segtype = get_segtype_from_string(lv->vg->cmd, SEG_TYPE_NAME_RAID1)))
|
||||
return_0;
|
||||
type_enforced = 1;
|
||||
}
|
||||
}
|
||||
|
@@ -1708,6 +1708,15 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the cmd def has an implied type, specified in AUTOTYPE,
|
||||
* then if the user command has --type, it must match.
|
||||
*/
|
||||
if (type_arg && commands[i].autotype && strcmp(type_arg, commands[i].autotype))
|
||||
continue;
|
||||
if (type_arg && commands[i].autotype2 && strcmp(type_arg, commands[i].autotype2))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* '--type foo' is special. If the user has set --type foo, then
|
||||
* we will only look at command defs that include the same --type foo
|
||||
|
@@ -62,8 +62,12 @@ static void _search_devs_for_pvids(struct cmd_context *cmd, struct dm_list *sear
|
||||
* searching for.
|
||||
*/
|
||||
dm_list_iterate_items_safe(devl, devl2, &devs) {
|
||||
int has_pvid;
|
||||
|
||||
/* sets dev->pvid if an lvm label with pvid is found */
|
||||
if (!label_read_pvid(devl->dev))
|
||||
if (!label_read_pvid(devl->dev, &has_pvid))
|
||||
continue;
|
||||
if (!has_pvid)
|
||||
continue;
|
||||
|
||||
found = 0;
|
||||
@@ -181,7 +185,8 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
|
||||
continue;
|
||||
dev = du->dev;
|
||||
|
||||
label_read_pvid(dev);
|
||||
if (!label_read_pvid(dev, NULL))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* label_read_pvid has read the first 4K of the device
|
||||
@@ -283,7 +288,10 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
|
||||
* (it's ok if the device is not a PV and has no PVID)
|
||||
*/
|
||||
label_scan_setup_bcache();
|
||||
label_read_pvid(dev);
|
||||
if (!label_read_pvid(dev, NULL)) {
|
||||
log_error("Failed to read %s.", devname);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allow filtered devices to be added to devices_file, but
|
||||
|
@@ -39,6 +39,13 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,
|
||||
else
|
||||
lp->resize = LV_ANY;
|
||||
|
||||
if (lp->resize == LV_REDUCE) {
|
||||
if (arg_is_set(cmd, detectfs_ARG))
|
||||
lp->detectfs = arg_int_value(cmd, detectfs_ARG, 1);
|
||||
else
|
||||
lp->detectfs = 1;
|
||||
}
|
||||
|
||||
lp->sign = lp->poolmetadata_sign = SIGN_NONE;
|
||||
|
||||
if ((lp->use_policies = arg_is_set(cmd, usepolicies_ARG))) {
|
||||
|
@@ -54,7 +54,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
|
||||
}
|
||||
|
||||
/* If in a VG, must change using volume group. */
|
||||
if (!is_orphan(pv)) {
|
||||
if (vg && !is_orphan(pv)) {
|
||||
if (tagargs && !(vg->fid->fmt->features & FMT_TAGS)) {
|
||||
log_error("Volume group containing %s does not "
|
||||
"support tags", pv_name);
|
||||
@@ -134,7 +134,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
|
||||
}
|
||||
|
||||
if (arg_is_set(cmd, metadataignore_ARG)) {
|
||||
if ((vg_mda_copies(vg) != VGMETADATACOPIES_UNMANAGED) &&
|
||||
if (vg && (vg_mda_copies(vg) != VGMETADATACOPIES_UNMANAGED) &&
|
||||
(arg_count(cmd, force_ARG) == PROMPT) &&
|
||||
yes_no_prompt("Override preferred number of copies "
|
||||
"of VG %s metadata? [y/n]: ",
|
||||
@@ -175,7 +175,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
|
||||
}
|
||||
|
||||
log_verbose("Updating physical volume \"%s\"", pv_name);
|
||||
if (!is_orphan(pv)) {
|
||||
if (vg && !is_orphan(pv)) {
|
||||
if (!vg_write(vg) || !vg_commit(vg)) {
|
||||
log_error("Failed to store physical volume \"%s\" in "
|
||||
"volume group \"%s\"", pv_name, vg->name);
|
||||
|
@@ -1774,6 +1774,7 @@ static int _get_one_setting(struct cmd_context *cmd, struct settings *set, char
|
||||
}
|
||||
|
||||
if (!strncmp(key, "backup_file", strlen("backup_file"))) {
|
||||
free(set->backup_file);
|
||||
if ((set->backup_file = strdup(val)))
|
||||
return 1;
|
||||
return 0;
|
||||
@@ -3186,8 +3187,8 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
|
||||
|
||||
if (argc == 1)
|
||||
setup_device(cmd, argv[0]);
|
||||
else
|
||||
setup_devices(cmd);
|
||||
else if (!setup_devices(cmd))
|
||||
return ECMD_FAILED;
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
pv_name = argv[i];
|
||||
|
@@ -848,7 +848,7 @@ static int _get_devs_from_saved_vg(struct cmd_context *cmd, const char *vgname,
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (!(devl = zalloc(sizeof(*devl))))
|
||||
if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
|
||||
goto_bad;
|
||||
|
||||
devl->dev = dev;
|
||||
@@ -1232,7 +1232,8 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
|
||||
|
||||
if (!vg) {
|
||||
log_print("pvscan[%d] PV %s has no VG metadata.", getpid(), dev_name(dev));
|
||||
fmt->ops->destroy_instance(fid);
|
||||
if (fid)
|
||||
fmt->ops->destroy_instance(fid);
|
||||
goto online;
|
||||
}
|
||||
|
||||
@@ -1545,7 +1546,15 @@ static int _pvscan_cache_args(struct cmd_context *cmd, int argc, char **argv,
|
||||
label_scan_setup_bcache();
|
||||
|
||||
dm_list_iterate_items_safe(devl, devl2, &pvscan_devs) {
|
||||
if (!label_read_pvid(devl->dev)) {
|
||||
int has_pvid;
|
||||
|
||||
if (!label_read_pvid(devl->dev, &has_pvid)) {
|
||||
log_print("pvscan[%d] %s cannot read.", getpid(), dev_name(devl->dev));
|
||||
dm_list_del(&devl->list);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!has_pvid) {
|
||||
/* Not an lvm device */
|
||||
log_print("pvscan[%d] %s not an lvm device.", getpid(), dev_name(devl->dev));
|
||||
dm_list_del(&devl->list);
|
||||
|
@@ -4000,6 +4000,7 @@ static int _process_duplicate_pvs(struct cmd_context *cmd,
|
||||
int ret = 0;
|
||||
|
||||
struct physical_volume dummy_pv = {
|
||||
.pe_size = 1,
|
||||
.tags = DM_LIST_HEAD_INIT(dummy_pv.tags),
|
||||
.segments= DM_LIST_HEAD_INIT(dummy_pv.segments),
|
||||
};
|
||||
|
@@ -311,7 +311,7 @@ static int _move_raids(struct volume_group *vg_from,
|
||||
/* Ignore, if no allocations on PVs of @vg_to */
|
||||
if (!lv_is_on_pvs(lv, &vg_to->pvs))
|
||||
continue;
|
||||
|
||||
|
||||
/* If allocations are on PVs of @vg_to -> move RAID LV stack across */
|
||||
if (!_move_one_lv(vg_from, vg_to, lvh, &lvht))
|
||||
return_0;
|
||||
@@ -341,8 +341,9 @@ static int _move_thins(struct volume_group *vg_from,
|
||||
|
||||
if ((_lv_is_in_vg(vg_to, data_lv) ||
|
||||
_lv_is_in_vg(vg_to, seg->external_lv))) {
|
||||
if (_lv_is_in_vg(vg_from, seg->external_lv) ||
|
||||
_lv_is_in_vg(vg_from, data_lv)) {
|
||||
if (seg->external_lv &&
|
||||
(_lv_is_in_vg(vg_from, seg->external_lv) ||
|
||||
_lv_is_in_vg(vg_from, data_lv))) {
|
||||
log_error("Can't split external origin %s "
|
||||
"and pool %s between two Volume Groups.",
|
||||
display_lvname(seg->external_lv),
|
||||
@@ -459,7 +460,7 @@ static int _move_cache(struct volume_group *vg_from,
|
||||
!lv_is_on_pvs(meta, &vg_to->pvs))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (fast && orig &&
|
||||
!lv_is_on_pvs(orig, &vg_to->pvs) && !lv_is_on_pvs(fast, &vg_to->pvs))
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user