MCPcopy
hub / github.com/runfinch/finch / GetVMType

Function GetVMType

pkg/lima/lima.go:59–68  ·  view source on GitHub ↗

GetVMType returns the Lima VMType for a running instance.

(creator command.NerdctlCmdCreator, logger flog.Logger, instanceName string)

Source from the content-addressed store, hash-verified

57
58// GetVMType returns the Lima VMType for a running instance.
59func 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
70func toVMStatus(status string, logger flog.Logger) (VMStatus, error) {
71 logger.Debugf("Status of virtual machine: %s", status)

Callers 1

TestGetVMTypeFunction · 0.92

Calls 3

toVMTypeFunction · 0.85
CreateWithoutStdioMethod · 0.65
OutputMethod · 0.65

Tested by 1

TestGetVMTypeFunction · 0.74