mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-25 11:13:15 +00:00
Merge pull request #6277 from openanolis/chao/add_is_tdx_enable
CC | Dragonball TDX: add is_tdx_enabled to identify tdx VM type
This commit is contained in:
commit
ad889489a0
@ -83,6 +83,11 @@ impl InstanceInfo {
|
||||
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 {
|
||||
|
@ -350,6 +350,15 @@ impl Vm {
|
||||
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
|
||||
pub fn vm_exit(&self, exit_code: i32) {
|
||||
if let Ok(mut info) = self.shared_info.write() {
|
||||
|
Loading…
Reference in New Issue
Block a user