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.
---
src/network/bridge_driver.c | 13 ++-----------
src/network/bridge_driver.h | 3 ---
tests/networkxml2confdata/dhcp6-nat-network.conf | 1 -
tests/networkxml2confdata/dhcp6-network.conf | 1 -
tests/networkxml2confdata/isolated-network.conf | 1 -
.../nat-network-dns-srv-record-minimal.conf | 1 -
tests/networkxml2confdata/nat-network-dns-srv-record.conf | 1 -
tests/networkxml2confdata/nat-network-dns-txt-record.conf | 1 -
tests/networkxml2confdata/nat-network.conf | 1 -
tests/networkxml2confdata/netboot-network.conf | 1 -
tests/networkxml2confdata/netboot-proxy-network.conf | 1 -
tests/networkxml2conftest.c | 12 ------------
12 files changed, 2 insertions(+), 35 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 6ecbc37..9355003 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -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)))
@@ -1183,14 +1180,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)
diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h
index decc08f..2f801ee 100644
--- a/src/network/bridge_driver.h
+++ b/src/network/bridge_driver.h
@@ -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 */
diff --git a/tests/networkxml2confdata/dhcp6-nat-network.conf
b/tests/networkxml2confdata/dhcp6-nat-network.conf
index f270a43..922eb7a 100644
--- a/tests/networkxml2confdata/dhcp6-nat-network.conf
+++ b/tests/networkxml2confdata/dhcp6-nat-network.conf
@@ -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
diff --git a/tests/networkxml2confdata/dhcp6-network.conf
b/tests/networkxml2confdata/dhcp6-network.conf
index f0a9660..064515f 100644
--- a/tests/networkxml2confdata/dhcp6-network.conf
+++ b/tests/networkxml2confdata/dhcp6-network.conf
@@ -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
diff --git a/tests/networkxml2confdata/isolated-network.conf
b/tests/networkxml2confdata/isolated-network.conf
index 6ba34ae..fbdf75a 100644
--- a/tests/networkxml2confdata/isolated-network.conf
+++ b/tests/networkxml2confdata/isolated-network.conf
@@ -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
diff --git a/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.conf
b/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.conf
index e60411b..08ed672 100644
--- a/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.conf
+++ b/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.conf
@@ -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
diff --git a/tests/networkxml2confdata/nat-network-dns-srv-record.conf
b/tests/networkxml2confdata/nat-network-dns-srv-record.conf
index 16e7dca..d7de422 100644
--- a/tests/networkxml2confdata/nat-network-dns-srv-record.conf
+++ b/tests/networkxml2confdata/nat-network-dns-srv-record.conf
@@ -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
diff --git a/tests/networkxml2confdata/nat-network-dns-txt-record.conf
b/tests/networkxml2confdata/nat-network-dns-txt-record.conf
index ff53f4e..44ed6bd 100644
--- a/tests/networkxml2confdata/nat-network-dns-txt-record.conf
+++ b/tests/networkxml2confdata/nat-network-dns-txt-record.conf
@@ -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
diff --git a/tests/networkxml2confdata/nat-network.conf
b/tests/networkxml2confdata/nat-network.conf
index ced4123..34d5b17 100644
--- a/tests/networkxml2confdata/nat-network.conf
+++ b/tests/networkxml2confdata/nat-network.conf
@@ -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
diff --git a/tests/networkxml2confdata/netboot-network.conf
b/tests/networkxml2confdata/netboot-network.conf
index 8ea1f67..4b8f0cc 100644
--- a/tests/networkxml2confdata/netboot-network.conf
+++ b/tests/networkxml2confdata/netboot-network.conf
@@ -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
diff --git a/tests/networkxml2confdata/netboot-proxy-network.conf
b/tests/networkxml2confdata/netboot-proxy-network.conf
index 4774a92..61a025c 100644
--- a/tests/networkxml2confdata/netboot-proxy-network.conf
+++ b/tests/networkxml2confdata/netboot-proxy-network.conf
@@ -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
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index 4f1d934..267513f 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -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; \
--
2.1.0