GetVMType returns the Lima VMType for a running instance.
(creator command.NerdctlCmdCreator, logger flog.Logger, instanceName string)
| 57 | |
| 58 | // GetVMType returns the Lima VMType for a running instance. |
| 59 | func GetVMType(creator command.NerdctlCmdCreator, logger flog.Logger, instanceName string) (VMType, error) { |
| 60 | args := []string{"ls", "-f", "{{.VMType}}", instanceName} |
| 61 | cmd := creator.CreateWithoutStdio(args...) |
| 62 | out, err := cmd.Output() |
| 63 | if err != nil { |
| 64 | return UnknownVMType, err |
| 65 | } |
| 66 | status := strings.TrimSpace(string(out)) |
| 67 | return toVMType(status, logger) |
| 68 | } |
| 69 | |
| 70 | func toVMStatus(status string, logger flog.Logger) (VMStatus, error) { |
| 71 | logger.Debugf("Status of virtual machine: %s", status) |