MCPcopy
hub / github.com/abiosoft/colima / validateCommonPrerequisites

Function validateCommonPrerequisites

model/runner.go:84–116  ·  view source on GitHub ↗

validateCommonPrerequisites checks prerequisites common to all runners.

(a app.App)

Source from the content-addressed store, hash-verified

82
83// validateCommonPrerequisites checks prerequisites common to all runners.
84func validateCommonPrerequisites(a app.App) error {
85 // VM must be running
86 if !a.Active() {
87 return fmt.Errorf("%s is not running", config.CurrentProfile().DisplayName)
88 }
89
90 // check runtime is docker
91 r, err := a.Runtime()
92 if err != nil {
93 return err
94 }
95 if r != docker.Name {
96 return fmt.Errorf("'colima model' requires docker runtime, current runtime is %s\n"+
97 "Start colima with: colima start --runtime docker --vm-type krunkit", r)
98 }
99
100 // check VM type is krunkit (required for GPU access)
101 conf, err := configmanager.LoadInstance()
102 if err != nil {
103 return fmt.Errorf("error loading instance config: %w", err)
104 }
105 if conf.VMType != limaconfig.Krunkit {
106 return fmt.Errorf("'colima model' requires krunkit VM type for GPU access, current VM type is %s\n"+
107 "Start colima with: colima start --runtime docker --vm-type krunkit", conf.VMType)
108 }
109
110 // check krunkit binary exists on host
111 if err := util.AssertKrunkit(); err != nil {
112 return err
113 }
114
115 return nil
116}
117
118// dockerRunner implements Runner for Docker Model Runner.
119type dockerRunner struct{}

Callers 2

ValidatePrerequisitesMethod · 0.85
ValidatePrerequisitesMethod · 0.85

Calls 5

CurrentProfileFunction · 0.92
LoadInstanceFunction · 0.92
AssertKrunkitFunction · 0.92
ActiveMethod · 0.65
RuntimeMethod · 0.65

Tested by

no test coverage detected