mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
Merge pull request #15555 from rootfs/iscsi-def-port
Auto commit by PR queue bot
This commit is contained in:
commit
407f9b9e42
@ -18,6 +18,7 @@ package iscsi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
@ -94,16 +95,17 @@ func (plugin *iscsiPlugin) newBuilderInternal(spec *volume.Spec, podUID types.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
lun := strconv.Itoa(iscsi.Lun)
|
lun := strconv.Itoa(iscsi.Lun)
|
||||||
|
portal := portalBuilder(iscsi.TargetPortal)
|
||||||
|
|
||||||
return &iscsiDiskBuilder{
|
return &iscsiDiskBuilder{
|
||||||
iscsiDisk: &iscsiDisk{
|
iscsiDisk: &iscsiDisk{
|
||||||
podUID: podUID,
|
podUID: podUID,
|
||||||
volName: spec.Name(),
|
volName: spec.Name(),
|
||||||
portal: iscsi.TargetPortal,
|
portal: portal,
|
||||||
iqn: iscsi.IQN,
|
iqn: iscsi.IQN,
|
||||||
lun: lun,
|
lun: lun,
|
||||||
manager: manager,
|
manager: manager,
|
||||||
mounter: mounter,
|
mounter: &mount.SafeFormatAndMount{mounter, exec.New()},
|
||||||
plugin: plugin},
|
plugin: plugin},
|
||||||
fsType: iscsi.FSType,
|
fsType: iscsi.FSType,
|
||||||
readOnly: readOnly,
|
readOnly: readOnly,
|
||||||
@ -188,3 +190,10 @@ func (c *iscsiDiskCleaner) TearDown() error {
|
|||||||
func (c *iscsiDiskCleaner) TearDownAt(dir string) error {
|
func (c *iscsiDiskCleaner) TearDownAt(dir string) error {
|
||||||
return diskTearDown(c.manager, *c, dir, c.mounter)
|
return diskTearDown(c.manager, *c, dir, c.mounter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func portalBuilder(portal string) string {
|
||||||
|
if !strings.Contains(portal, ":") {
|
||||||
|
portal = portal + ":3260"
|
||||||
|
}
|
||||||
|
return portal
|
||||||
|
}
|
||||||
|
@ -250,3 +250,12 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
t.Errorf("Expected true for builder.IsReadOnly")
|
t.Errorf("Expected true for builder.IsReadOnly")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPortalBuilder(t *testing.T) {
|
||||||
|
if portal := portalBuilder("127.0.0.1"); portal != "127.0.0.1:3260" {
|
||||||
|
t.Errorf("wrong portal: %s", portal)
|
||||||
|
}
|
||||||
|
if portal := portalBuilder("127.0.0.1:3260"); portal != "127.0.0.1:3260" {
|
||||||
|
t.Errorf("wrong portal: %s", portal)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user