mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
o Format1 wasn't recording the snapshot chunk size properly
o Activation of snapshots now works - though the resulting device doesn't (pjc ?) o text format wasn't setting vg->cmd.
This commit is contained in:
parent
6761081ab4
commit
841da63e77
@ -355,10 +355,17 @@ static int _populate_vanilla(struct dev_manager *dm,
|
|||||||
static int _populate_origin(struct dev_manager *dm,
|
static int _populate_origin(struct dev_manager *dm,
|
||||||
struct dm_task *dmt, struct dev_layer *dl)
|
struct dm_task *dmt, struct dev_layer *dl)
|
||||||
{
|
{
|
||||||
|
char *real;
|
||||||
char params[PATH_MAX + 32];
|
char params[PATH_MAX + 32];
|
||||||
|
|
||||||
|
if (!(real = _build_name(dm->mem, dm->vg_name,
|
||||||
|
dl->lv->name, "real"))) {
|
||||||
|
stack;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (lvm_snprintf(params, sizeof(params), "%s/%s 0",
|
if (lvm_snprintf(params, sizeof(params), "%s/%s 0",
|
||||||
dm_dir(), dl->name) == -1) {
|
dm_dir(), real) == -1) {
|
||||||
log_err("Couldn't create origin device parameters for '%s'.",
|
log_err("Couldn't create origin device parameters for '%s'.",
|
||||||
dl->name);
|
dl->name);
|
||||||
return 0;
|
return 0;
|
||||||
@ -558,6 +565,7 @@ static int _expand_lv(struct dev_manager *dm, struct logical_volume *lv)
|
|||||||
dl->populate = _populate_vanilla;
|
dl->populate = _populate_vanilla;
|
||||||
dl->visible = 0;
|
dl->visible = 0;
|
||||||
|
|
||||||
|
/* insert the cow layer */
|
||||||
if (!hash_insert(dm->layers, dl->name, dl)) {
|
if (!hash_insert(dm->layers, dl->name, dl)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
@ -584,6 +592,21 @@ static int _expand_lv(struct dev_manager *dm, struct logical_volume *lv)
|
|||||||
|
|
||||||
list_add(&dl->pre_create, &sl->list);
|
list_add(&dl->pre_create, &sl->list);
|
||||||
|
|
||||||
|
/* add the dependency on the org device */
|
||||||
|
if (!(sl = pool_alloc(dm->mem, sizeof(*sl)))) {
|
||||||
|
stack;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(sl->str = _build_name(dm->mem, dm->vg_name,
|
||||||
|
s->origin->name, "top"))) {
|
||||||
|
stack;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
list_add(&dl->pre_create, &sl->list);
|
||||||
|
|
||||||
|
/* insert the snapshot layer */
|
||||||
if (!hash_insert(dm->layers,dl->name, dl)) {
|
if (!hash_insert(dm->layers,dl->name, dl)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -546,6 +546,7 @@ int export_lvs(struct disk_list *dl, struct volume_group *vg,
|
|||||||
org->lv_access |= LV_SNAPSHOT_ORG;
|
org->lv_access |= LV_SNAPSHOT_ORG;
|
||||||
cow->lv_access |= LV_SNAPSHOT;
|
cow->lv_access |= LV_SNAPSHOT;
|
||||||
cow->lv_snapshot_minor = org->lv_number;
|
cow->lv_snapshot_minor = org->lv_number;
|
||||||
|
cow->lv_chunk_size = s->chunk_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = 1;
|
r = 1;
|
||||||
@ -618,7 +619,8 @@ int import_snapshots(struct pool *mem, struct volume_group *vg,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* insert the snapshot */
|
/* insert the snapshot */
|
||||||
if (!vg_add_snapshot(org, cow, 1, lvd->lv_chunk_size)) {
|
if (!vg_add_snapshot(org, cow, 1,
|
||||||
|
lvd->lv_chunk_size)) {
|
||||||
log_err("Couldn't add snapshot.");
|
log_err("Couldn't add snapshot.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -484,12 +484,14 @@ static int _read_sections(const char *section, section_fn fn,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct volume_group *_read_vg(struct pool *mem, struct config_file *cf,
|
static struct volume_group *_read_vg(struct cmd_context *cmd,
|
||||||
|
struct config_file *cf,
|
||||||
struct uuid_map *um)
|
struct uuid_map *um)
|
||||||
{
|
{
|
||||||
struct config_node *vgn, *cn;
|
struct config_node *vgn, *cn;
|
||||||
struct volume_group *vg;
|
struct volume_group *vg;
|
||||||
struct hash_table *pv_hash = NULL;
|
struct hash_table *pv_hash = NULL;
|
||||||
|
struct pool *mem = cmd->mem;
|
||||||
|
|
||||||
/* skip any top-level values */
|
/* skip any top-level values */
|
||||||
for (vgn = cf->root; (vgn && vgn->v); vgn = vgn->sib)
|
for (vgn = cf->root; (vgn && vgn->v); vgn = vgn->sib)
|
||||||
@ -504,6 +506,7 @@ static struct volume_group *_read_vg(struct pool *mem, struct config_file *cf,
|
|||||||
stack;
|
stack;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
vg->cmd = cmd;
|
||||||
|
|
||||||
if (!(vg->name = pool_strdup(mem, vgn->key))) {
|
if (!(vg->name = pool_strdup(mem, vgn->key))) {
|
||||||
stack;
|
stack;
|
||||||
@ -648,7 +651,7 @@ struct volume_group *text_vg_import(struct cmd_context *cmd,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(vg = _read_vg(cmd->mem, cf, um))) {
|
if (!(vg = _read_vg(cmd, cf, um))) {
|
||||||
stack;
|
stack;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user