private void OnCmdRebootInstance(RouterMessage msg) { //Decode arguments and create logger ManagerRebootInstance args = msg.DeserializeAs <ManagerRebootInstance>(); MasterCommandLogger logger = new MasterCommandLogger(msg); //Find instance ManagerInstance instance = session.GetInstanceById(long.Parse(args.instance_id)); if (instance == null) { logger.FinishFail("Could not find that instance on the server."); return; } //Run try { //Shut down instance logger.Log("REBOOT", "Shutting down instance..."); bool graceful = instance.StopInstance(); if (!graceful) { logger.Log("REBOOT", "Instance was shut down forcefully!"); } //Start instance.StartInstance(session); } catch (Exception ex) { logger.FinishFail($"Unexpected error: {ex.Message}{ex.StackTrace}"); } }
public ChannelReader <RouterMessage> RebootInstance(ManagerRebootInstance cmd) { return(SendMessageGetResponseChannelSerialized(MasterConnectionOpcodes.OPCODE_MASTER_REBOOT_INSTANCE, cmd)); }