render / rpms / libvirt

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