Can get the list of groups
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-11-02 17:44:10 +01:00
parent 55b49699eb
commit c908d00c62
5 changed files with 47 additions and 6 deletions

View File

@ -7,8 +7,9 @@ use crate::libvirt_lib_structures::XMLUuid;
use crate::libvirt_rest_structures::hypervisor::HypervisorInfo;
use crate::libvirt_rest_structures::net::NetworkInfo;
use crate::libvirt_rest_structures::nw_filter::NetworkFilter;
use crate::libvirt_rest_structures::vm::VMInfo;
use crate::libvirt_rest_structures::vm::{VMGroupId, VMInfo};
use actix::Addr;
use std::collections::HashSet;
#[derive(Clone)]
pub struct LibVirtClient(pub Addr<LibVirtActor>);
@ -107,6 +108,18 @@ impl LibVirtClient {
.await?
}
/// Get the full list of groups
pub async fn get_full_groups_list(&self) -> anyhow::Result<Vec<VMGroupId>> {
let domains = self.get_full_domains_list().await?;
let mut out = HashSet::new();
for d in domains {
if let Some(g) = VMInfo::from_domain(d)?.group {
out.insert(g);
}
}
Ok(out.into_iter().collect())
}
/// Update a network configuration
pub async fn update_network(
&self,