forked from skolekonov/fuel-kvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_slave.sh
executable file
·60 lines (50 loc) · 1.58 KB
/
deploy_slave.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash -x
source functions.sh
if [ $# -ne 4 ]
then
echo "Usage: $0 node_name node_ram node_cpu node_size"
exit 1
fi
name=$1
ram=$2
cpu=$3
size=$4
net_driver=${net_driver:-e1000}
hosts_bridge=false
fuel_pxe="fuel-pxe-$env_number"
fuel_public="fuel-public-$env_number"
fuel_external="fuel-external"
if $hosts_bridge
then
external_network=$fuel_external
else
external_network=$fuel_public
fi
echo "Creating storage..."
virsh vol-create-as --name ${name}.qcow2 --capacity $size --format qcow2 --allocation $size --pool $poolname
virsh vol-create-as --name ${name}2.qcow2 --capacity $size --format qcow2 --allocation $size --pool $poolname
virsh vol-create-as --name ${name}3.qcow2 --capacity $size --format qcow2 --allocation $size --pool $poolname
pool_path=$(get_pool_path $poolname)
echo "Starting Fuel slave vm..."
virt-install \
--name=$name \
--ram=$ram \
--vcpus=$cpu,cores=$cpu \
--os-type=linux \
--virt-type=kvm \
--pxe \
--boot network,hd \
--disk "$pool_path/${name}.qcow2",cache=writeback,bus=virtio,serial=$(uuidgen) \
--disk "$pool_path/${name}2.qcow2",cache=writeback,bus=virtio,serial=$(uuidgen) \
--disk "$pool_path/${name}3.qcow2",cache=writeback,bus=virtio,serial=$(uuidgen) \
--noautoconsole \
--network network=$fuel_pxe,model=$net_driver \
--network network=$external_network,model=$net_driver \
--graphics vnc,listen=0.0.0.0 \
# --cpu host
#If cpu parameter is set to "host" with QEMU 2.0 hypervisor
#it causes critical failure during CentOS installation
virsh destroy $name
setup_cache $name
virsh start $name
echo "VNC port: $(get_vnc $name)"