diff --git a/pixie-server/src/state/units.rs b/pixie-server/src/state/units.rs index 6c1e4db9..24a1a936 100644 --- a/pixie-server/src/state/units.rs +++ b/pixie-server/src/state/units.rs @@ -137,12 +137,12 @@ impl State { action } else { match unit.next_action { - Action::Store | Action::Flash | Action::Register => { + Action::Restart | Action::Store | Action::Flash | Action::Register => { unit.curr_action = Some(unit.next_action); unit.next_action = Action::Wait; modified = true; } - Action::Reboot | Action::Wait | Action::Shutdown => { + Action::Boot | Action::Wait | Action::Shutdown => { modified = false; } } diff --git a/pixie-shared/src/lib.rs b/pixie-shared/src/lib.rs index 0e26a53b..6b362844 100644 --- a/pixie-shared/src/lib.rs +++ b/pixie-shared/src/lib.rs @@ -118,7 +118,9 @@ pub const UDP_BODY_LEN: usize = 1472; #[serde(rename_all = "lowercase")] pub enum Action { /// Reboot into the OS. - Reboot, + Boot, + /// Restart the machine. + Restart, /// Shutdown the machine. Shutdown, /// Register the machine. @@ -134,7 +136,8 @@ pub enum Action { impl Display for Action { fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> { match self { - Action::Reboot => write!(fmt, "reboot"), + Action::Boot => write!(fmt, "reboot"), + Action::Restart => write!(fmt, "restart"), Action::Shutdown => write!(fmt, "shutdown"), Action::Register => write!(fmt, "register"), Action::Store => write!(fmt, "store"), diff --git a/pixie-uefi/src/main.rs b/pixie-uefi/src/main.rs index a90efafb..e113e555 100644 --- a/pixie-uefi/src/main.rs +++ b/pixie-uefi/src/main.rs @@ -144,7 +144,8 @@ async fn run(os: UefiOS) -> Result<()> { log::info!("Command: {command:?}"); match command { Action::Wait => unreachable!(), - Action::Reboot => reboot_to_os(os).await, + Action::Boot => reboot_to_os(os).await, + Action::Restart => {} Action::Shutdown => shutdown(os).await, Action::Register => register(os, server).await?, Action::Store => store(os, server).await?, @@ -155,6 +156,10 @@ async fn run(os: UefiOS) -> Result<()> { complete_action(&tcp).await?; tcp.close_send().await; tcp.force_close().await; + + if command == Action::Restart { + os.reset(); + } } } } diff --git a/pixie-web/src/main.rs b/pixie-web/src/main.rs index bf5f71bd..5b918203 100644 --- a/pixie-web/src/main.rs +++ b/pixie-web/src/main.rs @@ -148,7 +148,8 @@ fn Group( let mac = move || unit.get().mac.to_string(); let url_flash = move || format!("admin/action/{}/flash", mac()); let url_store = move || format!("admin/action/{}/store", mac()); - let url_boot = move || format!("admin/action/{}/reboot", mac()); + let url_boot = move || format!("admin/action/{}/boot", mac()); + let url_restart = move || format!("admin/action/{}/restart", mac()); let url_cancel = move || format!("admin/action/{}/wait", mac()); let url_register = move || format!("admin/action/{}/register", mac()); let url_shutdown = move || format!("admin/action/{}/shutdown", mac()); @@ -206,7 +207,10 @@ fn Group( "store" + +