@@ -8,13 +8,31 @@ import (
88 "github.com/lima-vm/lima/pkg/store"
99)
1010
11+ // Driver interface is used by hostagent for managing vm.
12+ //
13+ // This interface is extended by BaseDriver which provides default implementation.
14+ // All other driver definition must extend BaseDriver
1115type Driver interface {
16+ // Validate returns error if the current driver isn't support for given config
1217 Validate () error
1318
19+ // CreateDisk returns error if the current driver fails in creating disk
1420 CreateDisk () error
1521
22+ // Start is used for booting the vm using driver instance
23+ // It returns a chan error on successful boot
24+ // The second argument may contain error occurred while starting driver
1625 Start (_ context.Context ) (chan error , error )
1726
27+ // CanRunGUI returns bool to indicate if the hostagent need to run GUI synchronously
28+ CanRunGUI () bool
29+
30+ // RunGUI is for starting GUI synchronously by hostagent. This method should be wait and return only after vm terminates
31+ // It returns error if there are any failures
32+ RunGUI () error
33+
34+ // Stop will terminate the running vm instance.
35+ // It returns error if there are any errors during Stop
1836 Stop (_ context.Context ) error
1937
2038 ChangeDisplayPassword (_ context.Context , password string ) error
@@ -49,6 +67,14 @@ func (d *BaseDriver) Start(_ context.Context) (chan error, error) {
4967 return nil , nil
5068}
5169
70+ func (d * BaseDriver ) CanRunGUI () bool {
71+ return false
72+ }
73+
74+ func (d * BaseDriver ) RunGUI () error {
75+ return nil
76+ }
77+
5278func (d * BaseDriver ) Stop (_ context.Context ) error {
5379 return nil
5480}
0 commit comments