summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2015-07-02 18:25:12 +0200
committerDominique Martinet <asmadeus@codewreck.org>2015-07-02 18:26:37 +0200
commit8f70edd42b589e0bd0f6a64ce3ca40057cf86c79 (patch)
tree79a4a5bc46cdfd5ffaa65638e495a5e766b4ef95
parentbbf7d605d28850470ab807ef30a14102b2340ef7 (diff)
New bootstrap with cobbler - need to add conf files, amendme..
-rwxr-xr-xbootstrap/cobbler/bootstrap.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/bootstrap/cobbler/bootstrap.sh b/bootstrap/cobbler/bootstrap.sh
new file mode 100755
index 0000000..0f50a9b
--- /dev/null
+++ b/bootstrap/cobbler/bootstrap.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# Bootstrap VM
+# Copyright (C) 2011 Benjamin Cohen <bencoh@codewreck.org>
+# Dominique Martinet <asmadeus@codewreck.org>
+# Published under the WTFPLv2 (see LICENSE)
+
+function bootstrap_fs()
+{
+ case "$BOOTSTRAP_NET_ADDR" in
+ "")
+ echo "no address pattern?"
+ exit 1
+ ;;
+ *.*.*.[0-9])
+ ;;
+ *)
+ BOOTSTRAP_NET_ADDR=$(cobbler system report | grep "IP Address" | \
+ awk "/$BOOTSTRAP_NET_ADDR/ {print \$4}" | \
+ sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | tail -1 | \
+ awk -F. '{ print $1"."$2"."$3"."$4+1 }')
+ ;;
+ esac
+
+ local COBBLER_OPTS="--name $VM_NAME --netboot-enabled 1 --hostname $VM_NAME.$BOOTSTRAP_DOMAIN --interface eth0 --dns-name $VM_NAME.$BOOTSTRAP_DOMAIN --ip-address $BOOTSTRAP_NET_ADDR --netmask $BOOTSTRAP_NET_MASK --gateway $BOOTSTRAP_NET_GW --mac-address=${KVM_MACADDR[0]} --mtu $BOOTSTRAP_MTU --profile $BOOTSTRAP_FLAVOR --kopts=modprobe.blacklist=cirrus,drm,ttm,drm_kms_helper"
+ [[ -n "$BOOTSTRAP_KICKSTART" ]] && COBBLER_OPTS+=" -kickstart $BOOTSTRAP_KICKSTART"
+
+ if cobbler system list | grep -q -E '^ *'"$VM_NAME"'$'; then
+ cobbler system edit $COBBLER_OPTS
+ else
+ cobbler system add $COBBLER_OPTS
+ fi
+ cobbler sync
+
+ # Start VM to bootstrap
+ desc_update_setting "KVM_IF[0]" "virtio-net-pci"
+ desc_update_setting "KVM_NET_OPT[0]" ",vhost=on"
+ test_blockdev "${KVM_DISK[0]}" \
+ && desc_update_setting "KVM_DISK_IF[0]" "virtio-blk-pci,scsi=off"
+
+ desc_update_setting "KVM_BOOTDEVICE" "-boot order=n"
+
+
+# kvm_init_env "$VM_NAME"
+
+# KVM_MANAGE_DISKS=no kvm_start_vm "$VM_NAME"
+
+# desc_revert_setting "KVM_BOOTDEVICE"
+
+# echo "Bootstrap success ($VM_NAME)!"
+
+}
+