We explicitly specify the boot order of some device in XML file to
get the desired boot order, just like:
<disk type='block' device='disk'>
...
<boot order='1'/>
...
</disk>
Those devices are considered to be able to change the bootindex by
the following patches. To distinguish those devices from others,
we add a bool bootIndexSpecified into _virDomainDeviceInfo, which
means the device's bootindex is specified in domain's XML file and
can be changed after.BootIndexSpecified will be set to true only if
the device's bootindex is set in XML.
Signed-off-by: Jiang Jiacheng <jiangjiacheng(a)huawei.com>
---
src/conf/device_conf.h | 3 +++
src/conf/domain_conf.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index f2907dc596..5259e25c10 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -144,6 +144,9 @@ struct _virDomainDeviceInfo {
* not formatted back. This allows HV drivers to update it if <os><boot ..
* is present. */
unsigned int effectiveBootIndex;
+ /* bootIndexSpecified is set to true when device's bootIndex is provided in
+ * the XML. This allows changing bootIndex online of some devices. */
+ bool bootIndexSpecified;
/* Valid for any PCI device. Can be used for NIC to get
* stable numbering in Linux */
unsigned int acpiIndex;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6c088ff295..7f045b0d4a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5314,6 +5314,7 @@ virDomainDeviceBootParseXML(xmlNodePtr node,
return -1;
info->effectiveBootIndex = info->bootIndex;
+ info->bootIndexSpecified = true;
loadparm = virXMLPropString(node, "loadparm");
if (loadparm) {
--
2.33.0