mirror of
git://sourceware.org/git/lvm2.git
synced 2025-09-23 17:44:22 +03:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
239f422039 | ||
|
67af3c37be | ||
|
a9442385c4 | ||
|
8c9cd10b8b | ||
|
72542059dd | ||
|
a843fc6d40 | ||
|
4beed60c08 | ||
|
4049c1e480 |
@@ -943,6 +943,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 +971,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 (snprintf(params, sizeof(params), "%s %s P %d",
|
||||
devbufo, devbufc, s->chunk_size) == -1) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -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,
|
||||
|
@@ -255,21 +255,21 @@ 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, struct vg_disk *vgd)
|
||||
{
|
||||
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))
|
||||
if ((!*pvd->vg_name) || (vgd && !(vgd->vg_status & VG_EXPORTED)))
|
||||
return;
|
||||
|
||||
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 +295,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, &dl->vgd);
|
||||
|
||||
if (!(info = lvmcache_add(fmt->labeller, dl->pvd.pv_uuid, dev,
|
||||
dl->pvd.vg_name, NULL)))
|
||||
stack;
|
||||
@@ -321,9 +324,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, struct vg_disk *vgd);
|
||||
|
||||
/* blech */
|
||||
int get_free_vg_number(struct format_instance *fid, struct dev_filter *filter,
|
||||
|
@@ -51,6 +51,7 @@ static int _read(struct labeller *l, struct device *dev, char *buf,
|
||||
struct pv_disk *pvd = (struct pv_disk *) buf;
|
||||
struct lvmcache_info *info;
|
||||
|
||||
munge_exported_vg(pvd, NULL);
|
||||
if (!(info = lvmcache_add(l, pvd->pv_uuid, dev, pvd->vg_name, NULL)))
|
||||
return 0;
|
||||
*label = info->label;
|
||||
|
@@ -442,6 +442,14 @@ static int _dm_task_run_v1(struct dm_task *dmt)
|
||||
if (!_unmarshal_status_v1(dmt, dmi))
|
||||
goto bad;
|
||||
break;
|
||||
|
||||
case DM_DEVICE_SUSPEND:
|
||||
case DM_DEVICE_RESUME:
|
||||
dmt->type = DM_DEVICE_INFO;
|
||||
if (!dm_task_run(dmt))
|
||||
goto bad;
|
||||
free(dmi); /* We'll use what info returned */
|
||||
return 1;
|
||||
}
|
||||
|
||||
dmt->dmi.v1 = dmi;
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user