render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 80b9f2b4c38eb0cb96e7ebb5d8b2c8ddaa5f7927 Mon Sep 17 00:00:00 2001
Message-Id: <80b9f2b4c38eb0cb96e7ebb5d8b2c8ddaa5f7927@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 19 Feb 2020 15:09:57 +0100
Subject: [PATCH] virDomainDiskAddISCSIPoolSourceHost: 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 47cad725536b9108f23f351fe9836d0469a70fc7)

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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 89f1e44536..9cbc7b47e7 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31170,7 +31170,7 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface)
 
 
 static int
-virDomainDiskAddISCSIPoolSourceHost(virDomainDiskDefPtr def,
+virDomainDiskAddISCSIPoolSourceHost(virStorageSourcePtr src,
                                     virStoragePoolDefPtr pooldef)
 {
     VIR_AUTOSTRINGLIST tokens = NULL;
@@ -31184,38 +31184,38 @@ virDomainDiskAddISCSIPoolSourceHost(virDomainDiskDefPtr def,
     }
 
     /* iscsi pool only supports one host */
-    def->src->nhosts = 1;
-    def->src->hosts = g_new0(virStorageNetHostDef, 1);
+    src->nhosts = 1;
+    src->hosts = g_new0(virStorageNetHostDef, 1);
 
-    def->src->hosts[0].name = g_strdup(pooldef->source.hosts[0].name);
+    src->hosts[0].name = g_strdup(pooldef->source.hosts[0].name);
 
     if (pooldef->source.hosts[0].port != 0)
-        def->src->hosts[0].port = pooldef->source.hosts[0].port;
+        src->hosts[0].port = pooldef->source.hosts[0].port;
     else
-        def->src->hosts[0].port = 3260;
+        src->hosts[0].port = 3260;
 
     /* iscsi volume has name like "unit:0:0:1" */
-    if (!(tokens = virStringSplitCount(def->src->srcpool->volume, ":", 0, &ntokens)))
+    if (!(tokens = virStringSplitCount(src->srcpool->volume, ":", 0, &ntokens)))
         return -1;
 
     if (ntokens != 4) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("unexpected iscsi volume name '%s'"),
-                       def->src->srcpool->volume);
+                       src->srcpool->volume);
         return -1;
     }
 
     /* iscsi pool has only one source device path */
-    def->src->path = g_strdup_printf("%s/%s", pooldef->source.devices[0].path,
-                                     tokens[3]);
+    src->path = g_strdup_printf("%s/%s", pooldef->source.devices[0].path,
+                                tokens[3]);
 
     /* Storage pool have not supported these 2 attributes yet,
      * use the defaults.
      */
-    def->src->hosts[0].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
-    def->src->hosts[0].socket = NULL;
+    src->hosts[0].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
+    src->hosts[0].socket = NULL;
 
-    def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
+    src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
 
     return 0;
 }
@@ -31258,7 +31258,7 @@ virDomainDiskTranslateISCSIDirect(virDomainDiskDefPtr def,
         def->src->auth->secrettype = g_strdup(secrettype);
     }
 
-    if (virDomainDiskAddISCSIPoolSourceHost(def, pooldef) < 0)
+    if (virDomainDiskAddISCSIPoolSourceHost(def->src, pooldef) < 0)
         return -1;
 
     if (!def->src->initiator.iqn && pooldef->source.initiator.iqn &&
-- 
2.25.0