mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-26 03:29:02 +00:00
Dragonball: add is_tdx_enabled to identify tdx VM type
In order to disable or enable some features when running tdx vms, we need to add is_tdx_enabled() function to identify whether the VM confidiential type is TDX. fixes: #6276 Signed-off-by: fengshifang <fengshifang@linux.alibaba.com> Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
This commit is contained in:
parent
b74e84e123
commit
337f19f0b2
@ -83,6 +83,11 @@ impl InstanceInfo {
|
|||||||
confidential_vm_type: None,
|
confidential_vm_type: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// return true if VM confidential type is TDX
|
||||||
|
pub fn is_tdx_enabled(&self) -> bool {
|
||||||
|
matches!(self.confidential_vm_type, Some(ConfidentialVmType::TDX))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for InstanceInfo {
|
impl Default for InstanceInfo {
|
||||||
|
@ -350,6 +350,15 @@ impl Vm {
|
|||||||
instance_state == InstanceState::Running
|
instance_state == InstanceState::Running
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// return true if VM confidential type is TDX
|
||||||
|
pub fn is_tdx_enabled(&self) -> bool {
|
||||||
|
let shared_info = self
|
||||||
|
.shared_info()
|
||||||
|
.read()
|
||||||
|
.expect("failed to get instance state, because shared info is poisoned lock");
|
||||||
|
shared_info.is_tdx_enabled()
|
||||||
|
}
|
||||||
|
|
||||||
/// Save VM instance exit state
|
/// Save VM instance exit state
|
||||||
pub fn vm_exit(&self, exit_code: i32) {
|
pub fn vm_exit(&self, exit_code: i32) {
|
||||||
if let Ok(mut info) = self.shared_info.write() {
|
if let Ok(mut info) = self.shared_info.write() {
|
||||||
|
Loading…
Reference in New Issue
Block a user