File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ type Instance struct {
43
43
// Hostname, not HostName (corresponds to SSH's naming convention)
44
44
Hostname string `json:"hostname"`
45
45
Status Status `json:"status"`
46
+ Saved bool `json:"saved"`
46
47
Dir string `json:"dir"`
47
48
VMType limayaml.VMType `json:"vmType"`
48
49
Arch limayaml.Arch `json:"arch"`
@@ -147,6 +148,14 @@ func Inspect(instName string) (*Instance, error) {
147
148
}
148
149
149
150
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
+ }
150
159
151
160
tmpl , err := template .New ("format" ).Parse (y .Message )
152
161
if err != nil {
You can’t perform that action at this time.
0 commit comments