Can get domains screenshots
This commit is contained in:
@ -130,3 +130,17 @@ pub async fn resume(client: LibVirtReq, id: web::Path<SingleVMUUidReq>) -> HttpR
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Take a screenshot of a VM
|
||||
pub async fn screenshot(client: LibVirtReq, id: web::Path<SingleVMUUidReq>) -> HttpResult {
|
||||
Ok(match client.screenshot_domain(id.uid).await {
|
||||
Ok(b) => HttpResponse::Ok().content_type("image/png").body(b),
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
"Failed to take the screenshot of a domain {:?} ! {e}",
|
||||
id.uid
|
||||
);
|
||||
HttpResponse::InternalServerError().json("Failed to take the screenshot of the domain!")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user