[libvirt] [PATCH] domain_conf: skip boot order check of CD-ROM or floppy device

Chen Hanxiao chen_han_xiao at 126.com
Mon Dec 25 11:21:53 UTC 2017


From: Chen Hanxiao <chenhanxiao at gmail.com>

If we insert or eject a CD-ROM/floppy device with a boot order,
we may get:
  unsupported configuration: boot order 2 is already used by another device

This check should be skipped in this case.

Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
---
 src/conf/domain_conf.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9a62bc472..885ab88d2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -26880,11 +26880,19 @@ virDomainDeviceInfoCheckBootIndex(virDomainDefPtr def ATTRIBUTE_UNUSED,
 {
     virDomainDeviceInfoPtr newinfo = opaque;
 
+    int disk_device = device->data.disk->device;
     if (info->bootIndex == newinfo->bootIndex) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("boot order %u is already used by another device"),
-                       newinfo->bootIndex);
-        return -1;
+        /* Skip check for insert or eject CD-ROM device */
+        if (disk_device == VIR_DOMAIN_DISK_DEVICE_FLOPPY ||
+            disk_device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
+            VIR_DEBUG("Skip boot index check for floppy or CDROM");
+            return 0;
+        } else {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("boot order %u is already used by another device"),
+                           newinfo->bootIndex);
+            return -1;
+        }
     }
     return 0;
 }
-- 
2.14.3




More information about the libvir-list mailing list