[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/6] storage_iscsi: Reflect the default target port



The default port for iSCSI target is 3260, which should be reflected
to the pool's def.
---
 src/storage/storage_backend_iscsi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index 0a4cd22..eb8e128 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -44,12 +44,14 @@
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
+#define ISCSI_DEFAULT_TARGET_PORT 3260
+
 static char *
 virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
 {
     char *portal = NULL;
     const char *host;
-    int port = 3260;
+    int port;
 
     if (source->nhost != 1) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -60,6 +62,8 @@ virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
     host = source->hosts[0].name;
     if (source->hosts[0].port != 0)
         port = source->hosts[0].port;
+    else
+        port = source->hosts[0].port = ISCSI_DEFAULT_TARGET_PORT;
 
     if (strchr(host, ':')) {
         if (virAsprintf(&portal, "[%s]:%d,1", host, port) < 0)
-- 
1.8.1.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]