runtime-rs: hypervisor: add selinux_label parameter stubs to CH, Dragonball, Firecracker, and Remote

Introduce a  parameter stub for the  API in the following hypervisor backends. The actual SELinux enforcement logic is not implemented yet and will be added in subsequent commits.

- ch (): add  stub
- dragonball (): add  stub
- firecracker (): add  stub
- remote (): add  stub

Signed-off-by: Caspian443 <scrisis843@gmail.com>
This commit is contained in:
Caspian443
2025-07-22 16:26:27 +08:00
parent 94cb807891
commit 3d326df628
9 changed files with 14 additions and 8 deletions

View File

@@ -531,7 +531,7 @@ impl CloudHypervisorInner {
Ok(())
}
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>, _selinux_label: Option<String>) -> Result<()> {
self.id = id.to_string();
self.state = VmmState::NotReady;

View File

@@ -65,9 +65,10 @@ impl Hypervisor for CloudHypervisor {
id: &str,
netns: Option<String>,
_annotations: &HashMap<String, String>,
selinux_label: Option<String>,
) -> Result<()> {
let mut inner = self.inner.write().await;
inner.prepare_vm(id, netns).await
inner.prepare_vm(id, netns, selinux_label).await
}
async fn start_vm(&self, timeout: i32) -> Result<()> {

View File

@@ -19,7 +19,7 @@ use crate::{
};
impl DragonballInner {
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>, _selinux_label: Option<String>) -> Result<()> {
self.id = id.to_string();
self.state = VmmState::NotReady;

View File

@@ -75,9 +75,10 @@ impl Hypervisor for Dragonball {
id: &str,
netns: Option<String>,
_annotations: &HashMap<String, String>,
selinux_label: Option<String>,
) -> Result<()> {
let mut inner = self.inner.write().await;
inner.prepare_vm(id, netns).await
inner.prepare_vm(id, netns, selinux_label).await
}
#[instrument]

View File

@@ -19,7 +19,7 @@ pub const ROOT: &str = "root";
const HYBRID_VSOCK_SCHEME: &str = "hvsock";
impl FcInner {
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>, _selinux_label: Option<String>) -> Result<()> {
debug!(sl(), "Preparing Firecracker");
self.id = id.to_string();

View File

@@ -64,9 +64,10 @@ impl Hypervisor for Firecracker {
id: &str,
netns: Option<String>,
_annotations: &HashMap<String, String>,
selinux_label: Option<String>,
) -> Result<()> {
let mut inner = self.inner.write().await;
inner.prepare_vm(id, netns).await
inner.prepare_vm(id, netns, selinux_label).await
}
async fn start_vm(&self, timeout: i32) -> Result<()> {

View File

@@ -58,9 +58,10 @@ impl Hypervisor for Qemu {
id: &str,
netns: Option<String>,
_annotations: &HashMap<String, String>,
selinux_label: Option<String>,
) -> Result<()> {
let mut inner = self.inner.write().await;
inner.prepare_vm(id, netns).await
inner.prepare_vm(id, netns, selinux_label).await
}
async fn start_vm(&self, timeout: i32) -> Result<()> {

View File

@@ -141,6 +141,7 @@ impl RemoteInner {
id: &str,
netns: Option<String>,
annotations: &HashMap<String, String>,
_selinux_label: Option<String>,
) -> Result<()> {
info!(sl!(), "Preparing REMOTE VM");
self.id = id.to_string();

View File

@@ -48,9 +48,10 @@ impl Hypervisor for Remote {
id: &str,
netns: Option<String>,
annotations: &HashMap<String, String>,
_selinux_label: Option<String>,
) -> Result<()> {
let mut inner = self.inner.write().await;
inner.prepare_vm(id, netns, annotations).await
inner.prepare_vm(id, netns, annotations, _selinux_label).await
}
async fn start_vm(&self, timeout: i32) -> Result<()> {