mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 16:36:38 +00:00
runtime-rs: add a new netns field in struct QemuInner.
We need add a new netns field in struct QemuInner, and initialize it with argument passed down in prepare_vm(). Fixes: #8865 Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -34,6 +34,7 @@ pub struct QemuInner {
|
||||
|
||||
config: HypervisorConfig,
|
||||
devices: Vec<DeviceType>,
|
||||
netns: Option<String>,
|
||||
}
|
||||
|
||||
impl QemuInner {
|
||||
@@ -43,12 +44,14 @@ impl QemuInner {
|
||||
qemu_process: None,
|
||||
config: Default::default(),
|
||||
devices: Vec::new(),
|
||||
netns: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn prepare_vm(&mut self, id: &str, _netns: Option<String>) -> Result<()> {
|
||||
pub(crate) async fn prepare_vm(&mut self, id: &str, netns: Option<String>) -> Result<()> {
|
||||
info!(sl!(), "Preparing QEMU VM");
|
||||
self.id = id.to_string();
|
||||
self.netns = netns;
|
||||
|
||||
let vm_path = [KATA_PATH, self.id.as_str()].join("/");
|
||||
std::fs::create_dir_all(vm_path)?;
|
||||
@@ -357,6 +360,7 @@ impl Persist for QemuInner {
|
||||
qemu_process: None,
|
||||
config: hypervisor_state.config,
|
||||
devices: Vec::new(),
|
||||
netns: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user