Commit fcf183dc authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #46239 from mtanino/issue/45394

Automatic merge from submit-queue Log out from multiple target portals when using iscsi storage plugin **What this PR does / why we need it**: When using iscsi storage with multiple target portal (TP) addresses and multipathing the volume manager logs on to the IQN for all portal addresses, but when a pod gets destroyed the volume manager only logs out for the primary TP and sessions for another TPs are always remained. This patch adds mount points for all TPs, and then log out from all TPs when a pod is destroyed. If a TP is referred from another pods, the connection will be remained as usual. **Which issue this PR fixes** fixes #45394 **Special notes for your reviewer**: **Release note**: ``` NONE ```
parents 3093936a aebaee39
......@@ -136,10 +136,10 @@ func (plugin *iscsiPlugin) newMounterInternal(spec *volume.Spec, podUID types.UI
iscsiDisk: &iscsiDisk{
podUID: podUID,
volName: spec.Name(),
portals: bkportal,
iqn: iscsi.IQN,
Portals: bkportal,
Iqn: iscsi.IQN,
lun: lun,
iface: iface,
Iface: iface,
chap_discovery: iscsi.DiscoveryCHAPAuth,
chap_session: iscsi.SessionCHAPAuth,
secret: secret,
......@@ -191,10 +191,10 @@ func (plugin *iscsiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*v
type iscsiDisk struct {
volName string
podUID types.UID
portals []string
iqn string
Portals []string
Iqn string
lun string
iface string
Iface string
chap_discovery bool
chap_session bool
secret map[string]string
......
......@@ -19,6 +19,7 @@ package iscsi
import (
"os"
"path/filepath"
"reflect"
"testing"
"k8s.io/kubernetes/pkg/util/mount"
......@@ -91,6 +92,15 @@ func TestExtractPortalAndIqn(t *testing.T) {
}
}
func TestRemoveDuplicate(t *testing.T) {
dupPortals := []string{"127.0.0.1:3260", "127.0.0.1:3260", "127.0.0.100:3260"}
portals := removeDuplicate(dupPortals)
want := []string{"127.0.0.1:3260", "127.0.0.100:3260"}
if reflect.DeepEqual(portals, want) == false {
t.Errorf("removeDuplicate: want: %s, got: %s", want, portals)
}
}
func fakeOsStat(devicePath string) (fi os.FileInfo, err error) {
var cmd os.FileInfo
return cmd, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment