aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/host_virtual.sh
diff options
context:
space:
mode:
authorbaigk <baiguoku@huawei.com>2015-12-27 21:23:33 +0800
committerbaigk <baiguoku@huawei.com>2015-12-28 06:45:58 +0000
commit0ccb2434dc7bbafa2d5e60ec5777dd03b00bc258 (patch)
tree0b8f8b92c5f2e95f20e9d67b82ba30f1592db22d /deploy/host_virtual.sh
parentc1f8ed8e836fb05eec5814e1a721352e64bc84d0 (diff)
support redeploy
JIRA: COMPASS-216 Change-Id: Ide78ac82c1615259eeb7093c7a4485fbe493c6d9 Signed-off-by: baigk <baiguoku@huawei.com>
Diffstat (limited to 'deploy/host_virtual.sh')
-rw-r--r--deploy/host_virtual.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/deploy/host_virtual.sh b/deploy/host_virtual.sh
index 4cb33613..c7e5f84e 100644
--- a/deploy/host_virtual.sh
+++ b/deploy/host_virtual.sh
@@ -1,10 +1,13 @@
host_vm_dir=$WORK_DIR/vm
function tear_down_machines() {
+ old_ifs=$IFS
+ IFS=,
for i in $HOSTNAMES; do
sudo virsh destroy $i
sudo virsh undefine $i
rm -rf $host_vm_dir/$i
done
+ IFS=$old_ifs
}
function reboot_hosts() {
@@ -14,7 +17,6 @@ function reboot_hosts() {
function launch_host_vms() {
old_ifs=$IFS
IFS=,
- tear_down_machines
#function_bod
mac_array=($machines)
log_info "bringing up pxe boot vms"
@@ -44,16 +46,18 @@ function launch_host_vms() {
}
function get_host_macs() {
- local config_file=$WORK_DIR/installer/compass-install/install/group_vars/all
local mac_generator=${COMPASS_DIR}/deploy/mac_generator.sh
local machines=
- chmod +x $mac_generator
- mac_array=`$mac_generator $VIRT_NUMBER`
- machines=`echo $mac_array|sed 's/ /,/g'`
+ if [[ $REDEPLOY_HOST == "true" ]]; then
+ mac_array=`cat $WORK_DIR/switch_machines`
+ else
+ chmod +x $mac_generator
+ mac_array=`$mac_generator $VIRT_NUMBER`
+ echo $mac_array > $WORK_DIR/switch_machines
+ fi
- echo "test: true" >> $config_file
- echo "pxe_boot_macs: [${machines}]" >> $config_file
+ machines=`echo $mac_array|sed 's/ /,/g'`
echo $machines
}