Can get domains list

This commit is contained in:
2023-10-09 19:16:33 +02:00
parent b69c97e6fe
commit 908b0f4c56
4 changed files with 49 additions and 0 deletions

View File

@ -13,6 +13,16 @@ impl LibVirtClient {
self.0.send(libvirt_actor::GetHypervisorInfo).await?
}
/// Get the full list of domain
pub async fn get_full_list(&self) -> anyhow::Result<Vec<DomainXML>> {
let ids = self.0.send(libvirt_actor::GetDomainsListReq).await??;
let mut info = Vec::with_capacity(ids.len());
for id in ids {
info.push(self.get_single_domain(id).await?)
}
Ok(info)
}
/// Get the information about a single domain
pub async fn get_single_domain(&self, id: DomainXMLUuid) -> anyhow::Result<DomainXML> {
self.0.send(libvirt_actor::GetDomainXMLReq(id)).await?