1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Thin send create_snap message

Start creating snapshots for real.
Update test suite to check it happens.
This commit is contained in:
Zdenek Kabelac 2011-11-10 15:30:59 +00:00
parent 54feef9366
commit 7891cead11
2 changed files with 8 additions and 15 deletions

View File

@ -222,6 +222,7 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
{ {
char *metadata_dlid, *pool_dlid; char *metadata_dlid, *pool_dlid;
const struct lv_thin_message *lmsg; const struct lv_thin_message *lmsg;
const struct logical_volume *origin;
if (!laopts->real_pool) { if (!laopts->real_pool) {
if (!(pool_dlid = build_dm_uuid(mem, seg->lv->lvid.s, "tpool"))) { if (!(pool_dlid = build_dm_uuid(mem, seg->lv->lvid.s, "tpool"))) {
@ -258,22 +259,13 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
dm_list_iterate_items(lmsg, &seg->thin_messages) { dm_list_iterate_items(lmsg, &seg->thin_messages) {
switch (lmsg->type) { switch (lmsg->type) {
case DM_THIN_MESSAGE_CREATE_SNAP:
/* FIXME: to be implemented */
log_debug("Thin pool create_snap %s.", lmsg->u.lv->name);
if (!dm_tree_node_add_thin_pool_message(node,
lmsg->type,
first_seg(lmsg->u.lv)->device_id,
0))//first_seg(first_seg(lmsg->u.lv)->origin)->device_id;
return_0;
log_error("Sorry SNAPSHOT is not yet supported.");
return 0;
case DM_THIN_MESSAGE_CREATE_THIN: case DM_THIN_MESSAGE_CREATE_THIN:
log_debug("Thin pool create_thin %s.", lmsg->u.lv->name); origin = first_seg(lmsg->u.lv)->origin;
log_debug("Thin pool create_%s %s.", (!origin) ? "thin" : "snap", lmsg->u.lv->name);
if (!dm_tree_node_add_thin_pool_message(node, if (!dm_tree_node_add_thin_pool_message(node,
lmsg->type, (!origin) ? lmsg->type : DM_THIN_MESSAGE_CREATE_SNAP,
first_seg(lmsg->u.lv)->device_id, first_seg(lmsg->u.lv)->device_id,
0)) (!origin) ? 0 : first_seg(origin)->device_id))
return_0; return_0;
break; break;
case DM_THIN_MESSAGE_DELETE: case DM_THIN_MESSAGE_DELETE:

View File

@ -145,10 +145,11 @@ check vg_field $vg lv_count 19
lvremove -ff $vg lvremove -ff $vg
check vg_field $vg lv_count 0 check vg_field $vg lv_count 0
# Create thin snapshot of thinLV # Create thin snapshot of thinLV
lvcreate -L4M -V2G -T $vg/pool --name lv1 lvcreate -L10M -V10M -T $vg/pool --name lv1
mkfs.ext4 $DM_DEV_DIR/$vg/lv1
lvcreate -s $vg/lv1 lvcreate -s $vg/lv1
fsck -p $DM_DEV_DIR/$vg/lvol0
lvcreate -s $vg/lv1 --name lv2 lvcreate -s $vg/lv1 --name lv2
lvcreate -s $vg/lv1 --name $vg/lv3 lvcreate -s $vg/lv1 --name $vg/lv3
lvcreate --type snapshot $vg/lv1 lvcreate --type snapshot $vg/lv1