File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ type Instance struct {
4343 // Hostname, not HostName (corresponds to SSH's naming convention)
4444 Hostname string `json:"hostname"`
4545 Status Status `json:"status"`
46+ Saved bool `json:"saved"`
4647 Dir string `json:"dir"`
4748 VMType limayaml.VMType `json:"vmType"`
4849 Arch limayaml.Arch `json:"arch"`
@@ -147,6 +148,14 @@ func Inspect(instName string) (*Instance, error) {
147148 }
148149
149150 inspectStatus (instDir , inst , y )
151+ _ , err = os .Stat (filepath .Join (instDir , filenames .VzMachineState ))
152+ if err == nil {
153+ inst .Saved = true
154+ } else if errors .Is (err , os .ErrNotExist ) {
155+ inst .Saved = false
156+ } else {
157+ inst .Errors = append (inst .Errors , fmt .Errorf ("cannot determine whether the instance is saved: %w" , err ))
158+ }
150159
151160 tmpl , err := template .New ("format" ).Parse (y .Message )
152161 if err != nil {
You can’t perform that action at this time.
0 commit comments