diff options
author | Martin Kletzander <mkletzan@redhat.com> | 2012-09-18 12:30:52 +0200 |
---|---|---|
committer | Martin Kletzander <mkletzan@redhat.com> | 2012-09-20 16:41:01 +0200 |
commit | c33a922faad1de363aa4212edc1a329bd47e52b0 (patch) | |
tree | 8645408e76936342771a72bef7ce7edfdd0edf03 /src | |
parent | security: Don't ignore errors when parsing DAC security labels (diff) | |
download | libvirt-c33a922faad1de363aa4212edc1a329bd47e52b0.tar.gz libvirt-c33a922faad1de363aa4212edc1a329bd47e52b0.tar.bz2 libvirt-c33a922faad1de363aa4212edc1a329bd47e52b0.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/conf/domain_conf.c | 33 | ||||
-rw-r--r-- | src/conf/domain_conf.h | 3 |
2 files changed, 30 insertions, 6 deletions
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 35814fb02..d6f2ebfe2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8136,7 +8136,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, { xmlNodePtr *nodes = NULL; int i, n; - char *bootstr; + char *bootstr, *tmp; char *useserial = NULL; int ret = -1; unsigned long deviceBoot, serialPorts; @@ -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; ret = 0; cleanup: + VIR_FREE(tmp); VIR_FREE(useserial); VIR_FREE(nodes); return ret; @@ -13494,11 +13509,17 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAsprintf(buf, " <bootmenu enable='%s'/>\n", enabled); } - if (def->os.bios.useserial) { - const char *useserial = (def->os.bios.useserial == - VIR_DOMAIN_BIOS_USESERIAL_YES ? "yes" - : "no"); - virBufferAsprintf(buf, " <bios useserial='%s'/>\n", useserial); + if (def->os.bios.useserial || def->os.bios.rt_set) { + virBufferAddLit(buf, " <bios"); + if (def->os.bios.useserial) + virBufferAsprintf(buf, " useserial='%s'", + (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"); } } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 510406a63..d719d57da 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1420,6 +1420,9 @@ typedef struct _virDomainBIOSDef virDomainBIOSDef; typedef virDomainBIOSDef *virDomainBIOSDefPtr; struct _virDomainBIOSDef { int useserial; + /* reboot-timeout parameters */ + bool rt_set; + int rt_delay; }; /* Operating system configuration data & machine / arch */ |