[PATCH 12/14] conf: disk: Move validation of disk bus vs disk type

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

 



---
 src/conf/domain_conf.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5fd8cc4..baf6f84 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6933,6 +6933,22 @@ virDomainDiskDefValidate(const virDomainDiskDef *def)
         return -1;
     }

+    if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
+        def->bus != VIR_DOMAIN_DISK_BUS_FDC) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Invalid bus type '%s' for floppy disk"),
+                       virDomainDiskBusTypeToString(def->bus));
+        return -1;
+    }
+
+    if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
+        def->bus == VIR_DOMAIN_DISK_BUS_FDC) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Invalid bus type '%s' for disk"),
+                       virDomainDiskBusTypeToString(def->bus));
+        return -1;
+    }
+
     return 0;
 }

@@ -7416,19 +7432,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
         }
     }

-    if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
-        def->bus != VIR_DOMAIN_DISK_BUS_FDC) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Invalid bus type '%s' for floppy disk"), bus);
-        goto error;
-    }
-    if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
-        def->bus == VIR_DOMAIN_DISK_BUS_FDC) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Invalid bus type '%s' for disk"), bus);
-        goto error;
-    }
-
     if (devaddr) {
         if (virDomainParseLegacyDeviceAddress(devaddr,
                                               &def->info.addr.pci) < 0) {
-- 
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]