-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_soc7-controller.sh
executable file
·39 lines (33 loc) · 1.13 KB
/
install_soc7-controller.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
INSTALL_IMG="SLE-12-SP2-Server-DVD-x86_64-GM-DVD1.iso"
OS_VARIANT="sles12sp2"
BASE_NAME="soc7-controller"
NOW=$(date '+%Y-%m-%d_%H-%M-%S')
VM_NAME="${BASE_NAME}_${NOW}"
NET_NAME="soc7-admin"
MAC="52:54:00:00:01:01"
OS_TYPE="Linux"
RAM="8192"
VCPUS="2"
DISK_IMG="${VM_NAME}_disk.qcow2"
DISK_SIZE="20G"
EXTRA_ARGS="netdevice=eth0 netsetup=dhcp"
qemu-img create -f qcow2 ${DISK_IMG} ${DISK_SIZE}
virt-install \
--debug \
--name ${VM_NAME} \
--os-type=${OS_TYPE} \
--os-variant=${OS_VARIANT} \
--ram=${RAM} \
--vcpus=${VCPUS} \
--disk path=${DISK_IMG},device=disk \
--graphics vnc,listen=0.0.0.0 \
--network=network=${NET_NAME} \
--mac=${MAC} \
--pxe
virsh dumpxml ${VM_NAME} > ${VM_NAME}.xml
xmlstarlet ed --inplace -d "/domain/os/boot" ${VM_NAME}.xml
xmlstarlet ed --inplace --subnode "/domain/os" --type elem -n boot -v "" -i "/domain/os/boot[1]" --type attr -n dev -v network ${VM_NAME}.xml
xmlstarlet ed --inplace --subnode "/domain/os" --type elem -n boot -v "" -i "/domain/os/boot[2]" --type attr -n dev -v hd ${VM_NAME}.xml
virsh define ${VM_NAME}.xml
virsh destroy ${VM_NAME}
virsh start ${VM_NAME}