When creating a shared store, always use previx "-shared". If the user specifies a name on a command line, it will be used to create a snapshot in this shared store. Signed-off-by: Mikulas Patocka --- lib/metadata/lv_manip.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) Index: LVM2.2.02.85/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.85.orig/lib/metadata/lv_manip.c 2011-05-23 15:59:04.000000000 +0200 +++ LVM2.2.02.85/lib/metadata/lv_manip.c 2011-05-23 15:59:13.000000000 +0200 @@ -62,6 +62,8 @@ struct alloc_state { uint32_t allocated; /* Total number of extents allocated so far */ }; +#define SHARED_SUFFIX "-shared" + struct lv_names { const char *old; const char *new; @@ -3471,6 +3473,7 @@ int lv_create_single(struct volume_group uint64_t status = UINT64_C(0); struct logical_volume *lv, *org = NULL; int origin_active = 0; + const char *lv_name; struct lvinfo info; if (lp->lv_name && find_lv_in_vg(vg, lp->lv_name)) { @@ -3655,8 +3658,17 @@ int lv_create_single(struct volume_group return_0; } - if (!(lv = lv_create_empty(lp->lv_name ? lp->lv_name : "lvol%d", NULL, - status, lp->alloc, vg))) + lv_name = lp->lv_name ? lp->lv_name : "lvol%d"; + + if (lp->shared_store) { + char *name = dm_pool_alloc(cmd->mem, + strlen(lp->origin) + strlen(SHARED_SUFFIX) + 1); + strcpy(name, lp->origin); + strcat(name, SHARED_SUFFIX); + lv_name = name; + } + + if (!(lv = lv_create_empty(lv_name, NULL, status, lp->alloc, vg))) return_0; if (lp->read_ahead != lv->read_ahead) {