render / rpms / libvirt

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