mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-26 16:20:28 +00:00
cephfs/util: log execCommandJson; cache mount.New() instance
This commit is contained in:
parent
12958d0a9a
commit
9c3389d784
@ -54,8 +54,7 @@ func execCommandAndValidate(program string, args ...string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func execCommandJson(v interface{}, program string, args ...string) error {
|
func execCommandJson(v interface{}, program string, args ...string) error {
|
||||||
cmd := exec.Command(program, args...)
|
out, err := execCommand(program, args...)
|
||||||
out, err := cmd.CombinedOutput()
|
|
||||||
|
|
||||||
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)
|
||||||
@ -64,8 +63,11 @@ func execCommandJson(v interface{}, program string, args ...string) error {
|
|||||||
return json.NewDecoder(bytes.NewReader(out)).Decode(v)
|
return json.NewDecoder(bytes.NewReader(out)).Decode(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used in isMountPoint()
|
||||||
|
var dummyMount = mount.New("")
|
||||||
|
|
||||||
func isMountPoint(p string) (bool, error) {
|
func isMountPoint(p string) (bool, error) {
|
||||||
notMnt, err := mount.New("").IsLikelyNotMountPoint(p)
|
notMnt, err := dummyMount.IsLikelyNotMountPoint(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, status.Error(codes.Internal, err.Error())
|
return false, status.Error(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user