Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/src/host_orchestrator/orchestrator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ func (c *Controller) AddRoutes(router *mux.Router) {
httpHandler(newExecCVDInstanceCommandHandler(c.Config, c.OperationManager, &powerwashCvdCommand{}))).Methods("POST")
router.Handle("/cvds/{group}/{name}/:powerbtn",
httpHandler(newExecCVDInstanceCommandHandler(c.Config, c.OperationManager, &powerbtnCvdCommand{}))).Methods("POST")
router.Handle("/cvds/{group}/{name}/:restart",
httpHandler(newExecCVDInstanceCommandHandler(c.Config, c.OperationManager, &restartCvdCommand{}))).Methods("POST")
router.Handle("/cvds/{group}/{name}/:start_screen_recording",
httpHandler(newExecCVDInstanceCommandHandler(c.Config, c.OperationManager, &startScreenRecordingCvdCommand{}))).Methods("POST")
router.Handle("/cvds/{group}/{name}/:stop_screen_recording",
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/host_orchestrator/orchestrator/cvd/cvd.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,13 @@ func (i *Instance) PowerWash() error {
return err
}

func (i *Instance) Restart() error {
args := i.selectorArgs()
args = append(args, "restart")
_, err := i.cli.exec(CVDBin, args...)
return err
}

func (i *Instance) Resume() error {
args := i.selectorArgs()
args = append(args, "resume")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ func (a *powerbtnCvdCommand) exec(cvd *cvd.CLI, sel cvd.InstanceSelector) error
return cvd.LazySelectInstance(sel).PowerBtn()
}

type restartCvdCommand struct{}

func (a *restartCvdCommand) exec(cvd *cvd.CLI, sel cvd.InstanceSelector) error {
return cvd.LazySelectInstance(sel).Restart()
}

type startScreenRecordingCvdCommand struct{}

func (a *startScreenRecordingCvdCommand) exec(cvd *cvd.CLI, sel cvd.InstanceSelector) error {
Expand Down
Loading