Logging command and options for debug friendly

Some commands were executed in ceph-csi, but users do not know what
commands with what options were executed. Hence, it is difficult to
debug once the command did not work fine.

This patch adds logging what commmand and options are executed.
This commit is contained in:
Kenjiro Nakayama 2018-07-31 15:31:11 +09:00
parent 6f484f92fc
commit e8784ec094

View File

@ -22,6 +22,7 @@ import (
"fmt" "fmt"
"os/exec" "os/exec"
"github.com/golang/glog"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
@ -35,6 +36,7 @@ func execCommand(command string, args ...string) ([]byte, error) {
} }
func execCommandAndValidate(program string, args ...string) error { func execCommandAndValidate(program string, args ...string) error {
glog.V(4).Infof("cephfs: executing command: %s with args: %s", program, args)
out, err := execCommand(program, args...) out, err := execCommand(program, args...)
if err != nil { if err != nil {
return fmt.Errorf("cephfs: %s failed with following error: %s\ncephfs: %s output: %s", program, err, program, out) return fmt.Errorf("cephfs: %s failed with following error: %s\ncephfs: %s output: %s", program, err, program, out)
@ -122,6 +124,8 @@ func newMounter(volOptions *volumeOptions) volumeMounter {
mounter = DefaultVolumeMounter mounter = DefaultVolumeMounter
} }
glog.V(4).Infof("cephfs: setting volume mounter to: %s", mounter)
switch mounter { switch mounter {
case volumeMounter_fuse: case volumeMounter_fuse:
return &fuseMounter{} return &fuseMounter{}