Skip to content

Commit

Permalink
Convert the request to switch
Browse files Browse the repository at this point in the history
  • Loading branch information
vvolam committed Sep 18, 2024
1 parent a977ed2 commit 5f81358
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gnmi_server/gnoi.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,14 @@ func (srv *SystemServer) Reboot(ctx context.Context, req *gnoi_system_pb.RebootR
log.V(1).Info("Request:", req)

// Check the reboot type
if req.GetMethod() == gnoi_system_pb.RebootMethod_HALT {
switch req.GetMethod() {
case gnoi_system_pb.RebootMethod_HALT:
log.V(1).Info("Reboot method is HALT. Halting the system...")
err = HaltSystem()
if err != nil {
return nil, err
}
} else {
default:
log.V(1).Info("Reboot system now, delay is ignored...")
// TODO: Support GNOI reboot delay
// Delay in nanoseconds before issuing reboot.
Expand Down
1 change: 1 addition & 0 deletions sonic_service_client/dbus_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ func (c *DbusClient) HaltSystem() error {
busPath := c.busPathPrefix + modName
intName := c.intNamePrefix + modName + ".execute_reboot"

//Set the method to HALT(3) the system
method := 3

// Invoke the D-Bus API to execute the halt command
Expand Down

0 comments on commit 5f81358

Please sign in to comment.