<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 19, 2016 at 2:34 AM, Laine Stump <span dir="ltr"><<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 04/18/2016 06:52 PM, Cole Robinson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 04/15/2016 08:18 PM, Alberto Ruiz wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 From 112f61ec5cfdc39f7a157825c4209f7bae34c483 Mon Sep 17 00:00:00 2001<br>
From: Alberto Ruiz <<a href="mailto:aruiz@gnome.org" target="_blank">aruiz@gnome.org</a>><br>
Date: Wed, 13 Apr 2016 17:00:45 +0100<br>
Subject: [PATCH] network: Add support for dhcp-range lease time in the network<br>
  XML configuration format and dnsmasq<br>
<br>
</blockquote>
Also mention the bug in the commit message, just link it like<br>
<br>
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=913446" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=913446</a><br>
<br>
Needs documentation but that will be dependent on what the final patch looks<br>
like, so fine to skip for now.<br>
<br>
The main questions are:<br>
<br>
1) is the XML format fine? <range ... lease='XXX'/>. lease sounds kinda<br>
non-specific to me, maybe leasetime or leaseTime.<br>
<br>
2) what to use for the input format? right now it's just string passthrough to<br>
dnsmasq, which takes a format like XX[s|m|h|d|w], or 'infinite'. Accepting<br>
that format kind of sticks us with that for all time, which probably isn't a<br>
good precedent. the easy way would probably be to just say the value needs to<br>
be in minutes, and maybe -1 == infinite. But that will take a bit more code to<br>
adapt that value to the dnsmasq format.<br>
</blockquote>
<br></span>
Yeah, you should never just read an opaque string and pass it directly through to dnsmasq. Instead, parse an integer (and whatever scaling info - hours / minutes / seconds - I know we do that for bytes vs kbytes vs KiB etc, and if we don't already have the same thing for times somewhere, we should), scale it, check the range for some amount of sanity, and convert that scaled integer into whatever dnsmasq wants when building the commandline.</blockquote><div><br></div><div>Agreed. Will work on a second version of this patch with taking this into account.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
CC laining for his thoughts<br>
</blockquote>
<br></span>
Aside from the missing documentation that you pointed out (and that is just a pain to put in until the exact placement in the XML is figured out anyway), my main sticking point is having the lease time put as an attribute to each range. That just seems.... odd. I know that dnsmasq allows for specifying a lease time per range, but is that the case for other dhcp server implementations? (yeah, I know we don't support any other now, but someday we might :-). And even if dnsmasq *allows* it, unless you're using their tagging to put certain clients into certain IP ranges, there's no practical value in having a different lease time for each range. Maybe it should be an attribute of the <dhcp> element (or, to allow for different scaling, a subelement); every range on the dnsmasq commandline would just get the same lease time. Something like this:<br>
<br>
   <dhcp><br>
     <leaseTime units='seconds'>3600</leasetime><br>
     <range blah blah blah/><br>
     ....<br>
   </dhcp><br>
<br></blockquote><div><br></div><div>Sounds fair, and solves another issue I was hoping to discuss which is per-host leasetime.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If the need for per-range leasetime arose later, that could be added as a sub-element to <range> that would override the leasetime directly under <dhcp>.<br>
<br>
(It's been at least 15 years since I used ISC's dhcpd, but I glanced at the config file manpage just now and it looks like it's possible to have a single "max-lease" that applies to all "pools" (their name for ranges) or to specify a separate max-lease for each pool. I admit I skipped 98% of the contents though :-)).<br>
<br>
In practice, I doubt there will be much difference between what you proposed and what I've suggested - probably 100% of the libvirt virtual networks in existence have only a single range anyway. I *think* splitting it out from the range could prevent us from being painted into a corner though.<br>
<br>
Aside from all that, thanks for taking the time to code this up!</blockquote><div><br></div><div>No worries, my pleasure, will update the patch and get back to you as soon as I can.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And one tiny comment below:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c<br>
index 4fb2e2a..449c9ed 100644<br>
--- a/src/conf/network_conf.c<br>
+++ b/src/conf/network_conf.c<br>
@@ -313,6 +313,10 @@ static void<br>
  virNetworkIpDefClear(virNetworkIpDefPtr def)<br>
  {<br>
      VIR_FREE(def->family);<br>
+<br>
+    while (def->nranges)<br>
+        VIR_FREE(def->ranges[--def->nranges].lease);<br>
+<br>
      VIR_FREE(def->ranges);<br>
        while (def->nhosts)<br>
@@ -855,7 +859,6 @@ int virNetworkIpDefNetmask(const virNetworkIpDef *def,<br>
                                          VIR_SOCKET_ADDR_FAMILY(&def->address));<br>
  }<br>
  -<br>
</blockquote>
stray whitespace change here<br>
<br>
- Cole<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div>Alberto Ruiz<br></div><span>Associate </span>Engineering Manager - Desktop Management Tools<br></div>Red Hat<br></div></div></div></div>
</div></div>