xref: /dflybsd-src/contrib/lvm2/dist/test/t-vgrename-usage.sh (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
286d7f5d3SJohn Marino#
386d7f5d3SJohn Marino# This copyrighted material is made available to anyone wishing to use,
486d7f5d3SJohn Marino# modify, copy, or redistribute it subject to the terms and conditions
586d7f5d3SJohn Marino# of the GNU General Public License v.2.
686d7f5d3SJohn Marino#
786d7f5d3SJohn Marino# You should have received a copy of the GNU General Public License
886d7f5d3SJohn Marino# along with this program; if not, write to the Free Software Foundation,
986d7f5d3SJohn Marino# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1086d7f5d3SJohn Marino
1186d7f5d3SJohn Marino. ./test-utils.sh
1286d7f5d3SJohn Marino
1386d7f5d3SJohn Marinoaux prepare_devs 4
1486d7f5d3SJohn Marinopvcreate $dev1 $dev2
1586d7f5d3SJohn Marinopvcreate --metadatacopies 0 $dev3 $dev4
1686d7f5d3SJohn Marino
1786d7f5d3SJohn Marino# vgrename normal operation - rename vg1 to vg2
1886d7f5d3SJohn Marino# vgrename normal operation - rename vg2 to vg1
1986d7f5d3SJohn Marino# ensure name ordering does not matter
2086d7f5d3SJohn Marinovgcreate $vg1 $dev1 $dev2
2186d7f5d3SJohn Marinovgrename $vg1 $vg2
2286d7f5d3SJohn Marinocheck_vg_field_ $vg2 vg_name $vg2
2386d7f5d3SJohn Marinovgrename $vg2 $vg1
2486d7f5d3SJohn Marinocheck_vg_field_ $vg1 vg_name $vg1
2586d7f5d3SJohn Marinovgremove $vg1
2686d7f5d3SJohn Marino
2786d7f5d3SJohn Marino# vgrename by uuid (bz231187)
2886d7f5d3SJohn Marinovgcreate $vg1 $dev1 $dev3
2986d7f5d3SJohn MarinoUUID=$(vgs --noheading -o vg_uuid $vg1)
3086d7f5d3SJohn Marinocheck_vg_field_ $vg1 vg_uuid $UUID
3186d7f5d3SJohn Marinovgrename $UUID $vg2
3286d7f5d3SJohn Marinocheck_vg_field_ $vg2 vg_name $vg2
3386d7f5d3SJohn Marinovgremove $vg2
3486d7f5d3SJohn Marino
3586d7f5d3SJohn Marino# vgrename fails - new vg already exists
3686d7f5d3SJohn Marinovgcreate $vg1 $dev1
3786d7f5d3SJohn Marinovgcreate $vg2 $dev2
3886d7f5d3SJohn Marinonot vgrename $vg1 $vg2
3986d7f5d3SJohn Marinovgremove $vg1
4086d7f5d3SJohn Marinovgremove $vg2
4186d7f5d3SJohn Marino
42