mirror of https://github.com/k3s-io/k3s
Fixed panic in iSCSI.UnmountDevice
Fill iscsiDetacher.plugin so iscsiDetacher.plugin.targetLocks.LockKey(iqn) does not panic.pull/58/head
parent
3fe21e5433
commit
ffaff4e976
|
@ -137,6 +137,7 @@ type iscsiDetacher struct {
|
|||
host volume.VolumeHost
|
||||
mounter mount.Interface
|
||||
manager diskManager
|
||||
plugin *iscsiPlugin
|
||||
}
|
||||
|
||||
var _ volume.Detacher = &iscsiDetacher{}
|
||||
|
@ -148,6 +149,7 @@ func (plugin *iscsiPlugin) NewDetacher() (volume.Detacher, error) {
|
|||
host: plugin.host,
|
||||
mounter: plugin.host.GetMounter(iscsiPluginName),
|
||||
manager: &ISCSIUtil{},
|
||||
plugin: plugin,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -160,7 +162,7 @@ func (detacher *iscsiDetacher) Detach(volumeName string, nodeName types.NodeName
|
|||
}
|
||||
|
||||
func (detacher *iscsiDetacher) UnmountDevice(deviceMountPath string) error {
|
||||
unMounter := volumeSpecToUnmounter(detacher.mounter, detacher.host)
|
||||
unMounter := volumeSpecToUnmounter(detacher.mounter, detacher.host, detacher.plugin)
|
||||
err := detacher.manager.DetachDisk(*unMounter, deviceMountPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("iscsi: failed to detach disk: %s\nError: %v", deviceMountPath, err)
|
||||
|
@ -225,11 +227,11 @@ func volumeSpecToMounter(spec *volume.Spec, host volume.VolumeHost, targetLocks
|
|||
}, nil
|
||||
}
|
||||
|
||||
func volumeSpecToUnmounter(mounter mount.Interface, host volume.VolumeHost) *iscsiDiskUnmounter {
|
||||
func volumeSpecToUnmounter(mounter mount.Interface, host volume.VolumeHost, plugin *iscsiPlugin) *iscsiDiskUnmounter {
|
||||
exec := host.GetExec(iscsiPluginName)
|
||||
return &iscsiDiskUnmounter{
|
||||
iscsiDisk: &iscsiDisk{
|
||||
plugin: &iscsiPlugin{},
|
||||
plugin: plugin,
|
||||
},
|
||||
mounter: mounter,
|
||||
exec: exec,
|
||||
|
|
Loading…
Reference in New Issue