Skip to content

Commit

Permalink
machinedriver: Implement GetState
Browse files Browse the repository at this point in the history
  • Loading branch information
cfergeau committed Jul 12, 2024
1 parent 6997207 commit 6d3ce35
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion pkg/machinedriver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,31 @@ func (d *Driver) GetSharedDirs() ([]drivers.SharedDir, error) {
return d.SharedDirs, nil
}

func podmanStatusToCrcState(status define.Status) state.State {
switch status {
case define.Running:
return state.Running
case define.Stopped:
return state.Stopped
case define.Starting:
return state.Running
case define.Unknown:
return state.Error
}

// unknown state
return state.Error
}

// GetState returns the state that the host is in (running, stopped, etc)
func (d *Driver) GetState() (state.State, error) {
status, err := d.vmProvider.State(d.vmConfig, false)
if err != nil {
return state.Error, err
}
return podmanStatusToCrcState(status), nil
// piggy back on podman machine state
return state.Error, fmt.Errorf("GetState() unimplemented")
//return state.Error, fmt.Errorf("GetState() unimplemented")
}

// Kill stops a host forcefully
Expand Down

0 comments on commit 6d3ce35

Please sign in to comment.