Emit event even if status update fails so user can see it
This commit is contained in:
@@ -741,14 +741,14 @@ func (ctrl *csiSnapshotCommonController) updateSnapshotErrorStatusWithEvent(snap
|
|||||||
snapshotClone.Status.ReadyToUse = &ready
|
snapshotClone.Status.ReadyToUse = &ready
|
||||||
newSnapshot, err := ctrl.clientset.SnapshotV1beta1().VolumeSnapshots(snapshotClone.Namespace).UpdateStatus(context.TODO(), snapshotClone, metav1.UpdateOptions{})
|
newSnapshot, err := ctrl.clientset.SnapshotV1beta1().VolumeSnapshots(snapshotClone.Namespace).UpdateStatus(context.TODO(), snapshotClone, metav1.UpdateOptions{})
|
||||||
|
|
||||||
|
// Emit the event even if the status update fails so that user can see the error
|
||||||
|
ctrl.eventRecorder.Event(newSnapshot, eventtype, reason, message)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.V(4).Infof("updating VolumeSnapshot[%s] error status failed %v", utils.SnapshotKey(snapshot), err)
|
klog.V(4).Infof("updating VolumeSnapshot[%s] error status failed %v", utils.SnapshotKey(snapshot), err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit the event only when the status change happens
|
|
||||||
ctrl.eventRecorder.Event(newSnapshot, eventtype, reason, message)
|
|
||||||
|
|
||||||
_, err = ctrl.storeSnapshotUpdate(newSnapshot)
|
_, err = ctrl.storeSnapshotUpdate(newSnapshot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.V(4).Infof("updating VolumeSnapshot[%s] error status: cannot update internal cache %v", utils.SnapshotKey(snapshot), err)
|
klog.V(4).Infof("updating VolumeSnapshot[%s] error status: cannot update internal cache %v", utils.SnapshotKey(snapshot), err)
|
||||||
|
@@ -159,14 +159,14 @@ func (ctrl *csiSnapshotSideCarController) updateContentErrorStatusWithEvent(cont
|
|||||||
contentClone.Status.ReadyToUse = &ready
|
contentClone.Status.ReadyToUse = &ready
|
||||||
newContent, err := ctrl.clientset.SnapshotV1beta1().VolumeSnapshotContents().UpdateStatus(context.TODO(), contentClone, metav1.UpdateOptions{})
|
newContent, err := ctrl.clientset.SnapshotV1beta1().VolumeSnapshotContents().UpdateStatus(context.TODO(), contentClone, metav1.UpdateOptions{})
|
||||||
|
|
||||||
|
// Emit the event even if the status update fails so that user can see the error
|
||||||
|
ctrl.eventRecorder.Event(newContent, eventtype, reason, message)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.V(4).Infof("updating VolumeSnapshotContent[%s] error status failed %v", content.Name, err)
|
klog.V(4).Infof("updating VolumeSnapshotContent[%s] error status failed %v", content.Name, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit the event only when the status change happens
|
|
||||||
ctrl.eventRecorder.Event(newContent, eventtype, reason, message)
|
|
||||||
|
|
||||||
_, err = ctrl.storeContentUpdate(newContent)
|
_, err = ctrl.storeContentUpdate(newContent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.V(4).Infof("updating VolumeSnapshotContent[%s] error status: cannot update internal cache %v", content.Name, err)
|
klog.V(4).Infof("updating VolumeSnapshotContent[%s] error status: cannot update internal cache %v", content.Name, err)
|
||||||
|
Reference in New Issue
Block a user