[libvirt PATCH 6/7] Add validation for virtiofs boot order setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/conf/domain_validate.c | 17 ++++++++++++++++-
 src/qemu/qemu_validate.c   |  6 ++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 649fc335ac..404eee09a9 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -1528,6 +1528,19 @@ virDomainShmemDefValidate(const virDomainShmemDef *shmem)
     return 0;
 }
 
+static int
+virDomainFSDefValidate(const virDomainFSDef *fs)
+{
+    if (fs->info.bootIndex &&
+        fs->fsdriver != VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("boot order is only supported for virtiofs"));
+        return -1;
+    }
+
+    return 0;
+}
+
 
 static int
 virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
@@ -1573,10 +1586,12 @@ virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
     case VIR_DOMAIN_DEVICE_SHMEM:
         return virDomainShmemDefValidate(dev->data.shmem);
 
+    case VIR_DOMAIN_DEVICE_FS:
+        return virDomainFSDefValidate(dev->data.fs);
+
     case VIR_DOMAIN_DEVICE_AUDIO:
         /* TODO: validate? */
     case VIR_DOMAIN_DEVICE_LEASE:
-    case VIR_DOMAIN_DEVICE_FS:
     case VIR_DOMAIN_DEVICE_SOUND:
     case VIR_DOMAIN_DEVICE_WATCHDOG:
     case VIR_DOMAIN_DEVICE_GRAPHICS:
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index a060bd98ba..92319ab3a5 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4093,6 +4093,12 @@ qemuValidateDomainDeviceDefFS(virDomainFSDefPtr fs,
         }
         if (qemuValidateDomainDefVirtioFSSharedMemory(def, qemuCaps) < 0)
             return -1;
+        if (fs->info.bootIndex &&
+            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_USER_FS_BOOTINDEX)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("setting virtiofs boot order is not supported with this QEMU binary"));
+            return -1;
+        }
         break;
 
     case VIR_DOMAIN_FS_DRIVER_TYPE_LAST:
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux