[PATCH 6/7] qemu: Support add bootindex = -1 to boothash

Jiang Jiacheng jiangjiacheng at huawei.com
Tue Oct 11 13:38:32 UTC 2022


Support add bootindex = -1 to boothash and return 0 if duplicated bootindex = -1 is set.
It is nessary to add bootindex = -1 into boothash, otherwise libvirt will auto set boot dev,
which will cause bootindex unchangable. Meanwhile, bootindex = -1 means disable bootindex,
so it should be allowed to set duplicated bootindex = -1.

Signed-off-by: Jiang Jiacheng <jiangjiacheng at huawei.com>
---
 src/conf/domain_postparse.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c
index 9810de7437..d264a2ffee 100644
--- a/src/conf/domain_postparse.c
+++ b/src/conf/domain_postparse.c
@@ -1044,6 +1044,12 @@ virDomainDefCollectBootOrder(virDomainDef *def G_GNUC_UNUSED,
     order = g_strdup_printf("%d", info->bootIndex);
 
     if (virHashLookup(bootHash, order)) {
+        /* -1 means disable bootorder so it allowed to
+         * make more than one device use -1
+         */
+        if (info->bootIndex == -1) {
+            return 0;
+        }
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("boot order '%s' used for more than one device"),
                        order);
-- 
2.33.0



More information about the libvir-list mailing list