Add additional info about VMs

This commit is contained in:
Pierre HUBERT 2024-05-03 21:11:02 +02:00
parent 14c95ac4f7
commit 2fefdb97be
2 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,9 @@ pub struct VMInfoAndCaps {
uiid: VMUuid, uiid: VMUuid,
name: String, name: String,
description: Option<String>, description: Option<String>,
architecture: String,
memory: usize,
number_vcpu: usize,
can_get_state: bool, can_get_state: bool,
can_start: bool, can_start: bool,
can_shutdown: bool, can_shutdown: bool,
@ -33,6 +36,9 @@ pub async fn list() -> HttpResult {
uiid: vm_info.uuid, uiid: vm_info.uuid,
name: vm_info.name, name: vm_info.name,
description: vm_info.description.clone(), description: vm_info.description.clone(),
architecture: vm_info.architecture.to_string(),
memory: vm_info.memory,
number_vcpu: vm_info.number_vcpu,
can_get_state: rights.is_route_allowed("GET", &v.route_state()), can_get_state: rights.is_route_allowed("GET", &v.route_state()),
can_start: rights.is_route_allowed("GET", &v.route_start()), can_start: rights.is_route_allowed("GET", &v.route_start()),
can_shutdown: rights.is_route_allowed("GET", &v.route_shutdown()), can_shutdown: rights.is_route_allowed("GET", &v.route_shutdown()),

View File

@ -74,6 +74,9 @@ pub struct VMInfo {
pub uuid: VMUuid, pub uuid: VMUuid,
pub name: String, pub name: String,
pub description: Option<String>, pub description: Option<String>,
pub architecture: String,
pub memory: usize,
pub number_vcpu: usize,
} }
#[derive(serde::Deserialize, serde::Serialize, Debug)] #[derive(serde::Deserialize, serde::Serialize, Debug)]