mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rename Id to ID to fix lint issue
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
This commit is contained in:
@ -133,7 +133,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
volSizeGB := int(volSizeBytes / 1024 / 1024 / 1024)
|
||||
|
||||
// Check if there is already RBD image with requested name
|
||||
found, _, _ := rbdStatus(rbdVol, rbdVol.UserId, req.GetSecrets())
|
||||
found, _, _ := rbdStatus(rbdVol, rbdVol.UserID, req.GetSecrets())
|
||||
if !found {
|
||||
// if VolumeContentSource is not nil, this request is for snapshot
|
||||
if req.VolumeContentSource != nil {
|
||||
@ -141,7 +141,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
err := createRBDImage(rbdVol, volSizeGB, rbdVol.AdminId, req.GetSecrets())
|
||||
err := createRBDImage(rbdVol, volSizeGB, rbdVol.AdminID, req.GetSecrets())
|
||||
if err != nil {
|
||||
glog.Warningf("failed to create volume: %v", err)
|
||||
return nil, err
|
||||
@ -152,7 +152,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
}
|
||||
if err := cs.MetadataStore.Create(volumeID, rbdVol); err != nil {
|
||||
glog.Warningf("failed to store volume metadata with error: %v", err)
|
||||
if err := deleteRBDImage(rbdVol, rbdVol.AdminId, req.GetSecrets()); err != nil {
|
||||
if err := deleteRBDImage(rbdVol, rbdVol.AdminID, req.GetSecrets()); err != nil {
|
||||
glog.V(3).Infof("failed to delete rbd image: %s/%s with error: %v", rbdVol.Pool, rbdVol.VolName, err)
|
||||
return nil, err
|
||||
}
|
||||
@ -185,7 +185,7 @@ func (cs *controllerServer) checkSnapshot(req *csi.CreateVolumeRequest, rbdVol *
|
||||
return err
|
||||
}
|
||||
|
||||
err := restoreSnapshot(rbdVol, rbdSnap, rbdVol.AdminId, req.GetSecrets())
|
||||
err := restoreSnapshot(rbdVol, rbdSnap, rbdVol.AdminID, req.GetSecrets())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -212,7 +212,7 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
||||
volName := rbdVol.VolName
|
||||
// Deleting rbd image
|
||||
glog.V(4).Infof("deleting volume %s", volName)
|
||||
if err := deleteRBDImage(rbdVol, rbdVol.AdminId, req.GetSecrets()); err != nil {
|
||||
if err := deleteRBDImage(rbdVol, rbdVol.AdminID, req.GetSecrets()); err != nil {
|
||||
// TODO: can we detect "already deleted" situations here and proceed?
|
||||
glog.V(3).Infof("failed to delete rbd image: %s/%s with error: %v", rbdVol.Pool, volName, err)
|
||||
return nil, err
|
||||
@ -306,7 +306,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
||||
rbdSnap.SourceVolumeID = req.GetSourceVolumeId()
|
||||
rbdSnap.SizeBytes = rbdVolume.VolSize
|
||||
|
||||
err = createSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets())
|
||||
err = createSnapshot(rbdSnap, rbdSnap.AdminID, req.GetSecrets())
|
||||
// if we already have the snapshot, return the snapshot
|
||||
if err != nil {
|
||||
if exitErr, ok := err.(*exec.ExitError); ok {
|
||||
@ -327,10 +327,10 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
||||
}
|
||||
} else {
|
||||
glog.V(4).Infof("create snapshot %s", snapName)
|
||||
err = protectSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets())
|
||||
err = protectSnapshot(rbdSnap, rbdSnap.AdminID, req.GetSecrets())
|
||||
|
||||
if err != nil {
|
||||
err = deleteSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets())
|
||||
err = deleteSnapshot(rbdSnap, rbdSnap.AdminID, req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("snapshot is created but failed to protect and delete snapshot: %v", err)
|
||||
}
|
||||
@ -343,13 +343,13 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
||||
if err := cs.MetadataStore.Create(snapshotID, rbdSnap); err != nil {
|
||||
glog.Warningf("rbd: failed to store snapInfo with error: %v", err)
|
||||
// Unprotect snapshot
|
||||
err := unprotectSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets())
|
||||
err := unprotectSnapshot(rbdSnap, rbdSnap.AdminID, req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Unknown, "This Snapshot should be removed but failed to unprotect snapshot: %s/%s with error: %v", rbdSnap.Pool, rbdSnap.SnapName, err)
|
||||
}
|
||||
// Deleting snapshot
|
||||
glog.V(4).Infof("deleting Snaphot %s", rbdSnap.SnapName)
|
||||
if err := deleteSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets()); err != nil {
|
||||
if err := deleteSnapshot(rbdSnap, rbdSnap.AdminID, req.GetSecrets()); err != nil {
|
||||
return nil, status.Errorf(codes.Unknown, "This Snapshot should be removed but failed to delete snapshot: %s/%s with error: %v", rbdSnap.Pool, rbdSnap.SnapName, err)
|
||||
}
|
||||
return nil, err
|
||||
@ -388,14 +388,14 @@ func (cs *controllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS
|
||||
}
|
||||
|
||||
// Unprotect snapshot
|
||||
err := unprotectSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets())
|
||||
err := unprotectSnapshot(rbdSnap, rbdSnap.AdminID, req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.FailedPrecondition, "failed to unprotect snapshot: %s/%s with error: %v", rbdSnap.Pool, rbdSnap.SnapName, err)
|
||||
}
|
||||
|
||||
// Deleting snapshot
|
||||
glog.V(4).Infof("deleting Snaphot %s", rbdSnap.SnapName)
|
||||
if err := deleteSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets()); err != nil {
|
||||
if err := deleteSnapshot(rbdSnap, rbdSnap.AdminID, req.GetSecrets()); err != nil {
|
||||
return nil, status.Errorf(codes.FailedPrecondition, "failed to delete snapshot: %s/%s with error: %v", rbdSnap.Pool, rbdSnap.SnapName, err)
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
||||
}
|
||||
volOptions.VolName = volName
|
||||
// Mapping RBD image
|
||||
devicePath, err := attachRBDImage(volOptions, volOptions.UserId, req.GetSecrets())
|
||||
devicePath, err := attachRBDImage(volOptions, volOptions.UserID, req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ import (
|
||||
// PluginFolder defines the location of rbdplugin
|
||||
const (
|
||||
PluginFolder = "/var/lib/kubelet/plugins/csi-rbdplugin"
|
||||
rbdDefaultAdminId = "admin"
|
||||
rbdDefaultUserId = rbdDefaultAdminId
|
||||
rbdDefaultAdminID = "admin"
|
||||
rbdDefaultUserID = rbdDefaultAdminID
|
||||
)
|
||||
|
||||
type rbd struct {
|
||||
|
@ -48,8 +48,8 @@ type rbdVolume struct {
|
||||
ImageFormat string `json:"imageFormat"`
|
||||
ImageFeatures string `json:"imageFeatures"`
|
||||
VolSize int64 `json:"volSize"`
|
||||
AdminId string `json:"adminId"`
|
||||
UserId string `json:"userId"`
|
||||
AdminID string `json:"adminId"`
|
||||
UserID string `json:"userId"`
|
||||
Mounter string `json:"mounter"`
|
||||
}
|
||||
|
||||
@ -63,8 +63,8 @@ type rbdSnapshot struct {
|
||||
Pool string `json:"pool"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
SizeBytes int64 `json:"sizeBytes"`
|
||||
AdminId string `json:"adminId"`
|
||||
UserId string `json:"userId"`
|
||||
AdminID string `json:"adminId"`
|
||||
UserID string `json:"userId"`
|
||||
}
|
||||
|
||||
var (
|
||||
@ -111,7 +111,7 @@ func getMon(pOpts *rbdVolume, credentials map[string]string) (string, error) {
|
||||
}
|
||||
|
||||
// CreateImage creates a new ceph image with provision and volume options.
|
||||
func createRBDImage(pOpts *rbdVolume, volSz int, adminId string, credentials map[string]string) error {
|
||||
func createRBDImage(pOpts *rbdVolume, volSz int, adminID string, credentials map[string]string) error {
|
||||
var output []byte
|
||||
|
||||
mon, err := getMon(pOpts, credentials)
|
||||
@ -122,16 +122,16 @@ func createRBDImage(pOpts *rbdVolume, volSz int, adminId string, credentials map
|
||||
image := pOpts.VolName
|
||||
volSzGB := fmt.Sprintf("%dG", volSz)
|
||||
|
||||
key, err := getRBDKey(adminId, credentials)
|
||||
key, err := getRBDKey(adminID, credentials)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if pOpts.ImageFormat == rbdImageFormat2 {
|
||||
glog.V(4).Infof("rbd: create %s size %s format %s (features: %s) using mon %s, pool %s id %s key %s", image, volSzGB, pOpts.ImageFormat, pOpts.ImageFeatures, mon, pOpts.Pool, adminId, key)
|
||||
glog.V(4).Infof("rbd: create %s size %s format %s (features: %s) using mon %s, pool %s id %s key %s", image, volSzGB, pOpts.ImageFormat, pOpts.ImageFeatures, mon, pOpts.Pool, adminID, key)
|
||||
} else {
|
||||
glog.V(4).Infof("rbd: create %s size %s format %s using mon %s, pool %s id %s key %s", image, volSzGB, pOpts.ImageFormat, mon, pOpts.Pool, adminId, key)
|
||||
glog.V(4).Infof("rbd: create %s size %s format %s using mon %s, pool %s id %s key %s", image, volSzGB, pOpts.ImageFormat, mon, pOpts.Pool, adminID, key)
|
||||
}
|
||||
args := []string{"create", image, "--size", volSzGB, "--pool", pOpts.Pool, "--id", adminId, "-m", mon, "--key=" + key, "--image-format", pOpts.ImageFormat}
|
||||
args := []string{"create", image, "--size", volSzGB, "--pool", pOpts.Pool, "--id", adminID, "-m", mon, "--key=" + key, "--image-format", pOpts.ImageFormat}
|
||||
if pOpts.ImageFormat == rbdImageFormat2 {
|
||||
args = append(args, "--image-feature", pOpts.ImageFeatures)
|
||||
}
|
||||
@ -146,14 +146,14 @@ func createRBDImage(pOpts *rbdVolume, volSz int, adminId string, credentials map
|
||||
|
||||
// rbdStatus checks if there is watcher on the image.
|
||||
// It returns true if there is a watcher onthe image, otherwise returns false.
|
||||
func rbdStatus(pOpts *rbdVolume, userId string, credentials map[string]string) (bool, string, error) {
|
||||
func rbdStatus(pOpts *rbdVolume, userID string, credentials map[string]string) (bool, string, error) {
|
||||
var output string
|
||||
var cmd []byte
|
||||
|
||||
image := pOpts.VolName
|
||||
// If we don't have admin id/secret (e.g. attaching), fallback to user id/secret.
|
||||
|
||||
key, err := getRBDKey(userId, credentials)
|
||||
key, err := getRBDKey(userID, credentials)
|
||||
if err != nil {
|
||||
return false, "", err
|
||||
}
|
||||
@ -163,8 +163,8 @@ func rbdStatus(pOpts *rbdVolume, userId string, credentials map[string]string) (
|
||||
return false, "", err
|
||||
}
|
||||
|
||||
glog.V(4).Infof("rbd: status %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, userId, key)
|
||||
args := []string{"status", image, "--pool", pOpts.Pool, "-m", mon, "--id", userId, "--key=" + key}
|
||||
glog.V(4).Infof("rbd: status %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, userID, key)
|
||||
args := []string{"status", image, "--pool", pOpts.Pool, "-m", mon, "--id", userID, "--key=" + key}
|
||||
cmd, err = execCommand("rbd", args)
|
||||
output = string(cmd)
|
||||
|
||||
@ -190,10 +190,10 @@ func rbdStatus(pOpts *rbdVolume, userId string, credentials map[string]string) (
|
||||
}
|
||||
|
||||
// DeleteImage deletes a ceph image with provision and volume options.
|
||||
func deleteRBDImage(pOpts *rbdVolume, adminId string, credentials map[string]string) error {
|
||||
func deleteRBDImage(pOpts *rbdVolume, adminID string, credentials map[string]string) error {
|
||||
var output []byte
|
||||
image := pOpts.VolName
|
||||
found, _, err := rbdStatus(pOpts, adminId, credentials)
|
||||
found, _, err := rbdStatus(pOpts, adminID, credentials)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -201,7 +201,7 @@ func deleteRBDImage(pOpts *rbdVolume, adminId string, credentials map[string]str
|
||||
glog.Info("rbd is still being used ", image)
|
||||
return fmt.Errorf("rbd %s is still being used", image)
|
||||
}
|
||||
key, err := getRBDKey(adminId, credentials)
|
||||
key, err := getRBDKey(adminID, credentials)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -210,8 +210,8 @@ func deleteRBDImage(pOpts *rbdVolume, adminId string, credentials map[string]str
|
||||
return err
|
||||
}
|
||||
|
||||
glog.V(4).Infof("rbd: rm %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, adminId, key)
|
||||
args := []string{"rm", image, "--pool", pOpts.Pool, "--id", adminId, "-m", mon, "--key=" + key}
|
||||
glog.V(4).Infof("rbd: rm %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, adminID, key)
|
||||
args := []string{"rm", image, "--pool", pOpts.Pool, "--id", adminID, "-m", mon, "--key=" + key}
|
||||
output, err = execCommand("rbd", args)
|
||||
if err == nil {
|
||||
return nil
|
||||
@ -258,13 +258,13 @@ func getRBDVolumeOptions(volOptions map[string]string) (*rbdVolume, error) {
|
||||
}
|
||||
|
||||
}
|
||||
rbdVol.AdminId, ok = volOptions["adminid"]
|
||||
rbdVol.AdminID, ok = volOptions["adminid"]
|
||||
if !ok {
|
||||
rbdVol.AdminId = rbdDefaultAdminId
|
||||
rbdVol.AdminID = rbdDefaultAdminID
|
||||
}
|
||||
rbdVol.UserId, ok = volOptions["userid"]
|
||||
rbdVol.UserID, ok = volOptions["userid"]
|
||||
if !ok {
|
||||
rbdVol.UserId = rbdDefaultUserId
|
||||
rbdVol.UserID = rbdDefaultUserID
|
||||
}
|
||||
rbdVol.Mounter, ok = volOptions["mounter"]
|
||||
if !ok {
|
||||
@ -287,13 +287,13 @@ func getRBDSnapshotOptions(snapOptions map[string]string) (*rbdSnapshot, error)
|
||||
return nil, fmt.Errorf("Either monitors or monValueFromSecret must be set")
|
||||
}
|
||||
}
|
||||
rbdSnap.AdminId, ok = snapOptions["adminid"]
|
||||
rbdSnap.AdminID, ok = snapOptions["adminid"]
|
||||
if !ok {
|
||||
rbdSnap.AdminId = rbdDefaultAdminId
|
||||
rbdSnap.AdminID = rbdDefaultAdminID
|
||||
}
|
||||
rbdSnap.UserId, ok = snapOptions["userid"]
|
||||
rbdSnap.UserID, ok = snapOptions["userid"]
|
||||
if !ok {
|
||||
rbdSnap.UserId = rbdDefaultUserId
|
||||
rbdSnap.UserID = rbdDefaultUserID
|
||||
}
|
||||
|
||||
return rbdSnap, nil
|
||||
@ -351,13 +351,13 @@ func getSnapMon(pOpts *rbdSnapshot, credentials map[string]string) (string, erro
|
||||
return mon, nil
|
||||
}
|
||||
|
||||
func protectSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[string]string) error {
|
||||
func protectSnapshot(pOpts *rbdSnapshot, adminID string, credentials map[string]string) error {
|
||||
var output []byte
|
||||
|
||||
image := pOpts.VolName
|
||||
snapID := pOpts.SnapID
|
||||
|
||||
key, err := getRBDKey(adminId, credentials)
|
||||
key, err := getRBDKey(adminID, credentials)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -366,8 +366,8 @@ func protectSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[string]
|
||||
return err
|
||||
}
|
||||
|
||||
glog.V(4).Infof("rbd: snap protect %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, adminId, key)
|
||||
args := []string{"snap", "protect", "--pool", pOpts.Pool, "--snap", snapID, image, "--id", adminId, "-m", mon, "--key=" + key}
|
||||
glog.V(4).Infof("rbd: snap protect %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, adminID, key)
|
||||
args := []string{"snap", "protect", "--pool", pOpts.Pool, "--snap", snapID, image, "--id", adminID, "-m", mon, "--key=" + key}
|
||||
|
||||
output, err = execCommand("rbd", args)
|
||||
|
||||
@ -378,7 +378,7 @@ func protectSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[string]
|
||||
return nil
|
||||
}
|
||||
|
||||
func createSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[string]string) error {
|
||||
func createSnapshot(pOpts *rbdSnapshot, adminID string, credentials map[string]string) error {
|
||||
var output []byte
|
||||
|
||||
mon, err := getSnapMon(pOpts, credentials)
|
||||
@ -389,12 +389,12 @@ func createSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[string]s
|
||||
image := pOpts.VolName
|
||||
snapID := pOpts.SnapID
|
||||
|
||||
key, err := getRBDKey(adminId, credentials)
|
||||
key, err := getRBDKey(adminID, credentials)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
glog.V(4).Infof("rbd: snap create %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, adminId, key)
|
||||
args := []string{"snap", "create", "--pool", pOpts.Pool, "--snap", snapID, image, "--id", adminId, "-m", mon, "--key=" + key}
|
||||
glog.V(4).Infof("rbd: snap create %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, adminID, key)
|
||||
args := []string{"snap", "create", "--pool", pOpts.Pool, "--snap", snapID, image, "--id", adminID, "-m", mon, "--key=" + key}
|
||||
|
||||
output, err = execCommand("rbd", args)
|
||||
|
||||
@ -405,7 +405,7 @@ func createSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[string]s
|
||||
return nil
|
||||
}
|
||||
|
||||
func unprotectSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[string]string) error {
|
||||
func unprotectSnapshot(pOpts *rbdSnapshot, adminID string, credentials map[string]string) error {
|
||||
var output []byte
|
||||
|
||||
mon, err := getSnapMon(pOpts, credentials)
|
||||
@ -416,12 +416,12 @@ func unprotectSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[strin
|
||||
image := pOpts.VolName
|
||||
snapID := pOpts.SnapID
|
||||
|
||||
key, err := getRBDKey(adminId, credentials)
|
||||
key, err := getRBDKey(adminID, credentials)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
glog.V(4).Infof("rbd: snap unprotect %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, adminId, key)
|
||||
args := []string{"snap", "unprotect", "--pool", pOpts.Pool, "--snap", snapID, image, "--id", adminId, "-m", mon, "--key=" + key}
|
||||
glog.V(4).Infof("rbd: snap unprotect %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, adminID, key)
|
||||
args := []string{"snap", "unprotect", "--pool", pOpts.Pool, "--snap", snapID, image, "--id", adminID, "-m", mon, "--key=" + key}
|
||||
|
||||
output, err = execCommand("rbd", args)
|
||||
|
||||
@ -432,7 +432,7 @@ func unprotectSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[strin
|
||||
return nil
|
||||
}
|
||||
|
||||
func deleteSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[string]string) error {
|
||||
func deleteSnapshot(pOpts *rbdSnapshot, adminID string, credentials map[string]string) error {
|
||||
var output []byte
|
||||
|
||||
mon, err := getSnapMon(pOpts, credentials)
|
||||
@ -443,12 +443,12 @@ func deleteSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[string]s
|
||||
image := pOpts.VolName
|
||||
snapID := pOpts.SnapID
|
||||
|
||||
key, err := getRBDKey(adminId, credentials)
|
||||
key, err := getRBDKey(adminID, credentials)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
glog.V(4).Infof("rbd: snap rm %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, adminId, key)
|
||||
args := []string{"snap", "rm", "--pool", pOpts.Pool, "--snap", snapID, image, "--id", adminId, "-m", mon, "--key=" + key}
|
||||
glog.V(4).Infof("rbd: snap rm %s using mon %s, pool %s id %s key %s", image, mon, pOpts.Pool, adminID, key)
|
||||
args := []string{"snap", "rm", "--pool", pOpts.Pool, "--snap", snapID, image, "--id", adminID, "-m", mon, "--key=" + key}
|
||||
|
||||
output, err = execCommand("rbd", args)
|
||||
|
||||
@ -459,7 +459,7 @@ func deleteSnapshot(pOpts *rbdSnapshot, adminId string, credentials map[string]s
|
||||
return nil
|
||||
}
|
||||
|
||||
func restoreSnapshot(pVolOpts *rbdVolume, pSnapOpts *rbdSnapshot, adminId string, credentials map[string]string) error {
|
||||
func restoreSnapshot(pVolOpts *rbdVolume, pSnapOpts *rbdSnapshot, adminID string, credentials map[string]string) error {
|
||||
var output []byte
|
||||
|
||||
mon, err := getMon(pVolOpts, credentials)
|
||||
@ -470,12 +470,12 @@ func restoreSnapshot(pVolOpts *rbdVolume, pSnapOpts *rbdSnapshot, adminId string
|
||||
image := pVolOpts.VolName
|
||||
snapID := pSnapOpts.SnapID
|
||||
|
||||
key, err := getRBDKey(adminId, credentials)
|
||||
key, err := getRBDKey(adminID, credentials)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
glog.V(4).Infof("rbd: clone %s using mon %s, pool %s id %s key %s", image, mon, pVolOpts.Pool, adminId, key)
|
||||
args := []string{"clone", pSnapOpts.Pool + "/" + pSnapOpts.VolName + "@" + snapID, pVolOpts.Pool + "/" + image, "--id", adminId, "-m", mon, "--key=" + key}
|
||||
glog.V(4).Infof("rbd: clone %s using mon %s, pool %s id %s key %s", image, mon, pVolOpts.Pool, adminID, key)
|
||||
args := []string{"clone", pSnapOpts.Pool + "/" + pSnapOpts.VolName + "@" + snapID, pVolOpts.Pool + "/" + image, "--id", adminID, "-m", mon, "--key=" + key}
|
||||
|
||||
output, err = execCommand("rbd", args)
|
||||
|
||||
|
Reference in New Issue
Block a user