// expects: node_id, hostname, model
$known_actions []= "attach-pcu";
// expects: node_id, pcu_id, port (pcu_id <0 means detach)
+$known_actions []= "reboot-node-with-pcu";
+// expects: node_id
//////////////////////////////////////// interfaces
$known_actions []= "delete-interfaces";
plc_redirect(l_node($node_id));
break;
}
+
+ case 'reboot-node-with-pcu': {
+ $node_id=intval($_POST['node_id']);
+ $hostname= $_POST['hostname'];
+
+ $ret = $api->RebootNodeWithPCU( $node_id );
+ $error= $api->error();
+
+ if( empty( $error ) ) {
+ drupal_set_message("Reboot node $hostname: $ret");
+ plc_redirect(l_node($node_id));
+ } else {
+ drupal_set_error($error);
+ }
+ break;
+ }
//////////////////////////////////////////////////////////// interfaces
$details->form_end();
if ($privileges) $details->space();
+$display_reboot_button = FALSE;
////////////////////
// PCU stuff - not too sure why, but GetPCUs is not exposed to the 'user' role
$display_pcus = ( $local_peer && (plc_is_admin() || plc_is_pi() || plc_is_tech()));
$port=$ports[0];
$pcu_columns = array('hostname');
$pcu=search_pcu($site_pcus,$pcu_id);
- if ( ! $pcu )
+ if ( ! $pcu ) {
$pcu_string = plc_error_html("Cannot find PCU " . $pcu_id);
- // else : regular case - don't set pcu_string
+ } else {
+ // else : regular case - don't set pcu_string
+ // NOTE: temporarily only offer the reboot_button for DC7x00, DRAC, and HPiLO PCU models
+ if ( $pcu['model'] == "IntelAMT" || $pcu['model'] == "DRAC" || $pcu['model'] == "HPiLO" ){
+ $display_reboot_button = TRUE;
+ }
+ }
} else
$pcu_string = plc_warning_html("More than one PCU attached ? ");
$details->th_td("PCU",$pcu_value_area);
$details->form_end();
- $details->space();
}
+//////////////////// Reboot Node
+if ( $display_reboot_button )
+{
+ $details->form_start(l_actions(),array("action"=>"reboot-node-with-pcu", "node_id"=>$node_id, "hostname"=>$hostname));
+ $details->tr_submit("submit", "Reboot Node");
+ $details->form_end();
+ //if ($privileges) $details->space();
+}
+$details->space();
+
//////////////////// type & version
$details->th_td("Type",$node_type);
$details->th_td("Version",$version);