From 79b571dae951ba9bfe36440750c1a1408b19cd69 Mon Sep 17 00:00:00 2001 From: baigk Date: Sun, 2 Aug 2015 21:56:23 -0400 Subject: support deployment os of ubuntu 14.04 with cobbler for compass JIRA: COMPASS-3 Change-Id: I703658b04ec7ec1df4a2a3b9eac5656419d8fd9f Signed-off-by: baigk --- .../cobbler/snippets/preseed_post_partition_disks | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 deploy/adapters/cobbler/snippets/preseed_post_partition_disks (limited to 'deploy/adapters/cobbler/snippets/preseed_post_partition_disks') diff --git a/deploy/adapters/cobbler/snippets/preseed_post_partition_disks b/deploy/adapters/cobbler/snippets/preseed_post_partition_disks new file mode 100644 index 00000000..ed058c73 --- /dev/null +++ b/deploy/adapters/cobbler/snippets/preseed_post_partition_disks @@ -0,0 +1,39 @@ +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 + set \$(echo \$partition | tr ':' ' ') + partition=\$1 + vg=\$2 + 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 pv \${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}" ]; then + if [ ! -z "\${partition_number}" ]; then + echo "remove partition \${remove_partition} on \${partition_disk} number \${partition_number}" >> /tmp/post_partition.log + parted \${partition_disk} --script -- rm \${partition_number} + else + echo "no partition number found for \${remove_partition}" >> /tmp/post_partition.log + fi + else + echo "no partition disk found for \${remove_partition}" >> /tmp/post_partition.log + fi +done -- cgit 1.2.3-korg