mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-12 12:29:11 +00:00
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:
@@ -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;
|
||||
|
||||
|
@@ -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<()> {
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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]
|
||||
|
@@ -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();
|
||||
|
@@ -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<()> {
|
||||
|
@@ -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<()> {
|
||||
|
@@ -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();
|
||||
|
@@ -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<()> {
|
||||
|
Reference in New Issue
Block a user