[PATCH 13/25] conf: Move disk target 'ioemu:' stripping to virDomainDiskDefPostParse

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


Modifications of the data such as this one don't belong into the parser.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/domain_conf.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ce0931c160..2803055204 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5367,6 +5367,16 @@ virDomainDiskDefPostParse(virDomainDiskDef *disk,
                           const virDomainDef *def,
                           virDomainXMLOption *xmlopt)
 {
+    if (disk->dst) {
+        char *newdst;
+
+        /* Work around for compat with Xen driver in previous libvirt releases */
+        if ((newdst = g_strdup(STRSKIP(disk->dst, "ioemu:")))) {
+            g_free(disk->dst);
+            disk->dst = newdst;
+        }
+    }
+
     if (disk->src->type == VIR_STORAGE_TYPE_NETWORK &&
         disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI) {
         virDomainPostParseCheckISCSIPath(&disk->src->path);
@@ -9345,12 +9355,6 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
                 return NULL;
             removable = virXMLPropString(cur, "removable");
             rotation_rate = virXMLPropString(cur, "rotation_rate");
-
-            /* HACK: Work around for compat with Xen
-             * driver in previous libvirt releases */
-            if (target &&
-                STRPREFIX(target, "ioemu:"))
-                memmove(target, target+6, strlen(target)-5);
         } else if (!domain_name &&
                    virXMLNodeNameEqual(cur, "backenddomain")) {
             domain_name = virXMLPropString(cur, "name");
-- 
2.30.2




More information about the libvir-list mailing list