From 8f0a15413839c92d6d527bf7cbc441380de6c2af Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Thu, 30 Mar 2023 13:29:49 -0400 Subject: [PATCH] fix(nova): add default live_migration_inbound_addr At the moment, if live_migration_inbound_addr is not defined it will default to the hostname of the hypervisor which requires DNS in order to work properly. DNS can be complicated and it is possible that an environment might not have it, so it makes sense to default to grabbing the default route interface to do live migrations over in order to allow live migrations when DNS is not setup. Change-Id: I10eb63fc64d7cd34ef89df529637b1e81951e38c --- nova/Chart.yaml | 2 +- nova/templates/bin/_nova-compute-init.sh.tpl | 19 ++++++++++++------- releasenotes/notes/nova.yaml | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/nova/Chart.yaml b/nova/Chart.yaml index 0287383cb8..62dec55244 100644 --- a/nova/Chart.yaml +++ b/nova/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Nova name: nova -version: 0.3.6 +version: 0.3.7 home: https://docs.openstack.org/nova/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Nova/OpenStack_Project_Nova_vertical.png sources: diff --git a/nova/templates/bin/_nova-compute-init.sh.tpl b/nova/templates/bin/_nova-compute-init.sh.tpl index 0636b69ff3..442e7d6b19 100644 --- a/nova/templates/bin/_nova-compute-init.sh.tpl +++ b/nova/templates/bin/_nova-compute-init.sh.tpl @@ -23,18 +23,23 @@ mkdir -p /var/lib/nova/instances chown ${NOVA_USER_UID} /var/lib/nova /var/lib/nova/instances migration_interface="{{- .Values.conf.libvirt.live_migration_interface -}}" -if [[ -n $migration_interface ]]; then - # determine ip dynamically based on interface provided - migration_address=$(ip a s $migration_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}' | head -1) +if [[ -z $migration_interface ]]; then + # search for interface with default routing + # If there is not default gateway, exit + migration_interface=$(ip -4 route list 0/0 | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1 fi -touch /tmp/pod-shared/nova-libvirt.conf -if [[ -n $migration_address ]]; then -cat </tmp/pod-shared/nova-libvirt.conf +migration_address=$(ip a s $migration_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}' | head -1) + +if [ -z "${migration_address}" ] ; then + echo "Var live_migration_interface is empty" + exit 1 +fi + +tee > /tmp/pod-shared/nova-libvirt.conf << EOF [libvirt] live_migration_inbound_addr = $migration_address EOF -fi hypervisor_interface="{{- .Values.conf.hypervisor.host_interface -}}" if [[ -z $hypervisor_interface ]]; then diff --git a/releasenotes/notes/nova.yaml b/releasenotes/notes/nova.yaml index 072fc64bb0..59754abdc7 100644 --- a/releasenotes/notes/nova.yaml +++ b/releasenotes/notes/nova.yaml @@ -75,4 +75,5 @@ nova: - 0.3.4 Add OVN values_override, disable dependency to ovn-agent and vif configs for ovn - 0.3.5 Replace node-role.kubernetes.io/master with control-plane - 0.3.6 Fix VNC access issues + - 0.3.7 Fix live migration without DNS resolution ...