Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d8eb436

Browse filesBrowse files
committed
fix: show actual clone metadata in the API instance status response (#309)
1 parent 17e62d1 commit d8eb436
Copy full SHA for d8eb436

File tree

1 file changed

+12
-6
lines changed
Filter options

1 file changed

+12
-6
lines changed

‎internal/cloning/base.go

Copy file name to clipboardExpand all lines: internal/cloning/base.go
+12-6Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,23 +322,27 @@ func (c *Base) GetClone(id string) (*models.Clone, error) {
322322
return nil, errors.New("clone not found")
323323
}
324324

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 {
326332
// Not started yet.
327-
return w.Clone, nil
333+
return
328334
}
329335

330336
sessionState, err := c.provision.GetSessionState(w.Session)
331337
if err != nil {
332338
// 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))
334340

335-
return w.Clone, nil
341+
return
336342
}
337343

338344
w.Clone.Metadata.CloneDiffSize = sessionState.CloneDiffSize
339345
w.Clone.Metadata.LogicalSize = sessionState.LogicalReferenced
340-
341-
return w.Clone, nil
342346
}
343347

344348
// UpdateClone updates clone.
@@ -493,6 +497,8 @@ func (c *Base) GetClones() []*models.Clone {
493497
cloneWrapper.Clone.Snapshot = snapshot
494498
}
495499

500+
c.refreshCloneMetadata(cloneWrapper)
501+
496502
clones = append(clones, cloneWrapper.Clone)
497503
}
498504
c.cloneMutex.RUnlock()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.