mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
storage_iscsi: Reflect the default target port
Make sure default iSCSI target is 3260.
This commit is contained in:
parent
c9150d3747
commit
5c62d5ea07
@ -44,12 +44,12 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_STORAGE
|
#define VIR_FROM_THIS VIR_FROM_STORAGE
|
||||||
|
|
||||||
|
#define ISCSI_DEFAULT_TARGET_PORT 3260
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
|
virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
|
||||||
{
|
{
|
||||||
char *portal = NULL;
|
char *portal = NULL;
|
||||||
const char *host;
|
|
||||||
int port = 3260;
|
|
||||||
|
|
||||||
if (source->nhost != 1) {
|
if (source->nhost != 1) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
@ -57,14 +57,17 @@ virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
host = source->hosts[0].name;
|
if (source->hosts[0].port == 0)
|
||||||
if (source->hosts[0].port != 0)
|
source->hosts[0].port = ISCSI_DEFAULT_TARGET_PORT;
|
||||||
port = source->hosts[0].port;
|
|
||||||
|
|
||||||
if (strchr(host, ':')) {
|
if (strchr(source->hosts[0].name, ':')) {
|
||||||
ignore_value(virAsprintf(&portal, "[%s]:%d,1", host, port));
|
ignore_value(virAsprintf(&portal, "[%s]:%d,1",
|
||||||
|
source->hosts[0].name,
|
||||||
|
source->hosts[0].port));
|
||||||
} else {
|
} else {
|
||||||
ignore_value(virAsprintf(&portal, "%s:%d,1", host, port));
|
ignore_value(virAsprintf(&portal, "%s:%d,1",
|
||||||
|
source->hosts[0].name,
|
||||||
|
source->hosts[0].port));
|
||||||
}
|
}
|
||||||
|
|
||||||
return portal;
|
return portal;
|
||||||
|
Loading…
Reference in New Issue
Block a user