diff options
author | Justin chi <chigang@huawei.com> | 2017-11-21 02:22:26 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-11-21 02:22:26 +0000 |
commit | 5fc5b9252d1bb18f1d9cecef00d5ce24117784e6 (patch) | |
tree | f627ead9c556b864a0291f80eaae151cd8587007 /deploy/host_virtual.sh | |
parent | 8c219841bb484370f83f88f3d3f627ee6c3858d0 (diff) | |
parent | eb054ac701ff3ed57dccafea5a4a2e67d6bdbb60 (diff) |
Merge "deploy/template/vm: support aarch64 VM"
Diffstat (limited to 'deploy/host_virtual.sh')
-rwxr-xr-x | deploy/host_virtual.sh | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/deploy/host_virtual.sh b/deploy/host_virtual.sh index bd2f49af..03a1230f 100755 --- a/deploy/host_virtual.sh +++ b/deploy/host_virtual.sh @@ -13,14 +13,32 @@ function tear_down_machines() { IFS=, for i in $HOSTNAMES; do sudo virsh destroy $i - sudo virsh undefine $i + if [ "$COMPASS_ARCH" = "aarch64" ]; then + # --nvram is required for UEFI enabled VM + sudo virsh undefine --nvram $i + else + sudo virsh undefine $i + fi rm -rf $host_vm_dir/$i done IFS=$old_ifs } function reboot_hosts() { - log_warn "reboot_hosts do nothing" + # We do need it for aarch64 + if [ "$COMPASS_ARCH" = "aarch64" ]; then + old_ifs=$IFS + IFS=, + for i in $HOSTNAMES; do + sudo virsh destroy $i + sleep 3 + sudo virsh start $i + sleep 3 + done + IFS=$old_ifs + else + log_warn "reboot_hosts do nothing" + fi } function launch_host_vms() { @@ -28,6 +46,13 @@ function launch_host_vms() { IFS=, #function_bod mac_array=($machines) + + # Select vm template per arch + vm_template_dir="$COMPASS_DIR/deploy/template/vm" + vm_template_file="$vm_template_dir/host.xml" + vm_template_arch="$vm_template_dir/host-$COMPASS_ARCH.xml" + [ -f $vm_template_arch ] && vm_template_file=$vm_template_arch + log_info "bringing up pxe boot vms" i=0 for host in $HOSTNAMES; do @@ -43,7 +68,7 @@ function launch_host_vms() { -e "s/REPLACE_BOOT_MAC/${mac_array[i]}/g" \ -e "s/REPLACE_NET_INSTALL/install/g" \ -e "s/REPLACE_NET_IAAS/external_nat/g" \ - $COMPASS_DIR/deploy/template/vm/host.xml\ + "$vm_template_file" \ > $vm_dir/libvirt.xml sudo virsh define $vm_dir/libvirt.xml |