提交 c33a922f 编写于 作者: M Martin Kletzander

Add support for reboot-timeout

Whenever the guest machine fails to boot, new parameter (reboot-timeout)
controls whether it should reboot and after how many ms it should do so.

Docs included.
上级 ede89aab
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
<boot dev='cdrom'/> <boot dev='cdrom'/>
<bootmenu enable='yes'/> <bootmenu enable='yes'/>
<smbios mode='sysinfo'/> <smbios mode='sysinfo'/>
<bios useserial='yes'/> <bios useserial='yes' rebootTimeout='0'/>
</os> </os>
...</pre> ...</pre>
...@@ -175,8 +175,13 @@ ...@@ -175,8 +175,13 @@
Serial Graphics Adapter which allows users to see BIOS messages Serial Graphics Adapter which allows users to see BIOS messages
on a serial port. Therefore, one needs to have on a serial port. Therefore, one needs to have
<a href="#elementCharSerial">serial port</a> defined. <a href="#elementCharSerial">serial port</a> defined.
<span class="since">Since 0.9.4</span> <span class="since">Since 0.9.4</span>.
</dd> <span class="since">Since 0.10.2 (QEMU only)</span> there is
another attribute, <code>rebootTimeout</code> that controls
whether and after how long the guest should start booting
again in case the boot fails (according to BIOS). The value is
in milliseconds with maximum of <code>65535</code> and special
value <code>-1</code> disables the reboot.
</dl> </dl>
<h4><a name="elementsOSBootloader">Host bootloader</a></h4> <h4><a name="elementsOSBootloader">Host bootloader</a></h4>
......
...@@ -3190,12 +3190,19 @@ ...@@ -3190,12 +3190,19 @@
<define name="bios"> <define name="bios">
<element name="bios"> <element name="bios">
<attribute name="useserial"> <optional>
<choice> <attribute name="useserial">
<value>yes</value> <choice>
<value>no</value> <value>yes</value>
</choice> <value>no</value>
</attribute> </choice>
</attribute>
</optional>
<optional>
<attribute name="rebootTimeout">
<ref name="rebootTimeoutDelay"/>
</attribute>
</optional>
</element> </element>
</define> </define>
...@@ -3469,6 +3476,11 @@ ...@@ -3469,6 +3476,11 @@
<param name='minInclusive'>-1</param> <param name='minInclusive'>-1</param>
</data> </data>
</define> </define>
<define name="rebootTimeoutDelay">
<data type="short">
<param name="minInclusive">-1</param>
</data>
</define>
<define name="PortNumber"> <define name="PortNumber">
<data type="short"> <data type="short">
<param name="minInclusive">-1</param> <param name="minInclusive">-1</param>
......
...@@ -8136,7 +8136,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, ...@@ -8136,7 +8136,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
{ {
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int i, n; int i, n;
char *bootstr; char *bootstr, *tmp;
char *useserial = NULL; char *useserial = NULL;
int ret = -1; int ret = -1;
unsigned long deviceBoot, serialPorts; unsigned long deviceBoot, serialPorts;
...@@ -8214,10 +8214,25 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, ...@@ -8214,10 +8214,25 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
} }
} }
tmp = virXPathString("string(./os/bios[1]/@rebootTimeout)", ctxt);
if (tmp) {
/* that was really just for the check if it is there */
if (virStrToLong_i(tmp, NULL, 0, &def->os.bios.rt_delay) < 0 ||
def->os.bios.rt_delay < -1 || def->os.bios.rt_delay > 65535) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("invalid value for rebootTimeout, "
"must be in range [-1,65535]"));
goto cleanup;
}
def->os.bios.rt_set = true;
}
*bootCount = deviceBoot; *bootCount = deviceBoot;
ret = 0; ret = 0;
cleanup: cleanup:
VIR_FREE(tmp);
VIR_FREE(useserial); VIR_FREE(useserial);
VIR_FREE(nodes); VIR_FREE(nodes);
return ret; return ret;
...@@ -13494,11 +13509,17 @@ virDomainDefFormatInternal(virDomainDefPtr def, ...@@ -13494,11 +13509,17 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virBufferAsprintf(buf, " <bootmenu enable='%s'/>\n", enabled); virBufferAsprintf(buf, " <bootmenu enable='%s'/>\n", enabled);
} }
if (def->os.bios.useserial) { if (def->os.bios.useserial || def->os.bios.rt_set) {
const char *useserial = (def->os.bios.useserial == virBufferAddLit(buf, " <bios");
VIR_DOMAIN_BIOS_USESERIAL_YES ? "yes" if (def->os.bios.useserial)
: "no"); virBufferAsprintf(buf, " useserial='%s'",
virBufferAsprintf(buf, " <bios useserial='%s'/>\n", useserial); (def->os.bios.useserial ==
VIR_DOMAIN_BIOS_USESERIAL_YES ? "yes"
: "no"));
if (def->os.bios.rt_set)
virBufferAsprintf(buf, " rebootTimeout='%d'", def->os.bios.rt_delay);
virBufferAddLit(buf, "/>\n");
} }
} }
......
...@@ -1420,6 +1420,9 @@ typedef struct _virDomainBIOSDef virDomainBIOSDef; ...@@ -1420,6 +1420,9 @@ typedef struct _virDomainBIOSDef virDomainBIOSDef;
typedef virDomainBIOSDef *virDomainBIOSDefPtr; typedef virDomainBIOSDef *virDomainBIOSDefPtr;
struct _virDomainBIOSDef { struct _virDomainBIOSDef {
int useserial; int useserial;
/* reboot-timeout parameters */
bool rt_set;
int rt_delay;
}; };
/* Operating system configuration data & machine / arch */ /* Operating system configuration data & machine / arch */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册