diff options
author | baigk <baiguoku@huawei.com> | 2015-08-05 02:00:31 -0400 |
---|---|---|
committer | baigk <baiguoku@huawei.com> | 2015-08-05 02:00:31 -0400 |
commit | 4fb32751f9c8e82a729780fc5dedae71cecc32b6 (patch) | |
tree | cb1af3b6eff4249874469bc567ebe6b6e0cfc4db /deploy/adapters/cobbler/snippets/kickstart_post_partition_disks | |
parent | d05b5f04c92034eae1675dc8102247a3cc3315f7 (diff) |
support deployment os of centos7.1 with cobbler for compass
JIRA: COMPASS-5
Change-Id: I6aa19548a17791f8862c6dba00380ef946ea3108
Signed-off-by: baigk <baiguoku@huawei.com>
Diffstat (limited to 'deploy/adapters/cobbler/snippets/kickstart_post_partition_disks')
-rw-r--r-- | deploy/adapters/cobbler/snippets/kickstart_post_partition_disks | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/deploy/adapters/cobbler/snippets/kickstart_post_partition_disks b/deploy/adapters/cobbler/snippets/kickstart_post_partition_disks new file mode 100644 index 00000000..ded9e961 --- /dev/null +++ b/deploy/adapters/cobbler/snippets/kickstart_post_partition_disks @@ -0,0 +1,33 @@ +partitions=\$(pvs --noheadings --separator :| cut -d: -f1,2) +vg_remove=0 +remove_partitions='' +echo "partitions \$partitions" >> /tmp/post_partition.log + +for partition in \$partitions; do + partition_vg=(\${partition//:/ }) + partition=\${partition_vg[0]} + vg=\${partition_vg[1]} + if [[ "\$vg" == "reserved" ]]; then + echo "prepare remove partition \$partition" >> /tmp/post_partition.log + remove_partitions="\${remove_partitions} \$partition" + vg_remove=1 + else + echo "ignore \$vg since it is not reserved" >> /tmp/post_partition.log + fi +done + +if [[ "\${vg_remove}" != "0" ]]; then + vgremove -f reserved +fi + +for remove_partition in \${remove_partitions}; do + echo "remove partition \${remove_partition}" >> /tmp/post_partition.log + pvremove -ff -y \${remove_partition} + set \$(echo \${remove_partition} | sed -e 's/^\(.*\)\([0-9]\+\)\$/\1 \2/g') + partition_disk=\$1 + partition_number=\$2 + if [ -z "\${partition_disk}" -o -z "\${partition_number}" ]; then + continue + fi + parted \${partition_disk} --script -- rm \${partition_number} +done |