Can get NW filter source XML definition

This commit is contained in:
2024-01-02 15:52:04 +01:00
parent b4f65a6703
commit 06ddf57b5c
4 changed files with 35 additions and 0 deletions

View File

@ -642,3 +642,21 @@ impl Handler<DeleteNetworkFilter> for LibVirtActor {
Ok(())
}
}
#[derive(Message)]
#[rtype(result = "anyhow::Result<String>")]
pub struct GetSourceNetworkFilterXMLReq(pub XMLUuid);
impl Handler<GetSourceNetworkFilterXMLReq> for LibVirtActor {
type Result = anyhow::Result<String>;
fn handle(
&mut self,
msg: GetSourceNetworkFilterXMLReq,
_ctx: &mut Self::Context,
) -> Self::Result {
log::debug!("Get nw filter source XML:\n{}", msg.0.as_string());
let nwfilter = NWFilter::lookup_by_uuid_string(&self.m, &msg.0.as_string())?;
Ok(nwfilter.get_xml_desc(0)?)
}
}