-
Notifications
You must be signed in to change notification settings - Fork 10
/
deploy-hyperv-compute.sh
executable file
·111 lines (90 loc) · 4.7 KB
/
deploy-hyperv-compute.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
set -e
if [ $# -lt 15 ]; then
echo "Usage: $0 <hyperv_host_ip> <hyperv_admin_username> <hyperv_password> <openstack_release> <vswitch_name> <glance_host> \
<rpc_backend> <rpc_backend_host> <rpc_backend_username> <rpc_backend_password> <neutron_url> \
<neutron_admin_auth_url> <neutron_admin_tenant_name> <neutron_admin_username> <neutron_admin_password> \
<ceilometer_admin_auth_url> <ceilometer_admin_tenant_name> <ceilometer_admin_username> <ceilometer_admin_password> \
<ceilometer_metering_secret>"
exit 1
fi
HYPERV_COMPUTE_VM_IP=$1
HYPERV_ADMIN=$2
HYPERV_PASSWORD=$3
OPENSTACK_RELEASE=$4
HYPERV_VSWITCH=$5
GLANCE_HOST=$6
RPC_BACKEND=$7
RPC_BACKEND_HOST=$8
RPC_BACKEND_USERNAME=$9
RPC_BACKEND_PASSWORD=${10}
NEUTRON_URL=${11}
NEUTRON_ADMIN_AUTH_URL=${12}
NEUTRON_ADMIN_TENANT_NAME=${13}
NEUTRON_ADMIN_USERNAME=${14}
NEUTRON_ADMIN_PASSWORD=${15}
CEILOMETER_ADMIN_AUTH_URL=${16}
CEILOMETER_ADMIN_TENANT_NAME=${17}
CEILOMETER_ADMIN_USERNAME=${18}
CEILOMETER_ADMIN_PASSWORD=${19}
CEILOMETER_METERING_SECRET=${20}
GLANCE_PORT=9292
RPC_BACKEND_PORT=5672
BASEDIR=$(dirname $0)
. $BASEDIR/utils.sh
echo "Checking prerequisites"
NOTFOUND=0
pip freeze | grep pywinrm > /dev/null || NOTFOUND=1
if [ "$NOTFOUND" -eq 1 ]; then
echoerr "pywinrm not found. Install with: sudo pip install --pre pywinrm"
exit 1
fi
if [ "$RPC_BACKEND" != "RabbitMQ" ] && [ "$RPC_BACKEND" != "ApacheQpid" ]; then
echoerr "Unsupported RPC backend: $RPC_BACKEND"
exit 1
fi
if [ "$OPENSTACK_RELEASE" == "grizzly" ]; then
MSI_FILE=HyperVNovaCompute_Grizzly.msi
elif [ "$OPENSTACK_RELEASE" == "havana" ]; then
MSI_FILE=HyperVNovaCompute_Havana.msi
elif [ "$OPENSTACK_RELEASE" == "master" ]; then
MSI_FILE=HyperVNovaCompute_Beta.msi
else
echoerr "Unsupported OpenStack release: $OPENSTACK_RELEASE"
exit 1
fi
echo "OpenStack release: $OPENSTACK_RELEASE"
echo "Configuring external virtual switch on Hyper-V"
exec_with_retry "$BASEDIR/create-hyperv-external-vswitch.sh $HYPERV_COMPUTE_VM_IP $HYPERV_ADMIN $HYPERV_PASSWORD $HYPERV_VSWITCH"
echo "Downloading Hyper-V OpenStack Compute installer on $HYPERV_COMPUTE_VM_IP"
run_wsmancmd_with_retry $HYPERV_COMPUTE_VM_IP $HYPERV_ADMIN $HYPERV_PASSWORD "powershell -NonInteractive Invoke-WebRequest -Uri http://www.cloudbase.it/downloads/$MSI_FILE -OutFile \$ENV:TEMP\\$MSI_FILE"
echo "Installing Hyper-V OpenStack Compute on $HYPERV_COMPUTE_VM_IP"
HYPERV_FEATURES="HyperVNovaCompute,iSCSISWInitiator,FreeRDP"
if [ "$OPENSTACK_RELEASE" == "grizzly" ]; then
if [ -n "$NEUTRON_ADMIN_AUTH_URL" ]; then
HYPERV_FEATURES+=",QuantumHyperVAgent"
fi
run_wsmancmd_with_retry $HYPERV_COMPUTE_VM_IP $HYPERV_ADMIN $HYPERV_PASSWORD "msiexec /i %TEMP%\\$MSI_FILE /qn /l*v %TEMP%\\HyperVNovaCompute_setup_log.txt \
ADDLOCAL=$HYPERV_FEATURES GLANCEHOST=$GLANCE_HOST GLANCEPORT=$GLANCE_PORT RPCBACKEND=$RPC_BACKEND \
RPCBACKENDHOST=$RPC_BACKEND_HOST RPCBACKENDPORT=$RPC_BACKEND_PORT RPCBACKENDUSER=$RPC_BACKEND_USERNAME RPCBACKENDPASSWORD=$RPC_BACKEND_PASSWORD \
INSTANCESPATH=C:\\OpenStack\\Instances ADDVSWITCH=0 VSWITCHNAME=$HYPERV_VSWITCH USECOWIMAGES=1 LOGDIR=C:\\OpenStack\\Log ENABLELOGGING=1 \
VERBOSELOGGING=1 QUANTUMURL=$NEUTRON_URL QUANTUMADMINTENANTNAME=$NEUTRON_ADMIN_TENANT_NAME QUANTUMADMINUSERNAME=$NEUTRON_ADMIN_USERNAME \
QUANTUMADMINPASSWORD=$NEUTRON_ADMIN_PASSWORD QUANTUMADMINAUTHURL=$NEUTRON_ADMIN_AUTH_URL"
else
if [ -n "$NEUTRON_ADMIN_AUTH_URL" ]; then
HYPERV_FEATURES+=",NeutronHyperVAgent"
fi
# Disable temporarily Ceilometer on Hyper-V until the latest bug fixes will merge.
#if [ -n "$CEILOMETER_ADMIN_AUTH_URL" ]; then
# HYPERV_FEATURES+=",CeilometerComputeAgent"
#fi
run_wsmancmd_with_retry $HYPERV_COMPUTE_VM_IP $HYPERV_ADMIN $HYPERV_PASSWORD "msiexec /i %TEMP%\\$MSI_FILE /qn /l*v %TEMP%\\HyperVNovaCompute_setup_log.txt \
ADDLOCAL=$HYPERV_FEATURES GLANCEHOST=$GLANCE_HOST GLANCEPORT=$GLANCE_PORT RPCBACKEND=$RPC_BACKEND \
RPCBACKENDHOST=$RPC_BACKEND_HOST RPCBACKENDPORT=$RPC_BACKEND_PORT RPCBACKENDUSER=$RPC_BACKEND_USERNAME RPCBACKENDPASSWORD=$RPC_BACKEND_PASSWORD \
INSTANCESPATH=C:\\OpenStack\\Instances ADDVSWITCH=0 VSWITCHNAME=$HYPERV_VSWITCH USECOWIMAGES=1 LOGDIR=C:\\OpenStack\\Log ENABLELOGGING=1 \
VERBOSELOGGING=1 NEUTRONURL=$NEUTRON_URL NEUTRONADMINTENANTNAME=$NEUTRON_ADMIN_TENANT_NAME NEUTRONADMINUSERNAME=$NEUTRON_ADMIN_USERNAME \
NEUTRONADMINPASSWORD=$NEUTRON_ADMIN_PASSWORD NEUTRONADMINAUTHURL=$NEUTRON_ADMIN_AUTH_URL \
CEILOMETERADMINTENANTNAME=$CEILOMETER_ADMIN_TENANT_NAME CEILOMETERADMINUSERNAME=$CEILOMETER_ADMIN_USERNAME \
CEILOMETERADMINPASSWORD=$CEILOMETER_ADMIN_PASSWORD CEILOMETERADMINAUTHURL=$CEILOMETER_ADMIN_AUTH_URL \
CEILOMETERMETERINGSECRET=$CEILOMETER_METERING_SECRET"
fi