From d9f3e68278a9d26b6b563d7f9563d732e4c6c811 Mon Sep 17 00:00:00 2001 From: mirsal Date: Wed, 4 Aug 2021 00:56:55 +0000 Subject: [PATCH] shell_scripts: Fix reporting of VM IP addresses The shell script which gets informations from libvirt incorrectly matches virsh output lines which contain VMs' public IPv4 addresses. It doesn't work when there are multiple address families which breaks reporting of IPv4 address when a VM also has an IPv6 address and virsh happen to output that one first. This commit changes it to explicitely match the first ipv4 address instead. --- capsulflask/shell_scripts/get.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/capsulflask/shell_scripts/get.sh b/capsulflask/shell_scripts/get.sh index 3dc14d2..6d57a35 100755 --- a/capsulflask/shell_scripts/get.sh +++ b/capsulflask/shell_scripts/get.sh @@ -30,6 +30,6 @@ if virsh domuuid "$vmname" | grep -vqE '^[\t\s\n]*$'; then fi # this gets the ipv4 -ipv4="$(virsh domifaddr "$vmname" | awk '/vnet/ {print $4}' | cut -d'/' -f1)" +ipv4="$(virsh domifaddr "$vmname" | awk '/ipv4/ {print $4}' | cut -d'/' -f1)" echo "$exists $state $ipv4" \ No newline at end of file