Automatically backup source network and VM configuration
This commit is contained in:
virtweb_backend/src
@ -1,7 +1,7 @@
|
||||
use crate::actors::libvirt_actor;
|
||||
use crate::actors::libvirt_actor::LibVirtActor;
|
||||
use crate::libvirt_lib_structures::{DomainState, DomainXML, NetworkXML, XMLUuid};
|
||||
use crate::libvirt_rest_structures::HypervisorInfo;
|
||||
use crate::libvirt_rest_structures::{HypervisorInfo, NetworkInfo, VMInfo};
|
||||
use actix::Addr;
|
||||
|
||||
#[derive(Clone)]
|
||||
@ -36,8 +36,10 @@ impl LibVirtClient {
|
||||
}
|
||||
|
||||
/// Update a domain
|
||||
pub async fn update_domain(&self, xml: DomainXML) -> anyhow::Result<XMLUuid> {
|
||||
self.0.send(libvirt_actor::DefineDomainReq(xml)).await?
|
||||
pub async fn update_domain(&self, vm_def: VMInfo, xml: DomainXML) -> anyhow::Result<XMLUuid> {
|
||||
self.0
|
||||
.send(libvirt_actor::DefineDomainReq(vm_def, xml))
|
||||
.await?
|
||||
}
|
||||
|
||||
/// Delete a domain
|
||||
@ -100,8 +102,14 @@ impl LibVirtClient {
|
||||
}
|
||||
|
||||
/// Update a network configuration
|
||||
pub async fn update_network(&self, network: NetworkXML) -> anyhow::Result<XMLUuid> {
|
||||
self.0.send(libvirt_actor::DefineNetwork(network)).await?
|
||||
pub async fn update_network(
|
||||
&self,
|
||||
net_def: NetworkInfo,
|
||||
network: NetworkXML,
|
||||
) -> anyhow::Result<XMLUuid> {
|
||||
self.0
|
||||
.send(libvirt_actor::DefineNetwork(net_def, network))
|
||||
.await?
|
||||
}
|
||||
|
||||
/// Get the full list of networks
|
||||
|
Reference in New Issue
Block a user