[libvirt] [PATCH] network: add 'bootp' and 'tftp' config

Daniel P. Berrange berrange at redhat.com
Mon Sep 21 20:57:50 UTC 2009


On Mon, Sep 21, 2009 at 10:50:25PM +0200, Paolo Bonzini wrote:
> Currently, libvirtd will start a dnsmasq process for the virtual
> network, but (aside from killing the dnsmasq process and replacing it),
> there's no way to define tftp boot options.
> 
> This change introduces the appropriate tags to the dhcp configuration:
> 
>  <network>
>    <name>default</name>
>    <bridge name="virbr%d" />
>    <forward/>
>    <ip address="192.168.122.1" netmask="255.255.255.0">
>      <tftp root="/var/lib/tftproot" />
>      <dhcp>
>        <range start="192.168.122.2" end="192.168.122.254" />
>        <bootp file="pxeboot.img"/>
>      </dhcp>
>    </ip>
>  </network>
> 
> When the attributes are present, these are passed to the
> arguments to dnsmasq:
> 
>  dnsmasq [...] --enable-tftp --tftp-root /srv/tftp --dhcp-boot pxeboot.img
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
>                       from <tftp />                     from <bootp />
> 
> At present, only local tftp servers are supported (ie, dnsmasq runs as
> the tftp server), but we could improve this in future by adding a
> server= attribute.
> 
> Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
> Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
> 
> 2009-09-21  Paolo Bonzini  <pbonzini at redhat.com>
>             Jeremy Kerr  <jk at ozlabs.org>
> 
> 	* docs/formatnetwork.html.in: Document new tags.
> 	* docs/formatnetwork.html: Regenerate.
> 	* docs/schemas/network.rng: Update.
> 	* src/network_conf.c (virNetworkDefFree): Free new fields.
> 	(virNetworkDHCPRangeDefParseXML): Parse <bootp>.
> 	(virNetworkIPParseXML): New, parsing <dhcp> and <tftp>.
> 	(virNetworkDefParseXML): Use virNetworkIPParseXML instead of
> 	virNetworkDHCPRangeDefParseXML.
> 	(virNetworkDefFormat): Pretty print new fields.
> 	* src/network_conf.h (struct _virNetworkDef): Add netboot fields.
> 	* src/network_driver.c (networkBuildDnsmasqArgv): Add
> 	TFTP and BOOTP arguments.
> 
> 	* tests/Makefile.am (EXTRA_DIST): Add networkschemadata.
> 	* tests/networkschematest: Look in networkschemadata.
> 	* tests/networkschemadata/netboot-network.xml: New.
> ---
> 	Changes from v2: Rebased after the big tree reorg.
> 
>  docs/formatnetwork.html.in                  |   17 ++++++--
>  docs/schemas/network.rng                    |   10 ++++
>  src/conf/network_conf.c                     |   60 +++++++++++++++++++++++++-
>  src/conf/network_conf.h                     |    3 +
>  src/network/bridge_driver.c                 |   14 ++++++
>  tests/Makefile.am                           |    1 +
>  tests/networkschemadata/netboot-network.xml |   12 +++++
>  tests/networkschematest                     |    2 +-
>  8 files changed, 111 insertions(+), 8 deletions(-)
>  create mode 100644 tests/networkschemadata/netboot-network.xml

ACK, lets commit this now.


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list