mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
Fix issue with error handling in metadata store
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
This commit is contained in:
parent
b968025037
commit
b71a9bfe40
@ -150,13 +150,13 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
|||||||
glog.V(4).Infof("create volume %s", volName)
|
glog.V(4).Infof("create volume %s", volName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err = cs.MetadataStore.Create(volumeID, rbdVol); err != nil {
|
if createErr := cs.MetadataStore.Create(volumeID, rbdVol); createErr != nil {
|
||||||
glog.Warningf("failed to store volume metadata with error: %v", err)
|
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)
|
glog.V(3).Infof("failed to delete rbd image: %s/%s with error: %v", rbdVol.Pool, rbdVol.VolName, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, createErr
|
||||||
}
|
}
|
||||||
|
|
||||||
rbdVolumes[volumeID] = rbdVol
|
rbdVolumes[volumeID] = rbdVol
|
||||||
@ -341,7 +341,8 @@ func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
|||||||
|
|
||||||
rbdSnap.CreatedAt = ptypes.TimestampNow().GetSeconds()
|
rbdSnap.CreatedAt = ptypes.TimestampNow().GetSeconds()
|
||||||
|
|
||||||
if err = cs.MetadataStore.Create(snapshotID, rbdSnap); err != nil {
|
if createErr := cs.MetadataStore.Create(snapshotID, rbdSnap); createErr != nil {
|
||||||
|
|
||||||
glog.Warningf("rbd: failed to store snapInfo with error: %v", err)
|
glog.Warningf("rbd: failed to store snapInfo with error: %v", err)
|
||||||
// Unprotect snapshot
|
// Unprotect snapshot
|
||||||
err = unprotectSnapshot(rbdSnap, rbdSnap.AdminID, req.GetSecrets())
|
err = unprotectSnapshot(rbdSnap, rbdSnap.AdminID, req.GetSecrets())
|
||||||
@ -353,7 +354,7 @@ func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
|||||||
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, 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
|
return nil, createErr
|
||||||
}
|
}
|
||||||
|
|
||||||
rbdSnapshots[snapshotID] = rbdSnap
|
rbdSnapshots[snapshotID] = rbdSnap
|
||||||
|
@ -93,6 +93,7 @@ func (r *Driver) Run(driverName, nodeID, endpoint string, containerized bool, ca
|
|||||||
csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,
|
csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,
|
||||||
csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT,
|
csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT,
|
||||||
csi.ControllerServiceCapability_RPC_LIST_SNAPSHOTS,
|
csi.ControllerServiceCapability_RPC_LIST_SNAPSHOTS,
|
||||||
|
csi.ControllerServiceCapability_RPC_CLONE_VOLUME,
|
||||||
})
|
})
|
||||||
r.cd.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER})
|
r.cd.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user