Skip to content
Merged
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
4 changes: 2 additions & 2 deletions pixie-server/src/state/units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
7 changes: 5 additions & 2 deletions pixie-shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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"),
Expand Down
7 changes: 6 additions & 1 deletion pixie-uefi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
Expand All @@ -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();
}
}
}
}
Expand Down
14 changes: 11 additions & 3 deletions pixie-web/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -206,7 +207,10 @@ fn Group(
"store"
</Button>
<Button color=ButtonColor::Success on_click=move |_| send_req(url_boot())>
"reboot"
"boot"
</Button>
<Button color=ButtonColor::Success on_click=move |_| send_req(url_restart())>
"restart"
</Button>
<Button color=ButtonColor::Primary on_click=move |_| send_req(url_cancel())>
"wait"
Expand Down Expand Up @@ -237,7 +241,8 @@ fn Group(
};

let url_flash = move || format!("admin/action/{}/flash", group_name.get());
let url_boot = move || format!("admin/action/{}/reboot", group_name.get());
let url_boot = move || format!("admin/action/{}/boot", group_name.get());
let url_restart = move || format!("admin/action/{}/restart", group_name.get());
let url_cancel = move || format!("admin/action/{}/wait", group_name.get());

let image_button = move |image: String| {
Expand All @@ -260,6 +265,9 @@ fn Group(
<Button color=ButtonColor::Success on_click=move |_| send_req(url_boot())>
"Set all machines to boot into the OS"
</Button>
<Button color=ButtonColor::Success on_click=move |_| send_req(url_restart())>
"Restart all machines"
</Button>
<Button color=ButtonColor::Primary on_click=move |_| send_req(url_cancel())>
"Set all machines to wait for next command"
</Button>
Expand Down