]> xenbits.xensource.com Git - libvirt.git/commitdiff
network: dnsmasq: Don't format lease file path
authorPeter Krempa <pkrempa@redhat.com>
Thu, 20 Nov 2014 12:56:39 +0000 (13:56 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Dec 2014 13:22:40 +0000 (14:22 +0100)
Now that we don't use the leases file at all for leases just don't
format it into the config and use the leaseshelper to do all the
lifting.

12 files changed:
src/network/bridge_driver.c
src/network/bridge_driver.h
tests/networkxml2confdata/dhcp6-nat-network.conf
tests/networkxml2confdata/dhcp6-network.conf
tests/networkxml2confdata/isolated-network.conf
tests/networkxml2confdata/nat-network-dns-srv-record-minimal.conf
tests/networkxml2confdata/nat-network-dns-srv-record.conf
tests/networkxml2confdata/nat-network-dns-txt-record.conf
tests/networkxml2confdata/nat-network.conf
tests/networkxml2confdata/netboot-network.conf
tests/networkxml2confdata/netboot-proxy-network.conf
tests/networkxml2conftest.c

index 70e3f270a4de5c20c97a1b0721af0c048c75afd2..9ccc9f8f8de6d5c2a3bf9774294678a6e8386ed6 100644 (file)
@@ -209,9 +209,6 @@ networkDnsmasqLeaseFileNameDefault(const char *netname)
     return leasefile;
 }
 
-networkDnsmasqLeaseFileNameFunc networkDnsmasqLeaseFileName =
-    networkDnsmasqLeaseFileNameDefault;
-
 static char *
 networkDnsmasqLeaseFileNameCustom(const char *bridge)
 {
@@ -273,7 +270,7 @@ networkRemoveInactive(virNetworkObjPtr net)
         goto cleanup;
     }
 
-    if (!(leasefile = networkDnsmasqLeaseFileName(def->name)))
+    if (!(leasefile = networkDnsmasqLeaseFileNameDefault(def->name)))
         goto cleanup;
 
     if (!(customleasefile = networkDnsmasqLeaseFileNameCustom(def->bridge)))
@@ -1202,14 +1199,8 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
         ipdef = (ipdef == ipv6def) ? NULL : ipv6def;
     }
 
-    if (nbleases > 0) {
-        char *leasefile = networkDnsmasqLeaseFileName(network->def->name);
-        if (!leasefile)
-            goto cleanup;
-        virBufferAsprintf(&configbuf, "dhcp-leasefile=%s\n", leasefile);
-        VIR_FREE(leasefile);
+    if (nbleases > 0)
         virBufferAsprintf(&configbuf, "dhcp-lease-max=%d\n", nbleases);
-    }
 
     /* this is done once per interface */
     if (networkBuildDnsmasqHostsList(dctx, dns) < 0)
index decc08f77da00886d40c79b8a81382de884acee0..2f801ee5146848ef002a940a9bd386f837c0c9ca 100644 (file)
@@ -64,7 +64,4 @@ int networkDnsmasqConfContents(virNetworkObjPtr network,
 
 typedef char *(*networkDnsmasqLeaseFileNameFunc)(const char *netname);
 
-/* this allows the testsuite to replace the lease filename resolver function */
-extern networkDnsmasqLeaseFileNameFunc networkDnsmasqLeaseFileName;
-
 #endif /* __VIR_NETWORK__DRIVER_H */
index f270a4372d6bfeff5daecdd29a337a2c5457e520..922eb7a32c4ffcc9f658467fd4775757f771960d 100644 (file)
@@ -11,7 +11,6 @@ interface=virbr0
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
 dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff
-dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
 dhcp-lease-max=493
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
index f0a96609752a1b510dd8a4cb6f2dd36d72283472..064515f8163a7c3894cd7730c42f81b10313c44c 100644 (file)
@@ -11,7 +11,6 @@ except-interface=lo
 bind-dynamic
 interface=virbr0
 dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff
-dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
 dhcp-lease-max=240
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
index 6ba34ae56e36430f8716ebf1069a7fbc648ecd3b..fbdf75a7de458926a66bf8e9da5d8743c81d3286 100644 (file)
@@ -12,7 +12,6 @@ dhcp-option=3
 no-resolv
 dhcp-range=192.168.152.2,192.168.152.254
 dhcp-no-override
-dhcp-leasefile=/var/lib/libvirt/dnsmasq/private.leases
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/private.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/private.addnhosts
index e60411ba259783ee51a08b55586fe04c4826bfdd..08ed67204b4247927db367826190ee8056088813 100644 (file)
@@ -15,7 +15,6 @@ listen-address=10.24.10.1
 srv-host=_name._tcp
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
-dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
index 16e7dca506be92c775dc9e22b53e774202437b0d..d7de422c71e2b01d0d6663a307645a42fae1ee10 100644 (file)
@@ -17,7 +17,6 @@ srv-host=_name6._tcp.test6.com,test6.example.com,6666,0,666
 srv-host=_name7._tcp.test7.com,test7.example.com,1,0,777
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
-dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
index ff53f4e4f73d6738157e4ba54532a58e0a2b7c89..44ed6bd1898ee7e3a8307490d29a84c137fc7532 100644 (file)
@@ -11,7 +11,6 @@ interface=virbr0
 txt-record=example,example value
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
-dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
index ced4123a96fc8fc8a634c296e81a5e239232aae0..34d5b17d8ad2dfc2257e17ccfa935a4af16e3cb6 100644 (file)
@@ -10,7 +10,6 @@ bind-dynamic
 interface=virbr0
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
-dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
index 8ea1f67de9e770f67717281300221fe364d25dea..4b8f0cc457788c56b73f3864dbd125d2ac383d48 100644 (file)
@@ -15,7 +15,6 @@ dhcp-no-override
 enable-tftp
 tftp-root=/var/lib/tftproot
 dhcp-boot=pxeboot.img
-dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/netboot.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/netboot.addnhosts
index 4774a92dd6a9733862c4b41be3ca7d34daf146cc..61a025c3e211fc020be7281889789b6798bcf39d 100644 (file)
@@ -13,7 +13,6 @@ listen-address=192.168.122.1
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
 dhcp-boot=pxeboot.img,,10.20.30.40
-dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/netboot.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/netboot.addnhosts
index 4f1d9345ffe4b3e70f88e26fc22d192659a75b2c..267513f6372c11654fa6f0ebc985c5232c381ca2 100644 (file)
@@ -100,16 +100,6 @@ testCompareXMLToConfHelper(const void *data)
     return result;
 }
 
-static char *
-testDnsmasqLeaseFileName(const char *netname)
-{
-    char *leasefile;
-
-    ignore_value(virAsprintf(&leasefile, "/var/lib/libvirt/dnsmasq/%s.leases",
-                             netname));
-    return leasefile;
-}
-
 static int
 mymain(void)
 {
@@ -121,8 +111,6 @@ mymain(void)
     dnsmasqCapsPtr dhcpv6
         = dnsmasqCapsNewFromBuffer("Dnsmasq version 2.64\n--bind-dynamic", DNSMASQ);
 
-    networkDnsmasqLeaseFileName = testDnsmasqLeaseFileName;
-
 #define DO_TEST(xname, xcaps)                                        \
     do {                                                             \
         static testInfo info;                                        \