Can create VM from UI
This commit is contained in:
@ -10,6 +10,11 @@ struct VMInfoAndState {
|
||||
state: DomainState,
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
struct VMUuid {
|
||||
uuid: DomainXMLUuid,
|
||||
}
|
||||
|
||||
/// Create a new VM
|
||||
pub async fn create(client: LibVirtReq, req: web::Json<VMInfo>) -> HttpResult {
|
||||
let domain = match req.0.to_domain() {
|
||||
@ -21,7 +26,7 @@ pub async fn create(client: LibVirtReq, req: web::Json<VMInfo>) -> HttpResult {
|
||||
};
|
||||
let id = client.update_domain(domain).await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(id))
|
||||
Ok(HttpResponse::Ok().json(VMUuid { uuid: id }))
|
||||
}
|
||||
|
||||
/// Get the list of domains
|
||||
|
Reference in New Issue
Block a user