1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Some partial VG support with format_text.

This commit is contained in:
Alasdair Kergon 2002-04-30 17:12:37 +00:00
parent e1f93d52e3
commit 6b4c9ff740
6 changed files with 28 additions and 16 deletions

View File

@ -538,7 +538,7 @@ static int _emit_target(struct dm_task *dmt, struct stripe_segment *seg)
}
for (s = 0; s < stripes; s++, w += tw) {
if (!seg->area[s].pv)
if (!seg->area[s].pv || !seg->area[s].pv->dev)
tw = lvm_snprintf(params + w, sizeof(params) - w,
"%s 0%s", filler,
s == (stripes - 1) ? "" : " ");

View File

@ -47,7 +47,8 @@ int dev_zero(struct device *dev, uint64_t offset, int64_t len);
static inline const char *dev_name(struct device *dev) {
return list_item(dev->aliases.n, struct str_list)->str;
return (dev) ? list_item(dev->aliases.n, struct str_list)->str :
"unknown device";
}
/* Return a valid device name from the alias list; NULL otherwise */

View File

@ -238,12 +238,6 @@ static int _vg_write(struct format_instance *fid, struct volume_group *vg,
return 0;
}
if (vg->status & PARTIAL_VG) {
log_error("Cannot change metadata for partial volume group %s",
vg->name);
return 0;
}
list_init(&pvds);
r = (_flatten_vg(fid, mem, vg, &pvds, fid->fmt->cmd->dev_dir,

View File

@ -91,13 +91,15 @@ static int _read_pv(struct format_instance *fid, struct pool *mem,
if (!(pv->dev = uuid_map_lookup(um, &pv->id))) {
char buffer[64];
if (!id_write_format(&pv->id, buffer, sizeof(buffer))) {
if (!id_write_format(&pv->id, buffer, sizeof(buffer)))
log_err("Couldn't find device.");
return 0;
}
else
log_err("Couldn't find device with uuid '%s'.", buffer);
log_err("Couldn't find device with uuid '%s'.", buffer);
return 0;
if (partial_mode())
vg->status |= PARTIAL_VG;
else
return 0;
}
if (!(pv->vg_name = pool_strdup(mem, vg->name))) {
@ -610,6 +612,11 @@ static struct volume_group *_read_vg(struct format_instance *fid,
hash_destroy(pv_hash);
if (vg->status & PARTIAL_VG) {
vg->status &= ~LVM_WRITE;
vg->status |= LVM_READ;
}
/*
* Finished.
*/

View File

@ -362,6 +362,12 @@ int vg_write(struct volume_group *vg)
struct list *mdah;
void *mdl;
if (vg->status & PARTIAL_VG) {
log_error("Cannot change metadata for partial volume group %s",
vg->name);
return 0;
}
vg->seqno++;
/* Write to each copy of the metadata area */

View File

@ -226,10 +226,11 @@ xx(lvscan,
"\t[-d|--debug] " "\n"
"\t[-D|--disk]" "\n"
"\t[-h|--help] " "\n"
"\t[-P|--partial] " "\n"
"\t[-v|--verbose] " "\n"
"\t[--version]\n",
blockdevice_ARG, disk_ARG)
blockdevice_ARG, disk_ARG, partial_ARG)
xx(pvchange,
"Change attributes of physical volume(s)",
@ -327,12 +328,13 @@ xx(pvscan,
"\t[-d|--debug] " "\n"
"\t{-e|--exported | -n/--novolumegroup} " "\n"
"\t[-h|--help]" "\n"
"\t[-P|--partial] " "\n"
"\t[-s|--short] " "\n"
"\t[-u|--uuid] " "\n"
"\t[-v|--verbose] " "\n"
"\t[--version]\n",
exported_ARG, novolumegroup_ARG, short_ARG, uuid_ARG)
exported_ARG, novolumegroup_ARG, partial_ARG, short_ARG, uuid_ARG)
xx(vgcfgbackup,
"Backup volume group configuration(s)",
@ -520,7 +522,9 @@ xx(vgscan,
"vgscan "
"\t[-d/--debug]\n"
"\t[-h/-?/--help]\n"
"\t[-v/--verbose]\n" )
"\t[-P/--partial] " "\n"
"\t[-v/--verbose]\n" ,
partial_ARG)
xx(vgsplit,
"Move physical volumes into a new volume group",