# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
. lib/inittest
aux prepare_devs 2
-vgcreate --metadatasize 128k $vg1 "$dev1"
+vgcreate $SHARED --metadatasize 128k $vg1 "$dev1"
lvcreate -l100%FREE -n $lv1 $vg1
# Test plain vgexport vgimport tools
# Verify that if we provide the -n|--basevgname,
# the number suffix is not added unnecessarily.
-vgcreate --metadatasize 128k A${vg1}B "$dev1"
+vgcreate $SHARED --metadatasize 128k A${vg1}B "$dev1"
# vg1B is not the same as Avg1B - we don't need number suffix
dd if="$dev1" of="$dev2" bs=256K count=1
if (!(vg->name = dm_pool_strdup(vg->vgmem, vp->new_vgname)))
goto_bad;
+ /* A duplicate of a shared VG is imported as a new local VG. */
+ vg->lock_type = NULL;
+ vg->lock_args = NULL;
+ vg->system_id = cmd->system_id ? dm_pool_strdup(vg->vgmem, cmd->system_id) : NULL;
+
dm_list_iterate_items(pvl, &vg->pvs) {
if (!(new_pvl = dm_pool_zalloc(vg->vgmem, sizeof(*new_pvl))))
goto_bad;
dm_list_add(&vg->pv_write_list, &new_pvl->list);
}
- dm_list_iterate_items(lvl, &vg->lvs)
+ dm_list_iterate_items(lvl, &vg->lvs) {
memcpy(&lvl->lv->lvid, &vg->id, sizeof(vg->id));
+ lvl->lv->lock_args = NULL;
+ }
if (!vg_write(vg) || !vg_commit(vg))
goto_bad;
goto out;
}
+ /*
+ * Trying to lock the duplicated VG would conflict with the original,
+ * and it's not needed because the new VG will be imported as a local VG.
+ */
+ cmd->lockd_vg_disable = 1;
+
ret = process_each_vg(cmd, 0, NULL, vp.old_vgname, NULL, READ_FOR_UPDATE | READ_ALLOW_EXPORTED, 0, handle, _vgimportclone_vg_single);
unlock_vg(cmd, NULL, vp.new_vgname);