name to be given that host by the DHCP server (via the
<code>name</code> attribute). <span class="since">Since 0.4.5</span>
</dd><dt><code>bootp</code></dt><dd>The optional <code>bootp</code>
- element specifies BOOTP options to be provided by the DHCP server.
- Only one attribute is supported, <code>file</code>, 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.<span
- class="since">Since 0.7.1.</span>
+ element specifies BOOTP options to be provided by the DHCP server.
+ Two attributes are supported: <code>file</code> is mandatory and
+ gives the file to be used for the boot image; <code>server</code> is
+ optional and gives the address of the TFTP server from which the boot
+ image will be fetched. <code>server</code> defaults to the same host
+ that runs the DHCP server, as is the case when the <code>tftp</code>
+ element is used. The BOOTP options currently have to be the same
+ for all address ranges and statically assigned addresses.<span
+ class="since">Since 0.7.1 (<code>server</code> since 0.7.3).</span>
+ </dd>
</dl>
<h2><a name="examples">Example configuration</a></h2>
<optional>
<element name="bootp">
<attribute name="file"><text/></attribute>
+ <optional>
+ <attribute name="server"><text/></attribute>
+ </optional>
</element>
</optional>
</element>
VIR_FREE(def->tftproot);
VIR_FREE(def->bootfile);
+ VIR_FREE(def->bootserver);
VIR_FREE(def);
}
}
def->bootfile = (char *)file;
+ def->bootserver = (char *) xmlGetProp(cur, BAD_CAST "server");
}
cur = cur->next;
virBufferAddLit(&buf, "/>\n");
}
if (def->bootfile) {
- virBufferEscapeString(&buf, " <bootp file='%s' />\n",
+ virBufferEscapeString(&buf, " <bootp file='%s' ",
def->bootfile);
+ if (def->bootserver) {
+ virBufferEscapeString(&buf, "server='%s' ",
+ def->bootserver);
+ }
+ virBufferAddLit(&buf, "/>\n");
}
virBufferAddLit(&buf, " </dhcp>\n");
char *tftproot;
char *bootfile;
+ char *bootserver;
};
typedef struct _virNetworkObj virNetworkObj;
(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 */
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
--- /dev/null
+<network>
+ <name>netboot</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <bridge name="virbr1" stp='off' delay='1'/>
+ <domain name="example.com"/>
+ <forward/>
+ <ip address="192.168.122.1" netmask="255.255.255.0">
+ <dhcp>
+ <range start="192.168.122.2" end="192.168.122.254" />
+ <bootp file="pxeboot.img" server="10.20.30.40" />
+ </dhcp>
+ </ip>
+</network>
--- /dev/null
+<network>
+ <name>netboot</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward mode='nat'/>
+ <bridge name='virbr1' stp='off' delay='1' />
+ <domain name='example.com'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254' />
+ <bootp file='pxeboot.img' server='10.20.30.40' />
+ </dhcp>
+ </ip>
+</network>
DO_TEST("routed-network");
DO_TEST("nat-network");
DO_TEST("netboot-network");
+ DO_TEST("netboot-proxy-network");
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}