render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
a41c76
From 80b9f2b4c38eb0cb96e7ebb5d8b2c8ddaa5f7927 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <80b9f2b4c38eb0cb96e7ebb5d8b2c8ddaa5f7927@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Wed, 19 Feb 2020 15:09:57 +0100
a41c76
Subject: [PATCH] virDomainDiskAddISCSIPoolSourceHost: Take virStorageSourcePtr
a41c76
 instead of virDomainDiskDefPtr
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Only 'def->src' was ever used in this function. Use the source directly.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 47cad725536b9108f23f351fe9836d0469a70fc7)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1804603
a41c76
Message-Id: <7079c5546d76a24c458729e54f408bec39877a3e.1582120424.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/conf/domain_conf.c | 28 ++++++++++++++--------------
a41c76
 1 file changed, 14 insertions(+), 14 deletions(-)
a41c76
a41c76
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
a41c76
index 89f1e44536..9cbc7b47e7 100644
a41c76
--- a/src/conf/domain_conf.c
a41c76
+++ b/src/conf/domain_conf.c
a41c76
@@ -31170,7 +31170,7 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface)
a41c76
 
a41c76
 
a41c76
 static int
a41c76
-virDomainDiskAddISCSIPoolSourceHost(virDomainDiskDefPtr def,
a41c76
+virDomainDiskAddISCSIPoolSourceHost(virStorageSourcePtr src,
a41c76
                                     virStoragePoolDefPtr pooldef)
a41c76
 {
a41c76
     VIR_AUTOSTRINGLIST tokens = NULL;
a41c76
@@ -31184,38 +31184,38 @@ virDomainDiskAddISCSIPoolSourceHost(virDomainDiskDefPtr def,
a41c76
     }
a41c76
 
a41c76
     /* iscsi pool only supports one host */
a41c76
-    def->src->nhosts = 1;
a41c76
-    def->src->hosts = g_new0(virStorageNetHostDef, 1);
a41c76
+    src->nhosts = 1;
a41c76
+    src->hosts = g_new0(virStorageNetHostDef, 1);
a41c76
 
a41c76
-    def->src->hosts[0].name = g_strdup(pooldef->source.hosts[0].name);
a41c76
+    src->hosts[0].name = g_strdup(pooldef->source.hosts[0].name);
a41c76
 
a41c76
     if (pooldef->source.hosts[0].port != 0)
a41c76
-        def->src->hosts[0].port = pooldef->source.hosts[0].port;
a41c76
+        src->hosts[0].port = pooldef->source.hosts[0].port;
a41c76
     else
a41c76
-        def->src->hosts[0].port = 3260;
a41c76
+        src->hosts[0].port = 3260;
a41c76
 
a41c76
     /* iscsi volume has name like "unit:0:0:1" */
a41c76
-    if (!(tokens = virStringSplitCount(def->src->srcpool->volume, ":", 0, &ntokens)))
a41c76
+    if (!(tokens = virStringSplitCount(src->srcpool->volume, ":", 0, &ntokens)))
a41c76
         return -1;
a41c76
 
a41c76
     if (ntokens != 4) {
a41c76
         virReportError(VIR_ERR_INTERNAL_ERROR,
a41c76
                        _("unexpected iscsi volume name '%s'"),
a41c76
-                       def->src->srcpool->volume);
a41c76
+                       src->srcpool->volume);
a41c76
         return -1;
a41c76
     }
a41c76
 
a41c76
     /* iscsi pool has only one source device path */
a41c76
-    def->src->path = g_strdup_printf("%s/%s", pooldef->source.devices[0].path,
a41c76
-                                     tokens[3]);
a41c76
+    src->path = g_strdup_printf("%s/%s", pooldef->source.devices[0].path,
a41c76
+                                tokens[3]);
a41c76
 
a41c76
     /* Storage pool have not supported these 2 attributes yet,
a41c76
      * use the defaults.
a41c76
      */
a41c76
-    def->src->hosts[0].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
a41c76
-    def->src->hosts[0].socket = NULL;
a41c76
+    src->hosts[0].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
a41c76
+    src->hosts[0].socket = NULL;
a41c76
 
a41c76
-    def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
a41c76
+    src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
a41c76
 
a41c76
     return 0;
a41c76
 }
a41c76
@@ -31258,7 +31258,7 @@ virDomainDiskTranslateISCSIDirect(virDomainDiskDefPtr def,
a41c76
         def->src->auth->secrettype = g_strdup(secrettype);
a41c76
     }
a41c76
 
a41c76
-    if (virDomainDiskAddISCSIPoolSourceHost(def, pooldef) < 0)
a41c76
+    if (virDomainDiskAddISCSIPoolSourceHost(def->src, pooldef) < 0)
a41c76
         return -1;
a41c76
 
a41c76
     if (!def->src->initiator.iqn && pooldef->source.initiator.iqn &&
a41c76
-- 
a41c76
2.25.0
a41c76