Retrieve IPv6 addresses from VMs

This commit allows the model to fetch IPv6 addresses
from running VMs and populate VirtualMachine objects
with the value if it was retrieved successfully
This commit is contained in:
2021-08-04 11:32:32 +00:00
parent 6fb9c651e8
commit 88f667f90f
2 changed files with 15 additions and 8 deletions

View File

@ -29,7 +29,8 @@ if virsh domuuid "$vmname" | grep -vqE '^[\t\s\n]*$'; then
esac
fi
# this gets the ipv4
# this gets the vm ip addresses
ipv4="$(virsh domifaddr "$vmname" | awk '/ipv4/ {print $4}' | cut -d'/' -f1)"
ipv6="$(virsh domifaddr "$vmname" | awk '/ipv6/ {print $4}' | cut -d'/' -f1)"
echo "$exists $state $ipv4"
echo "$exists $state $ipv4 $ipv6"