[PATCH 08/25] conf: domain: Remove VIR_DOMAIN_DEF_PARSE_DISK_SOURCE parser flag

Peter Krempa pkrempa at redhat.com
Fri Apr 16 15:34:26 UTC 2021


There's no code which would assert it at this point. Remove the flag.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/domain_conf.c | 47 ++++++++++++++++++++----------------------
 src/conf/domain_conf.h | 14 ++++++-------
 2 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1793032301..3f32e046f3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9603,14 +9603,13 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
      * to indicate no media present. LUN is for raw access CD-ROMs
      * that are not attached to a physical device presently */
     if (virStorageSourceIsEmpty(def->src) &&
-        (def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
-         (flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE))) {
+        def->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
         virReportError(VIR_ERR_NO_SOURCE,
                        target ? "%s" : NULL, target);
         return NULL;
     }

-    if (!target && !(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
+    if (!target) {
         if (def->src->srcpool) {
             tmp = g_strdup_printf("pool = '%s', volume = '%s'",
                                   def->src->srcpool->pool, def->src->srcpool->volume);
@@ -9623,29 +9622,27 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
         return NULL;
     }

-    if (!(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
-        if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
-            !STRPREFIX(target, "fd")) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Invalid floppy device name: %s"), target);
-            return NULL;
-        }
+    if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
+        !STRPREFIX(target, "fd")) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Invalid floppy device name: %s"), target);
+        return NULL;
+    }

-        /* Force CDROM to be listed as read only */
-        if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
-            def->src->readonly = true;
+    /* Force CDROM to be listed as read only */
+    if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
+        def->src->readonly = true;

-        if ((def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
-             def->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
-            !STRPREFIX((const char *)target, "hd") &&
-            !STRPREFIX((const char *)target, "sd") &&
-            !STRPREFIX((const char *)target, "vd") &&
-            !STRPREFIX((const char *)target, "xvd") &&
-            !STRPREFIX((const char *)target, "ubd")) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Invalid harddisk device name: %s"), target);
-            return NULL;
-        }
+    if ((def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
+         def->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
+        !STRPREFIX((const char *)target, "hd") &&
+        !STRPREFIX((const char *)target, "sd") &&
+        !STRPREFIX((const char *)target, "vd") &&
+        !STRPREFIX((const char *)target, "xvd") &&
+        !STRPREFIX((const char *)target, "ubd")) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Invalid harddisk device name: %s"), target);
+        return NULL;
     }

     if (snapshot) {
@@ -9686,7 +9683,7 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
     } else {
         if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
             def->bus = VIR_DOMAIN_DISK_BUS_FDC;
-        } else if (!(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
+        } else {
             if (STRPREFIX(target, "hd"))
                 def->bus = VIR_DOMAIN_DISK_BUS_IDE;
             else if (STRPREFIX(target, "sd"))
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 83b9288941..1a2e0fc872 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3353,25 +3353,23 @@ typedef enum {
     VIR_DOMAIN_DEF_PARSE_ALLOW_ROM       = 1 << 4,
     /* internal flag passed to device info sub-parser to allow specifying boot order */
     VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT      = 1 << 5,
-    /* parse only source half of <disk> */
-    VIR_DOMAIN_DEF_PARSE_DISK_SOURCE     = 1 << 6,
     /* perform RNG schema validation on the passed XML document */
-    VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA = 1 << 7,
+    VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA = 1 << 6,
     /* allow updates in post parse callback that would break ABI otherwise */
-    VIR_DOMAIN_DEF_PARSE_ABI_UPDATE = 1 << 8,
+    VIR_DOMAIN_DEF_PARSE_ABI_UPDATE = 1 << 7,
     /* skip definition validation checks meant to be executed on define time only */
-    VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE = 1 << 9,
+    VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE = 1 << 8,
     /* skip parsing of security labels */
-    VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL        = 1 << 10,
+    VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL        = 1 << 9,
     /* Allows updates in post parse callback for incoming persistent migration
      * that would break ABI otherwise.  This should be used only if it's safe
      * to do such change. */
-    VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION = 1 << 11,
+    VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION = 1 << 10,
     /* Allows to ignore certain failures in the post parse callbacks, which
      * may happen due to missing packages and can be fixed by re-running the
      * post parse callbacks before starting. Failure of the post parse callback
      * is recorded as def->postParseFail */
-    VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL = 1 << 12,
+    VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL = 1 << 11,
 } virDomainDefParseFlags;

 typedef enum {
-- 
2.30.2




More information about the libvir-list mailing list