Can update and delete networks

This commit is contained in:
2023-10-31 12:03:37 +01:00
parent 2025416607
commit 9a99e0b54e
4 changed files with 48 additions and 0 deletions

View File

@ -413,3 +413,18 @@ impl Handler<GetNetworkXMLReq> for LibVirtActor {
Ok(serde_xml_rs::from_str(&xml)?)
}
}
#[derive(Message)]
#[rtype(result = "anyhow::Result<()>")]
pub struct DeleteNetwork(pub XMLUuid);
impl Handler<DeleteNetwork> for LibVirtActor {
type Result = anyhow::Result<()>;
fn handle(&mut self, msg: DeleteNetwork, _ctx: &mut Self::Context) -> Self::Result {
log::debug!("Delete network: {}\n", msg.0.as_string());
let network = Network::lookup_by_uuid_string(&self.m, &msg.0.as_string())?;
network.undefine()?;
Ok(())
}
}