+
+# Print IP address of the first vNIC owned by specified VM via virsh
+# get_first_vnic_ip vm_name
+function get_first_vnic_ip {
+ local vm_name=$1
+
+ _vnic_mac=$(sudo virsh domiflist $vm_name | \
+ sed -n -e 's/^.*\([0-9a-f]\{2\}\(:[0-9a-f]\{2\}\)\{5\}\).*$/\1/p' | \
+ head -1)
+ die_if_not_set $LINENO _vnic_mac
+ _vnic_ip=$(arp -e | grep $_vnic_mac | awk '{print $1}')
+ die_if_not_set $LINENO _vnic_ip
+ echo $_vnic_ip
+}