diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index e471385e25..eb61f15894 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -142,11 +142,16 @@ name to be given that host by the DHCP server (via the name attribute). Since 0.4.5
bootp
The optional bootp - element specifies BOOTP options to be provided by the DHCP server. - Only one attribute is supported, file, giving the file - to be used for the boot image). The BOOTP options currently have to - be the same for all address ranges and statically assigned addresses.Since 0.7.1. + element specifies BOOTP options to be provided by the DHCP server. + Two attributes are supported: file is mandatory and + gives the file to be used for the boot image; server is + optional and gives the address of the TFTP server from which the boot + image will be fetched. server defaults to the same host + that runs the DHCP server, as is the case when the tftp + element is used. The BOOTP options currently have to be the same + for all address ranges and statically assigned addresses.Since 0.7.1 (server since 0.7.3). +

Example configuration

diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 7a2d7d4f4d..adef792ed2 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -109,6 +109,9 @@ + + + diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 40f5fdd081..fd8efb0b92 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -117,6 +117,7 @@ void virNetworkDefFree(virNetworkDefPtr def) VIR_FREE(def->tftproot); VIR_FREE(def->bootfile); + VIR_FREE(def->bootserver); VIR_FREE(def); } @@ -313,6 +314,7 @@ virNetworkDHCPRangeDefParseXML(virConnectPtr conn, } def->bootfile = (char *)file; + def->bootserver = (char *) xmlGetProp(cur, BAD_CAST "server"); } cur = cur->next; @@ -671,8 +673,13 @@ char *virNetworkDefFormat(virConnectPtr conn, virBufferAddLit(&buf, "/>\n"); } if (def->bootfile) { - virBufferEscapeString(&buf, " \n", + virBufferEscapeString(&buf, " bootfile); + if (def->bootserver) { + virBufferEscapeString(&buf, "server='%s' ", + def->bootserver); + } + virBufferAddLit(&buf, "/>\n"); } virBufferAddLit(&buf, " \n"); diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index e983a015a1..6175b0f65d 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -81,6 +81,7 @@ struct _virNetworkDef { char *tftproot; char *bootfile; + char *bootserver; }; typedef struct _virNetworkObj virNetworkObj; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 95bc810416..bc241ef4dd 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -402,7 +402,7 @@ networkBuildDnsmasqArgv(virConnectPtr conn, (2 * network->def->nhosts) + /* --enable-tftp --tftp-root /srv/tftp */ (network->def->tftproot ? 3 : 0) + - /* --dhcp-boot pxeboot.img */ + /* --dhcp-boot pxeboot.img[,,12.34.56.78] */ (network->def->bootfile ? 2 : 0) + 1; /* NULL */ @@ -488,8 +488,13 @@ networkBuildDnsmasqArgv(virConnectPtr conn, APPEND_ARG(*argv, i++, network->def->tftproot); } if (network->def->bootfile) { + snprintf(buf, sizeof(buf), "%s%s%s", + network->def->bootfile, + network->def->bootserver ? ",," : "", + network->def->bootserver ? network->def->bootserver : ""); + APPEND_ARG(*argv, i++, "--dhcp-boot"); - APPEND_ARG(*argv, i++, network->def->bootfile); + APPEND_ARG(*argv, i++, buf); } #undef APPEND_ARG diff --git a/tests/networkxml2xmlin/netboot-proxy-network.xml b/tests/networkxml2xmlin/netboot-proxy-network.xml new file mode 100644 index 0000000000..ecb6738694 --- /dev/null +++ b/tests/networkxml2xmlin/netboot-proxy-network.xml @@ -0,0 +1,13 @@ + + netboot + 81ff0d90-c91e-6742-64da-4a736edb9a9b + + + + + + + + + + diff --git a/tests/networkxml2xmlout/netboot-proxy-network.xml b/tests/networkxml2xmlout/netboot-proxy-network.xml new file mode 100644 index 0000000000..e11c50b3ee --- /dev/null +++ b/tests/networkxml2xmlout/netboot-proxy-network.xml @@ -0,0 +1,13 @@ + + netboot + 81ff0d90-c91e-6742-64da-4a736edb9a9b + + + + + + + + + + diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index b02d735a47..957e64b8ac 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -89,6 +89,7 @@ mymain(int argc, char **argv) DO_TEST("routed-network"); DO_TEST("nat-network"); DO_TEST("netboot-network"); + DO_TEST("netboot-proxy-network"); return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE); }