mirror of
git://sourceware.org/git/lvm2.git
synced 2025-09-29 13:44:18 +03:00
Compare commits
16 Commits
old-v1_00_
...
v2_00_06
Author | SHA1 | Date | |
---|---|---|---|
|
bcfc78ce11 | ||
|
09241765d5 | ||
|
671c83c265 | ||
|
772d28b766 | ||
|
c26fcea58d | ||
|
1e5e26dbff | ||
|
742fc54864 | ||
|
49738f43c0 | ||
|
9f85f61010 | ||
|
239f422039 | ||
|
67af3c37be | ||
|
a9442385c4 | ||
|
8c9cd10b8b | ||
|
72542059dd | ||
|
a843fc6d40 | ||
|
4beed60c08 |
10
README
10
README
@@ -1,13 +1,11 @@
|
||||
This directory contains a beta release of LVM2, the new version of
|
||||
the userland LVM tools designed for the new device-mapper for
|
||||
the Linux kernel.
|
||||
This directory contains LVM2, the new version of the userland LVM
|
||||
tools designed for the new device-mapper for the Linux kernel.
|
||||
|
||||
The device-mapper needs to be installed before compiling these LVM2 tools.
|
||||
|
||||
For more information about LVM2 read the WHATS_NEW file.
|
||||
Installation instructions are in INSTALL.
|
||||
|
||||
This is beta-quality software, released for testing purposes only.
|
||||
There is no warranty - see COPYING and COPYING.LIB.
|
||||
|
||||
Tarballs are available from:
|
||||
@@ -20,6 +18,6 @@ To access the CVS tree use:
|
||||
cvs -d :pserver:cvs@tech.sistina.com:/data/cvs checkout LVM2
|
||||
|
||||
Mailing list for discussion/bug reports etc.
|
||||
lvm-devel@sistina.com
|
||||
Subscribe from http://lists.sistina.com/mailman/listinfo/lvm-devel
|
||||
linux-lvm@sistina.com
|
||||
Subscribe from http://lists.sistina.com/mailman/listinfo/linux-lvm
|
||||
|
||||
|
@@ -25,6 +25,7 @@ to provide us with diagnostic information:
|
||||
log {
|
||||
file="/tmp/lvm2.log"
|
||||
level=7
|
||||
activation=1
|
||||
}
|
||||
|
||||
You should schedule regular backups of your configuration file and
|
||||
|
@@ -41,6 +41,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define MAX_TARGET_PARAMSIZE 50000
|
||||
|
||||
enum {
|
||||
ACTIVE = 0,
|
||||
RELOAD = 1,
|
||||
@@ -529,7 +531,7 @@ static int _percent_run(struct dev_manager *dm, const char *name,
|
||||
else
|
||||
*percent = 100;
|
||||
|
||||
log_debug("Mirror percent: %f", *percent);
|
||||
log_debug("LV percent: %f", *percent);
|
||||
r = 1;
|
||||
|
||||
out:
|
||||
@@ -765,10 +767,10 @@ static int _resume(struct dev_layer *dl)
|
||||
* Emit a target for a given segment.
|
||||
* FIXME: tidy this function.
|
||||
*/
|
||||
static int _emit_target(struct dev_manager *dm, struct dm_task *dmt,
|
||||
struct lv_segment *seg)
|
||||
static int _emit_target_line(struct dev_manager *dm, struct dm_task *dmt,
|
||||
struct lv_segment *seg, char *params,
|
||||
size_t paramsize)
|
||||
{
|
||||
char params[1024];
|
||||
uint64_t esize = seg->lv->vg->extent_size;
|
||||
uint32_t s, start_area = 0u, areas = seg->area_count;
|
||||
int w = 0, tw = 0;
|
||||
@@ -794,7 +796,7 @@ static int _emit_target(struct dev_manager *dm, struct dm_task *dmt,
|
||||
target = "linear";
|
||||
else if (areas > 1) {
|
||||
target = "striped";
|
||||
if ((tw = lvm_snprintf(params, sizeof(params), "%u %u ",
|
||||
if ((tw = lvm_snprintf(params, paramsize, "%u %u ",
|
||||
areas, seg->stripe_size)) < 0)
|
||||
goto error;
|
||||
w = tw;
|
||||
@@ -820,8 +822,7 @@ static int _emit_target(struct dev_manager *dm, struct dm_task *dmt,
|
||||
break;
|
||||
}
|
||||
target = "mirror";
|
||||
if ((tw = lvm_snprintf(params, sizeof(params),
|
||||
"core 1 %u %u ",
|
||||
if ((tw = lvm_snprintf(params, paramsize, "core 1 %u %u ",
|
||||
dm->mirror_region_size, areas)) < 0)
|
||||
goto error;
|
||||
w = tw;
|
||||
@@ -833,11 +834,11 @@ static int _emit_target(struct dev_manager *dm, struct dm_task *dmt,
|
||||
if ((seg->area[s].type == AREA_PV &&
|
||||
(!seg->area[s].u.pv.pv || !seg->area[s].u.pv.pv->dev)) ||
|
||||
(seg->area[s].type == AREA_LV && !seg->area[s].u.lv.lv))
|
||||
tw = lvm_snprintf(params + w, sizeof(params) - w,
|
||||
tw = lvm_snprintf(params + w, paramsize - w,
|
||||
"%s 0%s", dm->stripe_filler,
|
||||
trailing_space);
|
||||
else if (seg->area[s].type == AREA_PV)
|
||||
tw = lvm_snprintf(params + w, sizeof(params) - w,
|
||||
tw = lvm_snprintf(params + w, paramsize - w,
|
||||
"%s %" PRIu64 "%s",
|
||||
dev_name(seg->area[s].u.pv.pv->dev),
|
||||
(seg->area[s].u.pv.pv->pe_start +
|
||||
@@ -855,7 +856,7 @@ static int _emit_target(struct dev_manager *dm, struct dm_task *dmt,
|
||||
dl->info.major, dl->info.minor);
|
||||
return 0;
|
||||
}
|
||||
tw = lvm_snprintf(params + w, sizeof(params) - w,
|
||||
tw = lvm_snprintf(params + w, paramsize - w,
|
||||
"%s %" PRIu64 "%s", devbuf,
|
||||
esize * seg->area[s].u.lv.le,
|
||||
trailing_space);
|
||||
@@ -877,7 +878,37 @@ static int _emit_target(struct dev_manager *dm, struct dm_task *dmt,
|
||||
return 1;
|
||||
|
||||
error:
|
||||
log_error("Insufficient space in params[] to write target parameters.");
|
||||
log_debug("Insufficient space in params[%" PRIsize_t "] for target "
|
||||
"parameters.", paramsize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int _emit_target(struct dev_manager *dm, struct dm_task *dmt,
|
||||
struct lv_segment *seg)
|
||||
{
|
||||
char *params;
|
||||
size_t paramsize = 4096;
|
||||
int ret;
|
||||
|
||||
do {
|
||||
if (!(params = dbg_malloc(paramsize))) {
|
||||
log_error("Insufficient space for target parameters.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = _emit_target_line(dm, dmt, seg, params, paramsize);
|
||||
dbg_free(params);
|
||||
|
||||
if (!ret)
|
||||
stack;
|
||||
|
||||
if (ret >= 0)
|
||||
return ret;
|
||||
|
||||
paramsize *= 2;
|
||||
} while (paramsize < MAX_TARGET_PARAMSIZE);
|
||||
|
||||
log_error("Target parameter size too big. Aborting.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -943,6 +974,7 @@ static int _populate_snapshot(struct dev_manager *dm,
|
||||
char params[PATH_MAX * 2 + 32];
|
||||
struct snapshot *s;
|
||||
struct dev_layer *dlo, *dlc;
|
||||
char devbufo[10], devbufc[10];
|
||||
|
||||
if (!(s = find_cow(dl->lv))) {
|
||||
log_error("Couldn't find snapshot for '%s'.", dl->lv->name);
|
||||
@@ -970,9 +1002,22 @@ static int _populate_snapshot(struct dev_manager *dm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (snprintf(params, sizeof(params), "%03u:%03u %03u:%03u P %d",
|
||||
dlo->info.major, dlo->info.minor,
|
||||
dlc->info.major, dlc->info.minor, s->chunk_size) == -1) {
|
||||
if (!dm_format_dev(devbufo, sizeof(devbufo), dlo->info.major,
|
||||
dlo->info.minor)) {
|
||||
log_error("Couldn't create origin device parameters for '%s'.",
|
||||
s->origin->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!dm_format_dev(devbufc, sizeof(devbufc), dlc->info.major,
|
||||
dlc->info.minor)) {
|
||||
log_error("Couldn't create cow device parameters for '%s'.",
|
||||
s->cow->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lvm_snprintf(params, sizeof(params), "%s %s P %d",
|
||||
devbufo, devbufc, s->chunk_size) == -1) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
@@ -1575,8 +1620,7 @@ static int _resume_with_deps(struct dev_manager *dm, struct dev_layer *dl)
|
||||
}
|
||||
}
|
||||
|
||||
if (dl->info.exists & !_get_flag(dl, SUSPENDED) &&
|
||||
!_resume(dl)) {
|
||||
if (dl->info.exists & !_get_flag(dl, SUSPENDED) && !_resume(dl)) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -502,7 +502,7 @@ static struct config_value *_value(struct parser *p)
|
||||
|
||||
static struct config_value *_type(struct parser *p)
|
||||
{
|
||||
/* [0-9]+ | [0-9]*\.[0-9]* | ".*" */
|
||||
/* [+-]{0,1}[0-9]+ | [0-9]*\.[0-9]* | ".*" */
|
||||
struct config_value *v = _create_value(p);
|
||||
|
||||
if (!v)
|
||||
@@ -637,6 +637,8 @@ static void _get_token(struct parser *p, int tok_prev)
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case '+':
|
||||
case '-':
|
||||
if (values_allowed) {
|
||||
p->te++;
|
||||
while ((p->te != p->fe) && (*p->te)) {
|
||||
|
@@ -390,6 +390,9 @@ int lvdisplay_full(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
snap = list_item(slh, struct snapshot_list)->snapshot;
|
||||
snap_active = lv_snapshot_percent(snap->cow,
|
||||
&snap_percent);
|
||||
if (!snap_active || snap_percent < 0 ||
|
||||
snap_percent >= 100)
|
||||
snap_active = 0;
|
||||
log_print(" %s%s/%s [%s]",
|
||||
lv->vg->cmd->dev_dir, lv->vg->name,
|
||||
snap->cow->name,
|
||||
@@ -398,6 +401,8 @@ int lvdisplay_full(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
snap = NULL;
|
||||
} else if ((snap = find_cow(lv))) {
|
||||
snap_active = lv_snapshot_percent(lv, &snap_percent);
|
||||
if (!snap_active || snap_percent < 0 || snap_percent >= 100)
|
||||
snap_active = 0;
|
||||
log_print("LV snapshot status %s destination for %s%s/%s",
|
||||
(snap_active > 0) ? "active" : "INACTIVE",
|
||||
lv->vg->cmd->dev_dir, lv->vg->name,
|
||||
|
@@ -22,7 +22,7 @@ TARGETS=liblvm2format1.so
|
||||
include ../../make.tmpl
|
||||
|
||||
|
||||
install: libformat1.so
|
||||
install: liblvm2format1.so
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(libdir)/liblvm2format1.so.$(LIB_VERSION)
|
||||
$(LN_S) -f liblvm2format1.so.$(LIB_VERSION) $(libdir)/liblvm2format1.so
|
||||
|
@@ -255,21 +255,22 @@ static int _read_extents(struct disk_list *data)
|
||||
/*
|
||||
* If exported, remove "PV_EXP" from end of VG name
|
||||
*/
|
||||
static void _munge_exported_vg(struct disk_list *data)
|
||||
void munge_exported_vg(struct pv_disk *pvd)
|
||||
{
|
||||
int l;
|
||||
size_t s;
|
||||
|
||||
/* Return if PV not in a VG or VG not exported */
|
||||
if ((!*data->pvd.vg_name) || !(data->vgd.vg_status & VG_EXPORTED))
|
||||
/* Return if PV not in a VG */
|
||||
if ((!*pvd->vg_name))
|
||||
return;
|
||||
/* FIXME also check vgd->status & VG_EXPORTED? */
|
||||
|
||||
l = strlen(data->pvd.vg_name);
|
||||
l = strlen(pvd->vg_name);
|
||||
s = sizeof(EXPORTED_TAG);
|
||||
if (!strncmp(data->pvd.vg_name + l - s + 1, EXPORTED_TAG, s))
|
||||
data->pvd.vg_name[l - s + 1] = '\0';
|
||||
if (!strncmp(pvd->vg_name + l - s + 1, EXPORTED_TAG, s))
|
||||
pvd->vg_name[l - s + 1] = '\0';
|
||||
|
||||
data->pvd.pv_status |= VG_EXPORTED;
|
||||
pvd->pv_status |= VG_EXPORTED;
|
||||
}
|
||||
|
||||
static struct disk_list *__read_disk(const struct format_type *fmt,
|
||||
@@ -295,6 +296,9 @@ static struct disk_list *__read_disk(const struct format_type *fmt,
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* If VG is exported, set VG name back to the real name */
|
||||
munge_exported_vg(&dl->pvd);
|
||||
|
||||
if (!(info = lvmcache_add(fmt->labeller, dl->pvd.pv_uuid, dev,
|
||||
dl->pvd.vg_name, NULL)))
|
||||
stack;
|
||||
@@ -321,9 +325,6 @@ static struct disk_list *__read_disk(const struct format_type *fmt,
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* If VG is exported, set VG name back to the real name */
|
||||
_munge_exported_vg(dl);
|
||||
|
||||
/* Update VG cache with what we found */
|
||||
/* vgcache_add(dl->pvd.vg_name, dl->vgd.vg_uuid, dev, fmt); */
|
||||
|
||||
|
@@ -224,6 +224,7 @@ int export_uuids(struct disk_list *dl, struct volume_group *vg);
|
||||
void export_numbers(struct list *pvds, struct volume_group *vg);
|
||||
|
||||
void export_pv_act(struct list *pvds);
|
||||
void munge_exported_vg(struct pv_disk *pvd);
|
||||
|
||||
/* blech */
|
||||
int get_free_vg_number(struct format_instance *fid, struct dev_filter *filter,
|
||||
|
@@ -16,6 +16,8 @@
|
||||
#include "lvm1-label.h"
|
||||
#include "format1.h"
|
||||
|
||||
#define FMT_LVM1_NAME "lvm1"
|
||||
|
||||
/* VG consistency checks */
|
||||
static int _check_vgs(struct list *pvs, int *partial)
|
||||
{
|
||||
@@ -75,9 +77,9 @@ static int _check_vgs(struct list *pvs, int *partial)
|
||||
}
|
||||
|
||||
/* On entry to fn, list known to be non-empty */
|
||||
if (pv_count != dl->vgd.pv_cur) {
|
||||
if (pv_count != first->vgd.pv_cur) {
|
||||
log_error("%d PV(s) found for VG %s: expected %d",
|
||||
pv_count, dl->pvd.vg_name, dl->vgd.pv_cur);
|
||||
pv_count, first->pvd.vg_name, first->vgd.pv_cur);
|
||||
if (!partial_mode())
|
||||
return 0;
|
||||
*partial = 1;
|
||||
|
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "metadata.h"
|
||||
|
||||
#define FMT_LVM1_NAME "lvm1"
|
||||
|
||||
#ifdef LVM1_INTERNAL
|
||||
struct format_type *init_lvm1_format(struct cmd_context *cmd);
|
||||
#endif
|
||||
|
@@ -51,8 +51,11 @@ static int _read(struct labeller *l, struct device *dev, char *buf,
|
||||
struct pv_disk *pvd = (struct pv_disk *) buf;
|
||||
struct lvmcache_info *info;
|
||||
|
||||
if (!(info = lvmcache_add(l, pvd->pv_uuid, dev, pvd->vg_name, NULL)))
|
||||
munge_exported_vg(pvd);
|
||||
if (!(info = lvmcache_add(l, pvd->pv_uuid, dev, pvd->vg_name, NULL))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
*label = info->label;
|
||||
|
||||
info->device_size = xlate32(pvd->pv_size) << SECTOR_SHIFT;
|
||||
|
@@ -28,6 +28,9 @@
|
||||
#include <dirent.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define FMT_TEXT_NAME "lvm2"
|
||||
#define FMT_TEXT_ALIAS "text"
|
||||
|
||||
static struct format_instance *_create_text_instance(const struct format_type
|
||||
*fmt, const char *vgname,
|
||||
void *context);
|
||||
|
@@ -11,9 +11,6 @@
|
||||
#include "metadata.h"
|
||||
#include "pool.h"
|
||||
|
||||
#define FMT_TEXT_NAME "lvm2"
|
||||
#define FMT_TEXT_ALIAS "text"
|
||||
|
||||
/*
|
||||
* Archives a vg config. 'retain_days' is the minimum number of
|
||||
* days that an archive file must be held for. 'min_archives' is
|
||||
|
@@ -56,8 +56,8 @@ static int _write(struct label *label, char *buf)
|
||||
}
|
||||
|
||||
/* NULL-termination */
|
||||
pvh_dlocn_xl->offset = xlate64(0);
|
||||
pvh_dlocn_xl->size = xlate64(0);
|
||||
pvh_dlocn_xl->offset = xlate64(UINT64_C(0));
|
||||
pvh_dlocn_xl->size = xlate64(UINT64_C(0));
|
||||
pvh_dlocn_xl++;
|
||||
|
||||
/* List of metadata area header locations */
|
||||
@@ -74,8 +74,8 @@ static int _write(struct label *label, char *buf)
|
||||
}
|
||||
|
||||
/* NULL-termination */
|
||||
pvh_dlocn_xl->offset = xlate64(0);
|
||||
pvh_dlocn_xl->size = xlate64(0);
|
||||
pvh_dlocn_xl->offset = xlate64(UINT64_C(0));
|
||||
pvh_dlocn_xl->size = xlate64(UINT64_C(0));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@@ -666,7 +666,7 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vgname,
|
||||
|
||||
if ((correct_vg->status & PVMOVE) && !pvmove_mode()) {
|
||||
log_error("WARNING: Interrupted pvmove detected in "
|
||||
"volume group %s", vg->name);
|
||||
"volume group %s", correct_vg->name);
|
||||
log_error("Please restore the metadata by running "
|
||||
"vgcfgrestore.");
|
||||
return NULL;
|
||||
|
@@ -30,6 +30,10 @@ int memlock(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void memlock_init(struct cmd_context *cmd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#else /* DEVMAPPER_SUPPORT */
|
||||
|
||||
|
@@ -13,31 +13,43 @@
|
||||
# define xlate16(x) __cpu_to_le16((x))
|
||||
# define xlate32(x) __cpu_to_le32((x))
|
||||
# define xlate64(x) __cpu_to_le64((x))
|
||||
# define xlate16_be(x) __cpu_to_be16((x))
|
||||
# define xlate32_be(x) __cpu_to_be32((x))
|
||||
# define xlate64_be(x) __cpu_to_be64((x))
|
||||
#else
|
||||
# include <machine/endian.h>
|
||||
# if !defined(BYTE_ORDER) || \
|
||||
(BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN)
|
||||
# error "Undefined or unrecognised BYTE_ORDER";
|
||||
# endif
|
||||
# define __xlate16(x) (((x) & 0x00ffU) << 8 | \
|
||||
((x) & 0xff00U) >> 8)
|
||||
# define __xlate32(x) (((x) & 0x000000ffU) << 24 | \
|
||||
((x) & 0xff000000U) >> 24 | \
|
||||
((x) & 0x0000ff00U) << 8 | \
|
||||
((x) & 0x00ff0000U) >> 8)
|
||||
# define __xlate64(x) (((x) & 0x00000000000000ffU) << 56 | \
|
||||
((x) & 0xff00000000000000U) >> 56 | \
|
||||
((x) & 0x000000000000ff00U) << 40 | \
|
||||
((x) & 0x00ff000000000000U) >> 40 | \
|
||||
((x) & 0x0000000000ff0000U) << 24 | \
|
||||
((x) & 0x0000ff0000000000U) >> 24 | \
|
||||
((x) & 0x00000000ff000000U) << 8 | \
|
||||
((x) & 0x000000ff00000000U) >> 8)
|
||||
# if BYTE_ORDER == LITTLE_ENDIAN
|
||||
# define xlate16(x) (x)
|
||||
# define xlate32(x) (x)
|
||||
# define xlate64(x) (x)
|
||||
# define xlate16_be(x) __xlate16(x)
|
||||
# define xlate32_be(x) __xlate32(x)
|
||||
# define xlate64_be(x) __xlate64(x)
|
||||
# else
|
||||
# define xlate16(x) (((x) & 0x00ffU) << 8 | \
|
||||
((x) & 0xff00U) >> 8)
|
||||
# define xlate32(x) (((x) & 0x000000ffU) << 24 | \
|
||||
((x) & 0xff000000U) >> 24 | \
|
||||
((x) & 0x0000ff00U) << 8 | \
|
||||
((x) & 0x00ff0000U) >> 8)
|
||||
# define xlate64(x) (((x) & 0x00000000000000ffU) << 56 | \
|
||||
((x) & 0xff00000000000000U) >> 56 | \
|
||||
((x) & 0x000000000000ff00U) << 40 | \
|
||||
((x) & 0x00ff000000000000U) >> 40 | \
|
||||
((x) & 0x0000000000ff0000U) << 24 | \
|
||||
((x) & 0x0000ff0000000000U) >> 24 | \
|
||||
((x) & 0x00000000ff000000U) << 8 | \
|
||||
((x) & 0x000000ff00000000U) >> 8)
|
||||
# define xlate16(x) __xlate16(x)
|
||||
# define xlate32(x) __xlate32(x)
|
||||
# define xlate64(x) __xlate64(x)
|
||||
# define xlate16_be(x) (x)
|
||||
# define xlate32_be(x) (x)
|
||||
# define xlate64_be(x) (x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
static unsigned char _c[] =
|
||||
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#";
|
||||
|
||||
static int _built_inverse;
|
||||
static unsigned char _inverse_c[256];
|
||||
|
18
man/pvmove.8
18
man/pvmove.8
@@ -3,9 +3,10 @@
|
||||
pvmove \- move physical extents
|
||||
.SH SYNOPSIS
|
||||
.B pvmove
|
||||
[\-\-abort]
|
||||
[\-d/\-\-debug] [\-h/\-\-help] [\-i/\-\-interval Seconds] [\-v/\-\-verbose]
|
||||
[\-n/\-\-name LogicalVolume] SourcePhysicalVolume
|
||||
[DestinationPhysicalVolume[:PE[-PE]...]...]
|
||||
[\-n/\-\-name LogicalVolume]
|
||||
[SourcePhysicalVolume [DestinationPhysicalVolume[:PE[-PE]...]...]]
|
||||
.SH DESCRIPTION
|
||||
.B pvmove
|
||||
allows you to move the allocated physical extents (PEs) on
|
||||
@@ -20,15 +21,16 @@ If no
|
||||
.I DestinationPhysicalVolume
|
||||
is specifed, the normal allocation rules for the volume group are used.
|
||||
|
||||
If \fBpvmove\fP gets interrupted for any reason, it will probably be
|
||||
necessary to run \fBvgcfgrestore\fP to restore the volume group's metadata to
|
||||
the state it was before the \fBpvmove\fP began.
|
||||
|
||||
\fBpvmove\fP locks the volume group and other LVM2 commands can't access
|
||||
the volume group metadata until \fBpvmove\fP has completed.
|
||||
If \fBpvmove\fP gets interrupted for any reason (e.g. the machine crashes)
|
||||
then run \fBpvmove\fP again without any PhysicalVolume arguments to
|
||||
continue with any moves that were in progress or use \fBpvmove --abort\fP to
|
||||
abort them.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.I \-\-abort
|
||||
Abort any moves currently in progress.
|
||||
.TP
|
||||
.I \-i, \-\-interval Seconds
|
||||
Report progress as a percentage at regular intervals.
|
||||
.TP
|
||||
|
@@ -54,6 +54,7 @@ xx(lvchange,
|
||||
"\t[-a|--available y|n]\n"
|
||||
"\t[-C|--contiguous y|n]\n"
|
||||
"\t[-d|--debug]\n"
|
||||
"\t[-f|--force]\n"
|
||||
"\t[-h|--help]\n"
|
||||
"\t[--ignorelockingfailure]\n"
|
||||
"\t[-M|--persistent y|n] [--major major] [--minor minor]\n"
|
||||
@@ -65,7 +66,7 @@ xx(lvchange,
|
||||
"\t[--version]" "\n"
|
||||
"\tLogicalVolume[Path] [LogicalVolume[Path]...]\n",
|
||||
|
||||
autobackup_ARG, available_ARG, contiguous_ARG,
|
||||
autobackup_ARG, available_ARG, contiguous_ARG, force_ARG,
|
||||
ignorelockingfailure_ARG, major_ARG, minor_ARG, partial_ARG, permission_ARG,
|
||||
persistent_ARG, readahead_ARG, test_ARG)
|
||||
|
||||
|
@@ -227,6 +227,7 @@ static int lvchange_readahead(struct cmd_context *cmd,
|
||||
static int lvchange_persistent(struct cmd_context *cmd,
|
||||
struct logical_volume *lv)
|
||||
{
|
||||
struct lvinfo info;
|
||||
|
||||
if (!strcmp(arg_str_value(cmd, persistent_ARG, "n"), "n")) {
|
||||
if (!(lv->status & FIXED_MINOR)) {
|
||||
@@ -248,8 +249,19 @@ static int lvchange_persistent(struct cmd_context *cmd,
|
||||
log_error("Major number must be specified with -My");
|
||||
return 0;
|
||||
}
|
||||
log_verbose("Ensuring %s is inactive. Reactivate with -ay.",
|
||||
lv->name);
|
||||
if (lv_info(lv, &info) && info.exists &&
|
||||
!arg_count(cmd, force_ARG)) {
|
||||
if (yes_no_prompt("Logical volume %s will be "
|
||||
"deactivated first. "
|
||||
"Continue? [y/n]: ",
|
||||
lv->name) == 'n') {
|
||||
log_print("%s device number not changed.",
|
||||
lv->name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
log_print("Ensuring %s is inactive. "
|
||||
"(Reactivate using lvchange -ay.)", lv->name);
|
||||
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_DEACTIVATE)) {
|
||||
log_error("%s: deactivation failed", lv->name);
|
||||
return 0;
|
||||
|
@@ -182,7 +182,7 @@ static struct list *_get_allocatable_pvs(struct cmd_context *cmd, int argc,
|
||||
pvl = list_item(pvh, struct pv_list);
|
||||
if ((pvl->pv->dev == pv->dev) ||
|
||||
(pvl->pv->pe_count == pvl->pv->pe_alloc_count))
|
||||
list_del(&pvl->list);
|
||||
list_del(&pvl->list);
|
||||
}
|
||||
|
||||
if (list_empty(allocatable_pvs)) {
|
||||
@@ -483,6 +483,16 @@ static int _check_pvmove_status(struct cmd_context *cmd,
|
||||
|
||||
*finished = 1;
|
||||
|
||||
if (parms->aborting) {
|
||||
if (!(lvs_changed = lvs_using_lv(cmd, vg, lv_mirr))) {
|
||||
log_error("Failed to generate list of moved LVs: "
|
||||
"can't abort.");
|
||||
return 0;
|
||||
}
|
||||
_finish_pvmove(cmd, vg, lv_mirr, lvs_changed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!lv_mirror_percent(lv_mirr, !parms->interval, &segment_percent,
|
||||
&event_nr)) {
|
||||
log_error("ABORTING: Mirror percentage check failed.");
|
||||
@@ -495,7 +505,7 @@ static int _check_pvmove_status(struct cmd_context *cmd,
|
||||
else
|
||||
log_verbose("%s: Moved: %.1f%%", pv_name, overall_percent);
|
||||
|
||||
if (segment_percent < 100.0 && !parms->aborting) {
|
||||
if (segment_percent < 100.0) {
|
||||
*finished = 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -505,11 +515,6 @@ static int _check_pvmove_status(struct cmd_context *cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parms->aborting) {
|
||||
_finish_pvmove(cmd, vg, lv_mirr, lvs_changed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (overall_percent >= 100.0) {
|
||||
if (!_finish_pvmove(cmd, vg, lv_mirr, lvs_changed))
|
||||
return 0;
|
||||
@@ -576,6 +581,17 @@ static int _poll_pvmove_vgs(struct cmd_context *cmd, const char *vgname,
|
||||
struct physical_volume *pv;
|
||||
int finished;
|
||||
|
||||
if (!vg) {
|
||||
log_error("Couldn't read volume group %s", vgname);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
if (!consistent) {
|
||||
log_error("Volume Group %s inconsistent - skipping", vgname);
|
||||
/* FIXME Should we silently recover it here or not? */
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
if (vg->status & EXPORTED_VG) {
|
||||
log_error("Volume group \"%s\" is exported", vg->name);
|
||||
return ECMD_FAILED;
|
||||
@@ -623,9 +639,11 @@ int pvmove_poll(struct cmd_context *cmd, const char *pv_name,
|
||||
log_verbose("Checking progress every %u seconds",
|
||||
parms.interval);
|
||||
|
||||
if (parms.interval == 0) {
|
||||
parms.interval = DEFAULT_INTERVAL;
|
||||
if (!parms.interval) {
|
||||
parms.progress_display = 0;
|
||||
|
||||
if (!pv_name)
|
||||
parms.interval = DEFAULT_INTERVAL;
|
||||
}
|
||||
|
||||
if (parms.background) {
|
||||
@@ -653,8 +671,9 @@ int pvmove(struct cmd_context *cmd, int argc, char **argv)
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
if ((ret = _set_up_pvmove(cmd, pv_name, argc, argv)) !=
|
||||
ECMD_PROCESSED) {
|
||||
if (!arg_count(cmd, abort_ARG) &&
|
||||
(ret = _set_up_pvmove(cmd, pv_name, argc, argv)) !=
|
||||
ECMD_PROCESSED) {
|
||||
stack;
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user