From 365fbd1ca021c477a0cc1c9fe6edb284347c0de0 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 10 Jan 2020 16:14:48 +0100 Subject: [PATCH] util: remove unused GetImageMeta() and SetImageMeta() Signed-off-by: Niels de Vos --- internal/util/cephcmds.go | 45 --------------------------------------- 1 file changed, 45 deletions(-) diff --git a/internal/util/cephcmds.go b/internal/util/cephcmds.go index bc5694178..45d67abd5 100644 --- a/internal/util/cephcmds.go +++ b/internal/util/cephcmds.go @@ -275,48 +275,3 @@ func RemoveObject(ctx context.Context, monitors string, cr *Credentials, poolNam return nil } - -// SetImageMeta sets image metadata -func SetImageMeta(ctx context.Context, cr *Credentials, monitors, imageSpec, key, value string) error { - args := []string{ - "-m", monitors, - "--id", cr.ID, - "--keyfile=" + cr.KeyFile, - "-c", CephConfigPath, - "image-meta", "set", imageSpec, - key, value, - } - - _, _, err := ExecCommand("rbd", args[:]...) - if err != nil { - klog.Errorf(Log(ctx, "failed setting image metadata (%s) for (%s): (%v)"), key, imageSpec, err) - return err - } - - return nil -} - -// GetImageMeta gets image metadata -func GetImageMeta(ctx context.Context, cr *Credentials, monitors, imageSpec, key string) (string, error) { - args := []string{ - "-m", monitors, - "--id", cr.ID, - "--keyfile=" + cr.KeyFile, - "-c", CephConfigPath, - "image-meta", "get", imageSpec, - key, - } - - stdout, stderr, err := ExecCommand("rbd", args[:]...) - if err != nil { - stdoutanderr := strings.Join([]string{string(stdout), string(stderr)}, " ") - if strings.Contains(stdoutanderr, "failed to get metadata "+key+" of image : (2) No such file or directory") { - return "", ErrKeyNotFound{imageSpec + " " + key, err} - } - - klog.Errorf(Log(ctx, "failed getting image metadata (%s) for (%s): (%v)"), key, imageSpec, err) - return "", err - } - - return string(stdout), nil -}