Updating dnsmasq options with virsh net-update

brent s. bts at square-r00t.net
Wed Mar 17 17:51:33 UTC 2021


On 3/17/21 13:19, Alex Crawford wrote:
> I'm trying to take advantage of libvirt's support for passing through
> options to dnsmasq
> <https://libvirt.org/formatnetwork.html#elementsNamespaces>, but I'm
> having trouble getting it to take effect. I have a network already
> created and I'm trying to use net-update to add the options, but it's
> not clear to me what section I should specify. By the way, is there a
> good way to list the available sections? I've been resorting to reading
> the code
> <https://gitlab.com/libvirt/libvirt/-/blob/18d0f2f9569edf3c26d912a7d8974a54bb32eee9/include/libvirt/libvirt-network.h#L158-175>.
> Working in a different direction, I tried using net-edit to make the
> changes but they seem to have been silently discarded:
> 
>     $ virsh -c qemu:///system net-edit crawford-libvirt-67v2h
>     Network crawford-libvirt-67v2h XML configuration edited.
>     $ virsh -c qemu:///system net-dumpxml crawford-libvirt-67v2h | grep
> --count <my changes>
>     0
> 
> Can anyone tell me what I'm doing wrong or how this feature was intended
> to be used? Thank you.
> 
> -Alex

The last time I tried using net-update, if I recall it didn't support
full editing. I had to net-edit the network in question and restart it
(to do exactly what you're tryint to do, I should note!). I don't think
net-update lets you edit the root element's namespace (which is what you
need to do for e.g. <dnsmasq:options> to not be eaten).

For reference, the modified root element looks like this:

<network xmlns:dnsmasq="http://libvirt.org/schemas/network/dnsmasq/1.0">
  <!-- Normal network definition here... -->
  <dnsmasq:options>
    <dnsmasq:option value="log-dhcp"/>
  </dnsmasq:options>
</network>

-- 
brent saner
https://square-r00t.net/
GPG info: https://square-r00t.net/gpg-info





More information about the libvirt-users mailing list