@@ -157,6 +157,7 @@ func imageCreateBuilder(c *core.Command) *core.Command {
157157// customImage is based on instance.Image, with additional information about the server
158158type imageListItem struct {
159159 * instance.Image
160+ Volumes map [string ]* instance.Volume
160161
161162 // Replace Image.FromServer
162163 ServerID string `json:"server_id"`
@@ -191,6 +192,7 @@ func imageListBuilder(c *core.Command) *core.Command {
191192 req .Public = scw .BoolPtr (false )
192193 client := core .ExtractClient (ctx )
193194 api := instance .NewAPI (client )
195+ blockAPI := block .NewAPI (client )
194196
195197 opts := []scw.RequestOption {scw .WithAllPages ()}
196198 if req .Zone == scw .Zone (core .AllLocalities ) {
@@ -210,6 +212,33 @@ func imageListBuilder(c *core.Command) *core.Command {
210212 newCustomImage := & imageListItem {
211213 Image : image ,
212214 }
215+
216+ if image .RootVolume .VolumeType == instance .VolumeVolumeTypeSbsSnapshot {
217+ blockVolume , err := blockAPI .GetSnapshot (& block.GetSnapshotRequest {
218+ SnapshotID : image .RootVolume .ID ,
219+ Zone : image .Zone ,
220+ }, scw .WithContext (ctx ))
221+ if err != nil {
222+ return nil , err
223+ }
224+
225+ newCustomImage .Image .RootVolume .Size = blockVolume .Size
226+ }
227+
228+ for index , volume := range image .ExtraVolumes {
229+ if volume .VolumeType == instance .VolumeVolumeTypeSbsSnapshot {
230+ blockVolume , err := blockAPI .GetSnapshot (& block.GetSnapshotRequest {
231+ SnapshotID : volume .ID ,
232+ Zone : volume .Zone ,
233+ }, scw .WithContext (ctx ))
234+ if err != nil {
235+ return nil , err
236+ }
237+
238+ newCustomImage .Image .ExtraVolumes [index ].Size = blockVolume .Size
239+ }
240+ }
241+
213242 customImages = append (customImages , newCustomImage )
214243
215244 if image .FromServer == "" {
0 commit comments