feat(zfspv): move to klog (#166)

Signed-off-by: vaniisgh <vanisingh@live.co.uk>
This commit is contained in:
vaniisgh 2020-06-29 12:18:33 +05:30 committed by GitHub
parent 54f2b0b9fd
commit d0d1664d43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 124 additions and 2991 deletions

View file

@ -20,8 +20,9 @@ import (
"os"
"os/exec"
"github.com/Sirupsen/logrus"
"strings"
"k8s.io/klog"
)
func xfsTempMount(volume string) error {
@ -32,7 +33,7 @@ func xfsTempMount(volume string) error {
tmpdir := "/tmp/" + pvol[1]
err := os.Mkdir(tmpdir, 0755)
if err != nil {
logrus.Errorf("xfs: failed to create tmpdir %s error: %s", tmpdir, err.Error())
klog.Errorf("xfs: failed to create tmpdir %s error: %s", tmpdir, err.Error())
return err
}
@ -40,7 +41,7 @@ func xfsTempMount(volume string) error {
cmd := exec.Command("mount", "-o", "nouuid", device, tmpdir)
out, err := cmd.CombinedOutput()
if err != nil {
logrus.Errorf("xfs: failed to mount volume %s=>%s error: %s", device, tmpdir, string(out))
klog.Errorf("xfs: failed to mount volume %s=>%s error: %s", device, tmpdir, string(out))
return err
}
@ -48,14 +49,14 @@ func xfsTempMount(volume string) error {
cmd = exec.Command("umount", tmpdir)
out, err = cmd.CombinedOutput()
if err != nil {
logrus.Errorf("xfs: failed to umount tmpdir %s error: %s", tmpdir, string(out))
klog.Errorf("xfs: failed to umount tmpdir %s error: %s", tmpdir, string(out))
return err
}
// remove the directory
err = os.Remove(tmpdir)
if err != nil {
logrus.Errorf("xfs: failed to remove tmpdir %s error: %s", tmpdir, err.Error())
klog.Errorf("xfs: failed to remove tmpdir %s error: %s", tmpdir, err.Error())
return err
}
return nil
@ -82,9 +83,9 @@ func xfsGenerateUuid(volume string) error {
cmd := exec.Command("xfs_admin", "-U", "generate", device)
out, err := cmd.CombinedOutput()
if err != nil {
logrus.Errorf("xfs: uuid generate failed %s error: %s", volume, string(out))
klog.Errorf("xfs: uuid generate failed %s error: %s", volume, string(out))
return err
}
logrus.Infof("xfs: generated UUID for the cloned volume %s \n %v", volume, string(out))
klog.Infof("xfs: generated UUID for the cloned volume %s \n %v", volume, string(out))
return nil
}