mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-16 23:29:21 +00:00
Fix windows MountSensitive error
This commit is contained in:
parent
3f4217bc69
commit
d37a1749ed
@ -79,14 +79,15 @@ func (mounter *Mounter) MountSensitive(source string, target string, fstype stri
|
|||||||
sanitizedOptionsForLogging, source, target, fstype)
|
sanitizedOptionsForLogging, source, target, fstype)
|
||||||
bindSource := source
|
bindSource := source
|
||||||
|
|
||||||
// tell it's going to mount azure disk or azure file according to options
|
|
||||||
if bind, _, _, _ := MakeBindOptsSensitive(options, sensitiveOptions); bind {
|
if bind, _, _, _ := MakeBindOptsSensitive(options, sensitiveOptions); bind {
|
||||||
// mount azure disk
|
|
||||||
bindSource = NormalizeWindowsPath(source)
|
bindSource = NormalizeWindowsPath(source)
|
||||||
} else {
|
} else {
|
||||||
if len(options) < 2 {
|
allOptions := []string{}
|
||||||
|
allOptions = append(allOptions, options...)
|
||||||
|
allOptions = append(allOptions, sensitiveOptions...)
|
||||||
|
if len(allOptions) < 2 {
|
||||||
klog.Warningf("mount options(%q) command number(%d) less than 2, source:%q, target:%q, skip mounting",
|
klog.Warningf("mount options(%q) command number(%d) less than 2, source:%q, target:%q, skip mounting",
|
||||||
sanitizedOptionsForLogging, len(options), source, target)
|
sanitizedOptionsForLogging, len(allOptions), source, target)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,13 +100,13 @@ func (mounter *Mounter) MountSensitive(source string, target string, fstype stri
|
|||||||
getSMBMountMutex.LockKey(source)
|
getSMBMountMutex.LockKey(source)
|
||||||
defer getSMBMountMutex.UnlockKey(source)
|
defer getSMBMountMutex.UnlockKey(source)
|
||||||
|
|
||||||
if output, err := newSMBMapping(options[0], options[1], source); err != nil {
|
if output, err := newSMBMapping(allOptions[0], allOptions[1], source); err != nil {
|
||||||
if isSMBMappingExist(source) {
|
if isSMBMappingExist(source) {
|
||||||
klog.V(2).Infof("SMB Mapping(%s) already exists, now begin to remove and remount", source)
|
klog.V(2).Infof("SMB Mapping(%s) already exists, now begin to remove and remount", source)
|
||||||
if output, err := removeSMBMapping(source); err != nil {
|
if output, err := removeSMBMapping(source); err != nil {
|
||||||
return fmt.Errorf("Remove-SmbGlobalMapping failed: %v, output: %q", err, output)
|
return fmt.Errorf("Remove-SmbGlobalMapping failed: %v, output: %q", err, output)
|
||||||
}
|
}
|
||||||
if output, err := newSMBMapping(options[0], options[1], source); err != nil {
|
if output, err := newSMBMapping(allOptions[0], allOptions[1], source); err != nil {
|
||||||
return fmt.Errorf("New-SmbGlobalMapping remount failed: %v, output: %q", err, output)
|
return fmt.Errorf("New-SmbGlobalMapping remount failed: %v, output: %q", err, output)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user