mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-28 04:21:03 +00:00
runtime-rs: ch: Simplify VSOCK error handling
Remove the redundant `VmConfigError::EmptyVsockSocketPath` error from the Cloud Hypervisor config crate since this scenario is already handled by the `VsockConfigError::NoVsockSocketPath` error. Fixes: #8385. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
bdb83f8282
commit
59d0d4caff
@ -99,11 +99,7 @@ impl TryFrom<NamedHypervisorConfig> for VmConfig {
|
||||
|
||||
check_tdx_rootfs_settings(&cfg, &guest_protection_to_use)?;
|
||||
|
||||
let vsock_socket_path = if n.vsock_socket_path.is_empty() {
|
||||
return Err(VmConfigError::EmptyVsockSocketPath);
|
||||
} else {
|
||||
n.vsock_socket_path
|
||||
};
|
||||
let vsock_socket_path = n.vsock_socket_path;
|
||||
|
||||
let sandbox_path = if n.sandbox_path.is_empty() {
|
||||
return Err(VmConfigError::EmptySandboxPath);
|
||||
@ -1941,7 +1937,7 @@ mod tests {
|
||||
let tests = &[
|
||||
TestData {
|
||||
cfg: NamedHypervisorConfig::default(),
|
||||
result: Err(VmConfigError::EmptyVsockSocketPath),
|
||||
result: Err(VmConfigError::EmptySandboxPath),
|
||||
},
|
||||
TestData {
|
||||
cfg: NamedHypervisorConfig {
|
||||
@ -1957,7 +1953,7 @@ mod tests {
|
||||
|
||||
..Default::default()
|
||||
},
|
||||
result: Err(VmConfigError::EmptyVsockSocketPath),
|
||||
result: Err(VmConfigError::CPUError(CpusConfigError::BootVCPUsTooSmall)),
|
||||
},
|
||||
TestData {
|
||||
cfg: NamedHypervisorConfig {
|
||||
@ -2018,7 +2014,9 @@ mod tests {
|
||||
},
|
||||
TestData {
|
||||
cfg: named_hypervisor_cfg_with_image_and_kernel_bad_vsock,
|
||||
result: Err(VmConfigError::EmptyVsockSocketPath),
|
||||
result: Err(VmConfigError::VsockError(
|
||||
VsockConfigError::NoVsockSocketPath,
|
||||
)),
|
||||
},
|
||||
TestData {
|
||||
cfg: named_hypervisor_cfg_with_image_and_kernel,
|
||||
|
@ -10,9 +10,6 @@ pub enum VmConfigError {
|
||||
#[error("empty sandbox path")]
|
||||
EmptySandboxPath,
|
||||
|
||||
#[error("empty VSOCK socket path")]
|
||||
EmptyVsockSocketPath,
|
||||
|
||||
#[error("cannot specify image and initrd")]
|
||||
MultipleBootFiles,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user