Can start a domain
This commit is contained in:
@ -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!")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user