Can enable autostart of VMs
This commit is contained in:
@ -90,6 +90,28 @@ pub async fn update(
|
||||
Ok(HttpResponse::Ok().finish())
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
pub struct VMAutostart {
|
||||
autostart: bool,
|
||||
}
|
||||
|
||||
/// Get autostart value of a vm
|
||||
pub async fn get_autostart(client: LibVirtReq, id: web::Path<SingleVMUUidReq>) -> HttpResult {
|
||||
Ok(HttpResponse::Ok().json(VMAutostart {
|
||||
autostart: client.is_domain_autostart(id.uid).await?,
|
||||
}))
|
||||
}
|
||||
|
||||
/// Configure autostart value for a vm
|
||||
pub async fn set_autostart(
|
||||
client: LibVirtReq,
|
||||
id: web::Path<SingleVMUUidReq>,
|
||||
body: web::Json<VMAutostart>,
|
||||
) -> HttpResult {
|
||||
client.set_domain_autostart(id.uid, body.autostart).await?;
|
||||
Ok(HttpResponse::Accepted().json("OK"))
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct DeleteVMQuery {
|
||||
keep_files: bool,
|
||||
|
Reference in New Issue
Block a user