mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
Add logging to volume tear-down to help understand mount behaviour
This commit is contained in:
parent
9184ccf24d
commit
9839253233
@ -18,6 +18,8 @@ limitations under the License.
|
|||||||
// an alternate platform, we will need to abstract further.
|
// an alternate platform, we will need to abstract further.
|
||||||
package mount
|
package mount
|
||||||
|
|
||||||
|
import "github.com/golang/glog"
|
||||||
|
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
// Mount mounts source to target as fstype with given options.
|
// Mount mounts source to target as fstype with given options.
|
||||||
Mount(source string, target string, fstype string, options []string) error
|
Mount(source string, target string, fstype string, options []string) error
|
||||||
@ -66,11 +68,15 @@ func GetMountRefs(mounter Interface, mountPath string) ([]string, error) {
|
|||||||
|
|
||||||
// Find all references to the device.
|
// Find all references to the device.
|
||||||
var refs []string
|
var refs []string
|
||||||
|
if deviceName == "" {
|
||||||
|
glog.Warningf("could not determine device for path: %s", mountPath)
|
||||||
|
} else {
|
||||||
for i := range mps {
|
for i := range mps {
|
||||||
if mps[i].Device == deviceName && mps[i].Path != mountPath {
|
if mps[i].Device == deviceName && mps[i].Path != mountPath {
|
||||||
refs = append(refs, mps[i].Path)
|
refs = append(refs, mps[i].Path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return refs, nil
|
return refs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,6 +289,9 @@ func (pd *awsElasticBlockStore) TearDownAt(dir string) error {
|
|||||||
glog.V(2).Info("Error getting mountrefs for ", dir, ": ", err)
|
glog.V(2).Info("Error getting mountrefs for ", dir, ": ", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if len(refs) == 0 {
|
||||||
|
glog.Warning("Did not find pod-mount for ", dir, " during tear-down")
|
||||||
|
}
|
||||||
// Unmount the bind-mount inside this pod
|
// Unmount the bind-mount inside this pod
|
||||||
if err := pd.mounter.Unmount(dir); err != nil {
|
if err := pd.mounter.Unmount(dir); err != nil {
|
||||||
glog.V(2).Info("Error unmounting dir ", dir, ": ", err)
|
glog.V(2).Info("Error unmounting dir ", dir, ": ", err)
|
||||||
@ -307,6 +310,8 @@ func (pd *awsElasticBlockStore) TearDownAt(dir string) error {
|
|||||||
glog.V(2).Info("Error detaching disk ", pd.volumeID, ": ", err)
|
glog.V(2).Info("Error detaching disk ", pd.volumeID, ": ", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
glog.V(2).Infof("Found multiple refs; won't detach EBS volume: %v", refs)
|
||||||
}
|
}
|
||||||
mountpoint, mntErr := pd.mounter.IsMountPoint(dir)
|
mountpoint, mntErr := pd.mounter.IsMountPoint(dir)
|
||||||
if mntErr != nil {
|
if mntErr != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user