[PATCH 10/14] conf: disk: extract sgio/rawio validation

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

 



---
 src/conf/domain_conf.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b1432ef..8ac308c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6911,6 +6911,20 @@ virDomainDiskDefValidate(const virDomainDiskDef *def)
         }
     }

+    if (def->device != VIR_DOMAIN_DISK_DEVICE_LUN) {
+        if (def->rawio != VIR_TRISTATE_BOOL_ABSENT) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("rawio can be used only with device='lun'"));
+            return -1;
+        }
+
+        if (def->sgio != VIR_DOMAIN_DEVICE_SGIO_DEFAULT) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("sgio can be used only with device='lun'"));
+            return -1;
+        }
+    }
+
     return 0;
 }

@@ -7330,14 +7344,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
         def->snapshot = VIR_DOMAIN_SNAPSHOT_LOCATION_NONE;
     }

-    if ((rawio || sgio) &&
-        (def->device != VIR_DOMAIN_DISK_DEVICE_LUN)) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("rawio or sgio can be used only with "
-                         "device='lun'"));
-        goto error;
-    }
-
     if (rawio) {
         if ((def->rawio = virTristateBoolTypeFromString(rawio)) <= 0) {
             virReportError(VIR_ERR_XML_ERROR,
-- 
2.8.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]