<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 25/07/13 19:21, Osier Yang wrote:<br>
</div>
<blockquote cite="mid:51F10A41.3010808@redhat.com" type="cite">On
25/07/13 19:13, Daniel P. Berrange wrote:
<br>
<blockquote type="cite">On Thu, Jul 25, 2013 at 07:01:05PM +0800,
Osier Yang wrote:
<br>
<blockquote type="cite">On 25/07/13 18:53, Daniel P. Berrange
wrote:
<br>
<blockquote type="cite">On Thu, Jul 25, 2013 at 06:43:00PM
+0800, Osier Yang wrote:
<br>
<blockquote type="cite">On 25/07/13 17:35, Daniel P.
Berrange wrote:
<br>
<blockquote type="cite">On Thu, Jul 25, 2013 at 02:02:36PM
+0530, Nehal J. Wani wrote:
<br>
<blockquote type="cite">Currently, there is no API which
returns configuration/state paths of the
<br>
network driver.
<br>
Although it is a private implementation of the network
driver, I don't see
<br>
any harm in
<br>
making the locations public because although the
locations might change,
<br>
there will always
<br>
be a location for these files. There is a need for
this API to implement
<br>
method 2 of the
<br>
"API to query ip addresses of a given domain", refer:
<br>
<a class="moz-txt-link-freetext" href="http://www.mail-archive.com/libvir-list@redhat.com/msg79793.html">http://www.mail-archive.com/libvir-list@redhat.com/msg79793.html</a>
. It is
<br>
required to parse
<br>
the leases file generated by dnsmasq. So, this API
will be used by the qemu
<br>
driver, but it
<br>
can also be made public, so that, if a user wants to
know get some
<br>
information from a
<br>
configuration file, he can get the location from
libvirt and analyze it on
<br>
his own. Right now,
<br>
there is an alternate way to get the info: by using
<br>
networkDnsmasqLeaseFileNameDefault,
<br>
defined in /src/network/bridge_driver.c Since this
function is static, it
<br>
is part of the private
<br>
implementation and not visible outside. To make it
public, the following
<br>
hack is possible:
<br>
</blockquote>
NACK,
<br>
<br>
As I explained on IRC, the hypervisor drivers have no
business accessing
<br>
the dnsmasq lease files from the bridge driver. This is
considered to be
<br>
a private implementation detail.
<br>
<br>
At a conceptual level, what you're after here is a list
of all the IP,
<br>
mac address mappings of the virtual network. This
information is useful
<br>
even outside the context of the hypervisor driver method
you're working
<br>
on. So we should create formal APIs for exposing this,
something like:
<br>
<br>
virNetworkGetDHCPLeases(virNetworkPtr network,
<br>
virNetworkDHCPLeasePtr
*leases,
<br>
unsigned int nleases);
<br>
</blockquote>
i'm wondering if it should be more than just the lease
file path, e.g.
<br>
also the $net.conf, $net-radvd.conf, etc, though they are
useless
<br>
now, but may be useful in future, i.e. to have a more
general api
<br>
than this one. and in that case, it should return an
array of typed
<br>
parameter instead.
<br>
</blockquote>
We've already discussed this in the context of the virDomain
API for
<br>
getting IP addresses & decided that virTypedParameter
was not appropriate
<br>
there & we'd use a struct. The same arguments apply here
IMHO.
<br>
<br>
</blockquote>
the api to get the ip addresses is more complicate than this,
and we
<br>
finally chose the struct is because of the multiple level
information
<br>
is hard to constuct with typed parameter, but for this api,
it's different,
<br>
as it just needs to return the file paths.
<br>
</blockquote>
No, file paths will absolutely never be exposed outside of the
bridge
<br>
driver. The API I suggest above are about exposing the IP
address + MAC
<br>
address of current leases. ie the actual data the user needs,
*not* the
<br>
file path containing the data which is a private impl detail.
<br>
<br>
</blockquote>
oh, i see, agreed with the idea then.
<br>
<br>
</blockquote>
for the api interface:<br>
<br>
int<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<div class="message consecutive outgoing" style="word-wrap:
break-word; text-rendering: optimizelegibility; word-break:
break-word; color: rgb(46, 52, 54); font-family: Sans; font-size:
medium; font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span
class="sender" style="word-wrap: break-word; text-rendering:
optimizelegibility; word-break: break-word; color: rgb(46, 139,
87); "></span><span class="Apple-converted-space"></span>virNetworkGetDHCPLeases(virNetworkPtr
network,<br style="word-wrap: break-word; text-rendering:
optimizelegibility; word-break: break-word; ">
<span class="message" style="word-wrap: break-word;
text-rendering: optimizelegibility; word-break: break-word; ">
<div '="" style="word-wrap: break-word; text-rendering:
optimizelegibility; word-break: break-word; display: inline;
white-space: pre-wrap; "><span
id="message-token-4421c7d0-93fe-4a60-b770-8ced27939ad1"
style="word-wrap: break-word; text-rendering:
optimizelegibility; word-break: break-word; "> unsigned char
*macaddr,<br style="word-wrap: break-word; text-rendering:
optimizelegibility; word-break: break-word; ">
virNetworkDHCPLeasePtr *leases,<br style="word-wrap:
break-word; text-rendering: optimizelegibility;
word-break: break-word; ">
unsigned int nleases);<br style="word-wrap: break-word;
text-rendering: optimizelegibility; word-break:
break-word; ">
</span></div>
</span></div>
<br>
i think this is better. which returns all of the leases if no mac is
specified.<br>
otherwise just returns the lease of the network matches the mac. <br>
<br>
osier<br class="Apple-interchange-newline">
<br>
</body>
</html>