network: dnsmasq: Don't format lease file path

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.
This commit is contained in:
Peter Krempa 2014-11-20 13:56:39 +01:00
parent ca6dbdd047
commit 421406808a
12 changed files with 2 additions and 35 deletions

View 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)

View 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 */

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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; \