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 <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2024-02-14 14:23:32 +01:00
parent ebf903ae5f
commit 5a7115d61d
2 changed files with 9 additions and 2 deletions

View File

@@ -477,6 +477,11 @@ func (ctrl *csiSnapshotSideCarController) createGroupSnapshotWrapper(groupSnapsh
if err != nil { if err != nil {
return groupSnapshotContent, err return groupSnapshotContent, err
} }
_, err = ctrl.updateSnapshotContentStatus(volumeSnapshotContent, snapshot.SnapshotId, snapshot.ReadyToUse, snapshot.CreationTime.AsTime().UnixNano(), snapshot.SizeBytes, groupSnapshotID)
if err != nil {
return groupSnapshotContent, err
}
} }
newGroupSnapshotContent, err := ctrl.updateGroupSnapshotContentStatus(groupSnapshotContent, groupSnapshotID, readyToUse, creationTime.UnixNano(), snapshotContentNames) newGroupSnapshotContent, err := ctrl.updateGroupSnapshotContentStatus(groupSnapshotContent, groupSnapshotID, readyToUse, creationTime.UnixNano(), snapshotContentNames)

View File

@@ -446,11 +446,13 @@ func (ctrl *csiSnapshotSideCarController) updateSnapshotContentStatus(
SnapshotHandle: &snapshotHandle, SnapshotHandle: &snapshotHandle,
ReadyToUse: &readyToUse, ReadyToUse: &readyToUse,
CreationTime: &createdAt, CreationTime: &createdAt,
RestoreSize: &size,
} }
if groupSnapshotID != "" { if groupSnapshotID != "" {
newStatus.VolumeGroupSnapshotHandle = &groupSnapshotID newStatus.VolumeGroupSnapshotHandle = &groupSnapshotID
} }
if size > 0 {
newStatus.RestoreSize = &size
}
updated = true updated = true
} else { } else {
newStatus = contentObj.Status.DeepCopy() newStatus = contentObj.Status.DeepCopy()
@@ -469,7 +471,7 @@ func (ctrl *csiSnapshotSideCarController) updateSnapshotContentStatus(
newStatus.CreationTime = &createdAt newStatus.CreationTime = &createdAt
updated = true updated = true
} }
if newStatus.RestoreSize == nil { if newStatus.RestoreSize == nil && size > 0 {
newStatus.RestoreSize = &size newStatus.RestoreSize = &size
updated = true updated = true
} }