/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License v.2.1.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Fix up LVIDs */
dm_list_iterate_items(lvl1, &vg_to->lvs) {
union lvid *lvid1 = &lvl1->lv->lvid;
char uuid[64] __attribute((aligned(8)));
dm_list_iterate_items(lvl2, &vg_from->lvs) {
union lvid *lvid2 = &lvl2->lv->lvid;
if (id_equal(&lvid1->id[1], &lvid2->id[1])) {
if (!id_create(&lvid2->id[1])) {
log_error("Failed to generate new "
"random LVID for %s",
lvl2->lv->name);
goto bad;
}
if (!id_write_format(&lvid2->id[1], uuid,
sizeof(uuid)))
goto_bad;
log_verbose("Changed LVID for %s to %s",
lvl2->lv->name, uuid);
}
}
}
while (!dm_list_empty(&vg_from->lvs)) {
struct dm_list *lvh = vg_from->lvs.n;
dm_list_move(&vg_to->lvs, lvh);
}
while (!dm_list_empty(&vg_from->fid->metadata_areas)) {
struct dm_list *mdah = vg_from->fid->metadata_areas.n;