[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/2] Trivial fix: in dhcp-host the name is optional



On 02/19/2013 04:39 PM, Eric Blake wrote:
On 02/15/2013 12:02 PM, Gene Czarcinski wrote:
Although in IPv4 one must pick either mac or name, either
can be omitted.  Similarly, for IPv6, the name
can be optionally omitted.
Signed-off-by: Gene Czarcinski <gene czarc net>
---
  docs/schemas/network.rng | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 09d7c73..a479453 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -281,7 +281,9 @@
                      <optional>
                        <attribute name="mac"><ref name="uniMacAddr"/></attribute>
                      </optional>
-                    <attribute name="name"><text/></attribute>
+                    <optional>
+                      <attribute name="name"><text/></attribute>
+                    </optional>
Hmm.  This says that I can omit both name and mac, and still validate.
Better would be this RelaxNG construct, which says that I must supply at
least one, but can also supply both; the difference is that failure to
supply either will cause a (desired) validation failure.

<choice>
   <group>
     <attribute name="mac"><ref name="uniMacAddr"/></attribute>
     <optional>
       <attribute name="name"><text/></attribute>
     </optional>
   </group>
   <attribute name="name"><text/></attribute>
</choice>

I know Laine already ack'd but since we haven't pushed yet, I'm
wondering if it is worth tightening the grammar.

First of all, I like your suggestion since it is closer to reality. However, when I posed the question here, this was my answer:

On 02/18/2013 09:12 AM, Daniel P. Berrange wrote:
The schemas are intended to provide a simple "syntax check" for XML
documents that an app has created. eg detect typos in element/attribute
names, or use of elements which don't use or incorrect nesting of
elements. Even for syntax checks though, the schemas a not going to
provide 100% coverage - todo so would make the schemas far more complicated
and it is just not worth the effort. The XML parser is the ultimate
place where 100% complete syntax checks are performed.

What they generally do not do, is provide any kind of "semantic check"
about whether the configuration actually makes sense. For example, the
schema won't tell you that requesting virtio disks with a vmware guest
is semantically invalid. This is left to the virt driver.
So, my interpretation is that the schema should not call false negatives but getting all the positives correct is not necessary.

This whole thing with dhcp-host is further complicated by IPv6. That is, for IPv4 you need MAC whereas for IPv6 you need (client) ID but not MAC. Supposedly, for IPv4 you could specify client-id but I have not experimented with that.

In both IPv4 and IPv6, my experiments with dnsmasq say that specifying a name is not sufficient to have an IP address assigned whereas for IPv4 specifying a MAC and for IPv6 specifying an ID is sufficient.


Gene


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]