From c648505f7646c0b6ef76c586d95b71774adf3389 Mon Sep 17 00:00:00 2001 From: Yecheng Fu Date: Tue, 22 Aug 2017 07:10:01 +0000 Subject: [PATCH] RBD Plugin: Log RBD Attach/Mount/Unmout actions at logging level 3 --- pkg/volume/rbd/disk_manager.go | 1 + pkg/volume/rbd/rbd_util.go | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/volume/rbd/disk_manager.go b/pkg/volume/rbd/disk_manager.go index 482151c075d..d219d62ab1b 100644 --- a/pkg/volume/rbd/disk_manager.go +++ b/pkg/volume/rbd/disk_manager.go @@ -77,6 +77,7 @@ func diskSetUp(manager diskManager, b rbdMounter, volPath string, mounter mount. glog.Errorf("failed to bind mount:%s", globalPDPath) return err } + glog.V(3).Infof("rbd: successfully bind mount %s to %s with options %v", globalPDPath, volPath, mountOptions) if !b.ReadOnly { volume.SetVolumeOwnership(&b, fsGroup) diff --git a/pkg/volume/rbd/rbd_util.go b/pkg/volume/rbd/rbd_util.go index 001054e903a..70aedb4861c 100644 --- a/pkg/volume/rbd/rbd_util.go +++ b/pkg/volume/rbd/rbd_util.go @@ -312,12 +312,14 @@ func (util *RBDUtil) AttachDisk(b rbdMounter) error { if !found { return errors.New("Could not map image: Timeout after 10s") } + glog.V(3).Infof("rbd: successfully map image %s/%s to %s", b.Pool, b.Image, devicePath) } // mount it if err = b.mounter.FormatAndMount(devicePath, globalPDPath, b.fsType, nil); err != nil { err = fmt.Errorf("rbd: failed to mount rbd volume %s [%s] to %s, error %v", devicePath, b.fsType, globalPDPath, err) } + glog.V(3).Infof("rbd: successfully mount image %s/%s at %s", b.Pool, b.Image, globalPDPath) return err } @@ -329,6 +331,7 @@ func (util *RBDUtil) DetachDisk(c rbdUnmounter, mntPath string) error { if err = c.mounter.Unmount(mntPath); err != nil { return fmt.Errorf("rbd detach disk: failed to umount: %s\nError: %v", mntPath, err) } + glog.V(3).Infof("rbd: successfully umount mountpoint %s", mntPath) // if device is no longer used, see if can unmap if cnt <= 1 { // rbd unmap @@ -343,7 +346,7 @@ func (util *RBDUtil) DetachDisk(c rbdUnmounter, mntPath string) error { util.defencing(c) } - glog.Infof("rbd: successfully unmap device %s", device) + glog.V(3).Infof("rbd: successfully unmap device %s", device) } return nil }