Skip to content

Commit 5a7115d

Browse files
committed
Add snapshot size to VSC created for VGS
Currently the RestoreSize is missing when the corresponding VSC are created for the the volumesnapshotgroup, This PR adds the missing RestoreSize for VSC. Signed-off-by: Madhu Rajanna <[email protected]>
1 parent ebf903a commit 5a7115d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pkg/sidecar-controller/groupsnapshot_helper.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@ func (ctrl *csiSnapshotSideCarController) createGroupSnapshotWrapper(groupSnapsh
477477
if err != nil {
478478
return groupSnapshotContent, err
479479
}
480+
481+
_, err = ctrl.updateSnapshotContentStatus(volumeSnapshotContent, snapshot.SnapshotId, snapshot.ReadyToUse, snapshot.CreationTime.AsTime().UnixNano(), snapshot.SizeBytes, groupSnapshotID)
482+
if err != nil {
483+
return groupSnapshotContent, err
484+
}
480485
}
481486

482487
newGroupSnapshotContent, err := ctrl.updateGroupSnapshotContentStatus(groupSnapshotContent, groupSnapshotID, readyToUse, creationTime.UnixNano(), snapshotContentNames)

pkg/sidecar-controller/snapshot_controller.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,13 @@ func (ctrl *csiSnapshotSideCarController) updateSnapshotContentStatus(
446446
SnapshotHandle: &snapshotHandle,
447447
ReadyToUse: &readyToUse,
448448
CreationTime: &createdAt,
449-
RestoreSize: &size,
450449
}
451450
if groupSnapshotID != "" {
452451
newStatus.VolumeGroupSnapshotHandle = &groupSnapshotID
453452
}
453+
if size > 0 {
454+
newStatus.RestoreSize = &size
455+
}
454456
updated = true
455457
} else {
456458
newStatus = contentObj.Status.DeepCopy()
@@ -469,7 +471,7 @@ func (ctrl *csiSnapshotSideCarController) updateSnapshotContentStatus(
469471
newStatus.CreationTime = &createdAt
470472
updated = true
471473
}
472-
if newStatus.RestoreSize == nil {
474+
if newStatus.RestoreSize == nil && size > 0 {
473475
newStatus.RestoreSize = &size
474476
updated = true
475477
}

0 commit comments

Comments
 (0)