-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4create_fuel_phase2.sh
executable file
·53 lines (45 loc) · 1.98 KB
/
4create_fuel_phase2.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
#!/bin/bash
export LANG=C
source config
VOL_ID=$(nova volume-show ${FUEL_MASTER_NAME}|grep " id "|awk '{print $4}')
N_ID=$(neutron net-list |grep " ${NET_ADMIN_NAME}-net "|awk '{print $2}')
nova delete ${FUEL_MASTER_NAME}
while nova show ${FUEL_MASTER_NAME} &>/dev/null; do
echo "Wait for delete"
sleep 1
done
neutron port-delete ${FUEL_MASTER_NAME}-admin
P_ID=$(neutron port-create --tenant-id ${TID} \
--fixed-ip subnet_id=${NET_ADMIN_NAME}-subnet,ip_address=10.20.0.2 \
--name ${FUEL_MASTER_NAME}-admin \
--mac-address aa:0a:14:00:02:01 \
${NET_ADMIN_NAME}-net|grep " id "|awk '{print $4}')
# create new volume
delete_volume ${FUEL_MASTER_NAME}-stage1
delete_volume_snapshot ${FUEL_MASTER_NAME}-stage1
nova volume-snapshot-create --display-name ${FUEL_MASTER_NAME}-stage1 ${VOL_ID}
while [[ ! $(nova volume-snapshot-show ${FUEL_MASTER_NAME}-stage1| grep " status " | awk '{print $4}') == 'available' ]] &>/dev/null; do
echo "Wait for create"
sleep 1
done
VOL_SNAP_ID=$(nova volume-snapshot-show ${FUEL_MASTER_NAME}-stage1|grep " id "|awk '{print $4}')
# create volume
nova volume-create --display-name ${FUEL_MASTER_NAME}-stage1 --snapshot-id ${VOL_SNAP_ID} 80
while [[ ! $(nova volume-show ${FUEL_MASTER_NAME}-stage1| grep " status " | awk '{print $4}') == 'available' ]] &>/dev/null; do
echo "Wait for create"
sleep 1
done
VOL_TEST_ID=$(nova volume-show ${FUEL_MASTER_NAME}-stage1|grep " id "|awk '{print $4}')
# set bootable to new volume
cinder set-bootable ${VOL_TEST_ID} True
nova boot --flavor fuel-master \
--nic port-id=${P_ID} \
--block-device id=${VOL_TEST_ID},source=volume,dest=volume,device=/dev/vda,size=80,bootindex=0 \
${FUEL_MASTER_NAME}
while [[ ! $(nova show ${FUEL_MASTER_NAME}| grep " status " | awk '{print $4}') == 'ACTIVE' ]] &>/dev/null; do
echo "Wait for create"
sleep 1
done
nova floating-ip-associate ${FUEL_MASTER_NAME} ${FIP}
#neutron port-update ${FUEL_MASTER_NAME}-admin \
# --allowed-address-pairs type=dict list=true mac_address=aa:0a:14:00:02:01,ip_address=0.0.0.0/0