Can get domains list
This commit is contained in:
@ -59,6 +59,26 @@ impl Handler<GetHypervisorInfo> for LibVirtActor {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Message)]
|
||||
#[rtype(result = "anyhow::Result<Vec<DomainXMLUuid>>")]
|
||||
pub struct GetDomainsListReq;
|
||||
|
||||
impl Handler<GetDomainsListReq> for LibVirtActor {
|
||||
type Result = anyhow::Result<Vec<DomainXMLUuid>>;
|
||||
|
||||
fn handle(&mut self, _msg: GetDomainsListReq, _ctx: &mut Self::Context) -> Self::Result {
|
||||
log::debug!("Get full list of domains");
|
||||
let domains = self.m.list_all_domains(0)?;
|
||||
let mut ids = Vec::with_capacity(domains.len());
|
||||
|
||||
for d in domains {
|
||||
ids.push(DomainXMLUuid::parse_from_str(&d.get_uuid_string()?)?);
|
||||
}
|
||||
|
||||
Ok(ids)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Message)]
|
||||
#[rtype(result = "anyhow::Result<DomainXML>")]
|
||||
pub struct GetDomainXMLReq(pub DomainXMLUuid);
|
||||
|
Reference in New Issue
Block a user