File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -325,23 +325,27 @@ func (c *Base) GetClone(id string) (*models.Clone, error) {
325
325
return nil , errors .New ("clone not found" )
326
326
}
327
327
328
- if w .Session == nil {
328
+ c .refreshCloneMetadata (w )
329
+
330
+ return w .Clone , nil
331
+ }
332
+
333
+ func (c * Base ) refreshCloneMetadata (w * CloneWrapper ) {
334
+ if w == nil || w .Session == nil || w .Clone == nil {
329
335
// Not started yet.
330
- return w . Clone , nil
336
+ return
331
337
}
332
338
333
339
sessionState , err := c .provision .GetSessionState (w .Session )
334
340
if err != nil {
335
341
// Session not ready yet.
336
- log .Err (errors . Wrap ( err , "failed to get a session state" ))
342
+ log .Err (fmt . Errorf ( "failed to get a session state: %w" , err ))
337
343
338
- return w . Clone , nil
344
+ return
339
345
}
340
346
341
347
w .Clone .Metadata .CloneDiffSize = sessionState .CloneDiffSize
342
348
w .Clone .Metadata .LogicalSize = sessionState .LogicalReferenced
343
-
344
- return w .Clone , nil
345
349
}
346
350
347
351
// UpdateClone updates clone.
@@ -496,6 +500,8 @@ func (c *Base) GetClones() []*models.Clone {
496
500
cloneWrapper .Clone .Snapshot = snapshot
497
501
}
498
502
503
+ c .refreshCloneMetadata (cloneWrapper )
504
+
499
505
clones = append (clones , cloneWrapper .Clone )
500
506
}
501
507
c .cloneMutex .RUnlock ()
You can’t perform that action at this time.
0 commit comments