I recently switched to Leap from 13.2. First time i have seen the next generation of kde and plasma. So far i like the experience. But i miss some stuff :(. If some dev out there needs an idea for his next little plasma widget project please consider porting service monitor. That widget alone could bring me back to kde4 :).

As i did a clean reinstall once again resolv.conf was not updated when starting my libvirt networks so no dns resolve of vm names. Not sure if that is a bug or expected behaviour but i had it with 13.2 too and consider it a REAL bug. Or at least major annoyance.

Adding the ip address statically to resolv.conf is not a option. This is a notebook so most services do not get started on default. Which includes libvirtd.

The solution i came up with is to add a libvirt hook that registers the libvirt dnsmasq instance with netconfig when starting libvirt networks and removing it when stopping it. Not much explanation … just code for your convenience.

The script could be improved i guess. Check if dhcp is configured for the network and so on or if dnsmasq is configured for the network in libvirt. But for me it works as is.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 #!/bin/sh
 # vim: et sw=0
 # See https://www.libvirt.org/hooks.html
 OBJECT="${1}"
 OPERATION="${2}"
 SUB_OPERATION="${3}"
 EXTRA_ARGS="${4}"
 # Get the configuration from STDIN
 config=$(cat)
 # Extract the interface and ip addr
 iface=$(sed -ne "s/^.*bridge *name='\([a-zA-Z0-9_]*\).*$/\1/p;" <<<"${config}")
 ipaddr=$(sed -ne "s/^.*ip *address *= *'\([0-9.]*\).*$/\1/p;"   <<<"${config}")
 function check_suboperation() {
   local operation= shift;
   local expected= shift;
   if [ "${oper}" != "${expected}" ]; then
     echo "WARN: Unknown sub-operation ${oper} encountered!" >&2
     exit 1
   fi
 }
 case "${OPERATION}" in
   started)
     check_suboperation "${SUB_OPERATION}" "begin"
     netconfig modify -v --service libvirt --interface "${iface}" -v <<< "DNSSERVERS='${ipaddr}'"
     ;;
   stopped)
     check_suboperation "${SUB_OPERATION}" "begin"
     netconfig remove -v --service libvirt --interface "${iface}" -v <<< "DNSSERVERS='${ipaddr}'"
     ;;
 esac
 exit 0

This script is put under the unlicense license