feat: add full snapshot downloads and safe manual restore
This commit is contained in:
@@ -33,6 +33,10 @@ type snapshotInfo struct {
|
||||
Protected bool `json:"protected"`
|
||||
ProtectionReason string `json:"protection_reason"`
|
||||
SizeError string `json:"size_error,omitempty"`
|
||||
Restorable bool `json:"restorable"`
|
||||
RestoreReason string `json:"restore_reason"`
|
||||
SourceVersion string `json:"source_version,omitempty"`
|
||||
SourceImage string `json:"source_image,omitempty"`
|
||||
}
|
||||
|
||||
func managementRoot(base string, parts ...string) (*os.Root, error) {
|
||||
@@ -190,10 +194,18 @@ func (a *API) backupManagement(w http.ResponseWriter, r *http.Request, i store.I
|
||||
return
|
||||
}
|
||||
s := snapshotInfo{ID: entry.Name(), CreatedAt: st.ModTime(), Protected: reason != "", ProtectionReason: reason}
|
||||
s.SourceVersion, s.SourceImage, s.RestoreReason = a.snapshotCompatibility(i, s.ID)
|
||||
s.Restorable = s.RestoreReason == "" || s.RestoreReason == snapshotUnknownReason
|
||||
if reason != "" {
|
||||
s.Restorable = false
|
||||
s.RestoreReason = reason
|
||||
}
|
||||
s.Size, err = snapshotBytes(r.Context(), root, entry.Name())
|
||||
if err != nil {
|
||||
s.Size = -1
|
||||
s.SizeError = "snapshot size unavailable: " + err.Error()
|
||||
s.Restorable = false
|
||||
s.RestoreReason = "snapshot size unavailable"
|
||||
}
|
||||
out = append(out, s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user