Blob Blame History Raw
From 452599b446bb9725e1b3b95d7733353b0d76c12f Mon Sep 17 00:00:00 2001
Message-Id: <452599b446bb9725e1b3b95d7733353b0d76c12f@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 19 Feb 2020 15:09:59 +0100
Subject: [PATCH] virDomainDiskTranslateISCSIDirect: Take virStorageSourcePtr
 instead of virDomainDiskDefPtr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Only 'def->src' was ever used in this function. Use the source directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit bc42d88ffdef84a823092bfb35cd6bce39747366)

https://bugzilla.redhat.com/show_bug.cgi?id=1804603
Message-Id: <6a9c4a227bb1ea5564bfb03d076b080d879239b4.1582120424.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/conf/domain_conf.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 14b675d5d6..68dd640dc5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31239,30 +31239,30 @@ virDomainDiskTranslateSourcePoolAuth(virStorageSourcePtr src,
 
 
 static int
-virDomainDiskTranslateISCSIDirect(virDomainDiskDefPtr def,
+virDomainDiskTranslateISCSIDirect(virStorageSourcePtr src,
                                   virStoragePoolDefPtr pooldef)
 {
-    def->src->srcpool->actualtype = VIR_STORAGE_TYPE_NETWORK;
-    def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
+    src->srcpool->actualtype = VIR_STORAGE_TYPE_NETWORK;
+    src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
 
-    if (virDomainDiskTranslateSourcePoolAuth(def->src,
+    if (virDomainDiskTranslateSourcePoolAuth(src,
                                              &pooldef->source) < 0)
         return -1;
 
     /* Source pool may not fill in the secrettype field,
      * so we need to do so here
      */
-    if (def->src->auth && !def->src->auth->secrettype) {
+    if (src->auth && !src->auth->secrettype) {
         const char *secrettype =
             virSecretUsageTypeToString(VIR_SECRET_USAGE_TYPE_ISCSI);
-        def->src->auth->secrettype = g_strdup(secrettype);
+        src->auth->secrettype = g_strdup(secrettype);
     }
 
-    if (virDomainDiskAddISCSIPoolSourceHost(def->src, pooldef) < 0)
+    if (virDomainDiskAddISCSIPoolSourceHost(src, pooldef) < 0)
         return -1;
 
-    if (!def->src->initiator.iqn && pooldef->source.initiator.iqn &&
-        virStorageSourceInitiatorCopy(&def->src->initiator,
+    if (!src->initiator.iqn && pooldef->source.initiator.iqn &&
+        virStorageSourceInitiatorCopy(&src->initiator,
                                       &pooldef->source.initiator) < 0) {
         return -1;
     }
@@ -31387,7 +31387,7 @@ virDomainDiskTranslateSourcePool(virDomainDiskDefPtr def)
             return -1;
         }
 
-        if (virDomainDiskTranslateISCSIDirect(def, pooldef) < 0)
+        if (virDomainDiskTranslateISCSIDirect(def->src, pooldef) < 0)
             return -1;
 
         break;
@@ -31412,7 +31412,7 @@ virDomainDiskTranslateSourcePool(virDomainDiskDefPtr def)
            break;
 
        case VIR_STORAGE_SOURCE_POOL_MODE_DIRECT:
-           if (virDomainDiskTranslateISCSIDirect(def, pooldef) < 0)
+           if (virDomainDiskTranslateISCSIDirect(def->src, pooldef) < 0)
                return -1;
            break;
        }
-- 
2.25.0