Skip to content

Commit 18241c3

Browse files
authored
Merge pull request #1011 from Madhu-1/fix-size-vsc
Add snapshot size to VSC created for VGS
2 parents dc1f861 + 5a7115d commit 18241c3

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)