vmm: api: Add a VMM shutdown command

This shuts the current VM down, if any, and then exits the VMM process.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-10-08 15:23:29 +02:00
committed by Sebastien Boeuf
parent 228adebc32
commit a95fa1c4e8
5 changed files with 80 additions and 11 deletions

View File

@@ -5,7 +5,7 @@
extern crate threadpool;
use crate::api::http_endpoint::{VmActionHandler, VmCreate, VmInfo};
use crate::api::http_endpoint::{VmActionHandler, VmCreate, VmInfo, VmmShutdown};
use crate::api::{ApiRequest, VmAction};
use crate::{Error, Result};
use micro_http::{HttpConnection, Request, Response, StatusCode, Version};
@@ -60,6 +60,7 @@ lazy_static! {
r.routes.insert(endpoint!("/vm.info"), Box::new(VmInfo {}));
r.routes.insert(endpoint!("/vm.shutdown"), Box::new(VmActionHandler::new(VmAction::Shutdown)));
r.routes.insert(endpoint!("/vm.reboot"), Box::new(VmActionHandler::new(VmAction::Reboot)));
r.routes.insert(endpoint!("/vmm.shutdown"), Box::new(VmmShutdown {}));
r
};