[PATCH 13/14] conf: disk: Extract checking of removable status

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

 



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

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

+    if (def->removable != VIR_TRISTATE_SWITCH_ABSENT &&
+        def->bus != VIR_DOMAIN_DISK_BUS_USB) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("removable is only valid for usb disks"));
+        return -1;
+    }
+
     return 0;
 }

@@ -7424,12 +7431,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
                            _("unknown disk removable status '%s'"), removable);
             goto error;
         }
-
-        if (def->bus != VIR_DOMAIN_DISK_BUS_USB) {
-            virReportError(VIR_ERR_XML_ERROR, "%s",
-                           _("removable is only valid for usb disks"));
-            goto error;
-        }
     }

     if (devaddr) {
-- 
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]