Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/store/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type Instance struct {
// Hostname, not HostName (corresponds to SSH's naming convention)
Hostname string `json:"hostname"`
Status Status `json:"status"`
Saved bool `json:"saved"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can document here what saved mean?

Dir string `json:"dir"`
VMType limayaml.VMType `json:"vmType"`
Arch limayaml.Arch `json:"arch"`
Expand Down Expand Up @@ -147,6 +148,14 @@ func Inspect(instName string) (*Instance, error) {
}

inspectStatus(instDir, inst, y)
_, err = os.Stat(filepath.Join(instDir, filenames.VzMachineState))
if err == nil {
inst.Saved = true
} else if errors.Is(err, os.ErrNotExist) {
inst.Saved = false
} else {
inst.Errors = append(inst.Errors, fmt.Errorf("cannot determine whether the instance is saved: %w", err))
}

tmpl, err := template.New("format").Parse(y.Message)
if err != nil {
Expand Down