The virsh.rb loadSubnets method was only looking for a definition of a netmask inside the libvirt network XML, despite netmask not being there in case a prefix attribute was defined. netmask and prefix are mutually exclusive by libvirt definition.
Also the ipaddr library has no easy way of retrieving a readable netmask from a prefix, albeit this functionality is provided by the inspect method of IPAddr, a monkey-patch "to_mask" was introduced to circument the original implementation.
Related issues
Bug #6085: Virsh provider is not interpreting DHCP netmask correctly
fixes #6085 - fixed virsh dhcp provider netmask interpretation
The virsh.rb loadSubnets method was only looking for a definition of
a netmask inside the libvirt network XML, despite netmask not being
there in case a prefix attribute was defined. netmask and prefix are
mutually exclusive by libvirt definition.
Also the ipaddr library has no easy way of retrieving a readable netmask
from a prefix, albeit this functionality is provided by the inspect
method of IPAddr, a monkey-patch "to_mask" was introduced to circument
the original implementation.