Can start a domain

This commit is contained in:
2023-10-10 12:35:43 +02:00
parent 908b0f4c56
commit 0c7128e6eb
6 changed files with 38 additions and 1 deletions

View File

@ -64,3 +64,14 @@ pub async fn get_single(client: LibVirtReq, id: web::Path<SingleVMUUidReq>) -> H
state,
}))
}
/// Start a VM
pub async fn start(client: LibVirtReq, id: web::Path<SingleVMUUidReq>) -> HttpResult {
Ok(match client.start_domain(id.uid).await {
Ok(_) => HttpResponse::Ok().json("Domain started"),
Err(e) => {
log::error!("Failed to start domain {:?} ! {e}", id.uid);
HttpResponse::InternalServerError().json("Failed to start domain!")
}
})
}