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