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

Re: [Libvir] [Discussion] 0/4 Implement DHCP host mappings for virtual networks



On Fri, Feb 22, 2008 at 08:04:26AM +0000, Mark McLoughlin wrote:
> Hi Rich,
> 
> On Thu, 2008-02-21 at 20:54 +0000, Richard W.M. Jones wrote:
> > What this patch allows you to do is to create a table of IP address to
> > host (defined by its hardware / MAC address) for each virtual network.
> > Optionally you can also assign a hostname.  When a host starts up and
> > requests an IP address through DHCP, if it is in this table then it
> > gets the fixed IP address from the table and, optionally, a fixed
> > hostname.
> > 
> > Four new API calls are added.  Two are required to list the contents
> > of the mapping table.  Two more allow you to add and delete a mapping.
> > 
> > The mapping table is semi-permanent.  It is stored in
> > /var/lib/libvirt/hosts-<networkname>.conf and survives across libvirtd
> > restarts.
> 
> 	Cool stuff, but why isn't this just an addition to the network's XML
> definition?

It is possible, but tricky to get the on-the-fly updates when the semantics
of the APIs for creating/definging networks.

If you call 'virNetworkDefine' with a new XML doc, it loads the new config
into memory, but does not apply the config until you destroy & restart
the network in question. We can't destroy & restart the network since this
would break networking for any live guests attached to the network.

So if we wanted to represent this in the master XML for a network we'd have
to follow the example of domain device hotplug, and have APIs to add/remove
a snippet of XML describing the new entry.

   virNetworkAddHostMapping(virNetworkPtr net, char *xml);
   virNetworkRemoveHostMapping(virNetworkPtr net, char *xml);

 Where the XML was:

      '<mapping hostname="foo" mac="00:33:22:55:44:11"/>'


Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 


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