You chose to reconfigure your new virtual machine with a manually configured IP address rather than to obtain it from DHCP, as is the default for cloud images. If you had left it configured to use DHCP, it would have just continued to work.
By default virsh domifaddr
queries the DHCP server lease table to find the guest's IP addresses. With manually configured addresses in the guest, there is nothing to find here, so it can show nothing.
You can instead ask it to query the guest using the QEMU guest agent. This agent should be installed and running by default on cloud images that target the KVM hypervisor, e.g. focal-server-cloudimg-amd64-disk-kvm.img
.
For example:
virsh domifaddr guestname --source agent
This returns a view of the network configuration from inside the guest, which will differ from the outside view, e.g. the guest network interface names will be shown instead of the host virtual interface names.
Compare:
# virsh domifaddr example-staging
Name MAC address Protocol Address
-------------------------------------------------------------------------------
vnet1 52:54:00:6b:3b:e4 ipv4 192.168.122.248/24
with:
# virsh domifaddr example-staging --source agent
Name MAC address Protocol Address
-------------------------------------------------------------------------------
lo 00:00:00:00:00:00 ipv4 127.0.0.1/8
- - ipv6 ::1/128
enp1s0 52:54:00:6b:3b:e4 ipv4 192.168.122.248/24
- - ipv6 fe80::72aa:277e:2feb:5e60/64