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

Add code to activate thin target

Code to zero pool metadata lv when pool is created.
Add code to create thin target via message sending.

(Revert is missing)
This commit is contained in:
Zdenek Kabelac 2011-10-03 18:43:39 +00:00
parent d35a117e4b
commit 04a4715cb8

View File

@ -3889,6 +3889,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
uint32_t size_rest; uint32_t size_rest;
uint64_t status = UINT64_C(0); uint64_t status = UINT64_C(0);
struct logical_volume *lv, *org = NULL; struct logical_volume *lv, *org = NULL;
struct logical_volume *pool_lv;
int origin_active = 0; int origin_active = 0;
struct lvinfo info; struct lvinfo info;
@ -4113,6 +4114,27 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
if (seg_is_thin_pool(lp) && lp->zero) if (seg_is_thin_pool(lp) && lp->zero)
first_seg(lv)->zero_new_blocks = 1; first_seg(lv)->zero_new_blocks = 1;
else if (seg_is_thin_volume(lp)) {
pool_lv = first_seg(lv)->pool_lv;
if (!(first_seg(lv)->device_id =
get_free_pool_device_id(first_seg(pool_lv))))
return_NULL;
if (!activate_lv(pool_lv->vg->cmd, pool_lv)) {
log_error("Failed to activate %s/%s to send message.",
pool_lv->vg->name, pool_lv->name);
return NULL;
}
if (!lv_send_message(pool_lv, "create_thin %u", first_seg(lv)->device_id))
return_NULL;
/*
* FIXME: Skipping deactivate_lv(pool_lv) as it is going to be needed anyway
* but revert_new_lv should revert to deactivated state.
*/
}
if (seg_is_thin_pool(lp)) { if (seg_is_thin_pool(lp)) {
/* FIXME: add lvcreate params - maybe -c/--chunksize?, /* FIXME: add lvcreate params - maybe -c/--chunksize?,
@ -4166,6 +4188,10 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
lp->snapshot ? "snapshot exception store" : lp->snapshot ? "snapshot exception store" :
"start of new LV"); "start of new LV");
goto deactivate_and_revert_new_lv; goto deactivate_and_revert_new_lv;
} else if (seg_is_thin_pool(lp)) {
if (!set_lv(cmd, first_seg(lv)->pool_metadata_lv, UINT64_C(0), 0))
log_error("Aborting. Failed to wipe pool metadata %s.",
lv->name);
} }
if (lp->snapshot) { if (lp->snapshot) {