mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-28 12:31:04 +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)?;
|
check_tdx_rootfs_settings(&cfg, &guest_protection_to_use)?;
|
||||||
|
|
||||||
let vsock_socket_path = if n.vsock_socket_path.is_empty() {
|
let vsock_socket_path = n.vsock_socket_path;
|
||||||
return Err(VmConfigError::EmptyVsockSocketPath);
|
|
||||||
} else {
|
|
||||||
n.vsock_socket_path
|
|
||||||
};
|
|
||||||
|
|
||||||
let sandbox_path = if n.sandbox_path.is_empty() {
|
let sandbox_path = if n.sandbox_path.is_empty() {
|
||||||
return Err(VmConfigError::EmptySandboxPath);
|
return Err(VmConfigError::EmptySandboxPath);
|
||||||
@ -1941,7 +1937,7 @@ mod tests {
|
|||||||
let tests = &[
|
let tests = &[
|
||||||
TestData {
|
TestData {
|
||||||
cfg: NamedHypervisorConfig::default(),
|
cfg: NamedHypervisorConfig::default(),
|
||||||
result: Err(VmConfigError::EmptyVsockSocketPath),
|
result: Err(VmConfigError::EmptySandboxPath),
|
||||||
},
|
},
|
||||||
TestData {
|
TestData {
|
||||||
cfg: NamedHypervisorConfig {
|
cfg: NamedHypervisorConfig {
|
||||||
@ -1957,7 +1953,7 @@ mod tests {
|
|||||||
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
result: Err(VmConfigError::EmptyVsockSocketPath),
|
result: Err(VmConfigError::CPUError(CpusConfigError::BootVCPUsTooSmall)),
|
||||||
},
|
},
|
||||||
TestData {
|
TestData {
|
||||||
cfg: NamedHypervisorConfig {
|
cfg: NamedHypervisorConfig {
|
||||||
@ -2018,7 +2014,9 @@ mod tests {
|
|||||||
},
|
},
|
||||||
TestData {
|
TestData {
|
||||||
cfg: named_hypervisor_cfg_with_image_and_kernel_bad_vsock,
|
cfg: named_hypervisor_cfg_with_image_and_kernel_bad_vsock,
|
||||||
result: Err(VmConfigError::EmptyVsockSocketPath),
|
result: Err(VmConfigError::VsockError(
|
||||||
|
VsockConfigError::NoVsockSocketPath,
|
||||||
|
)),
|
||||||
},
|
},
|
||||||
TestData {
|
TestData {
|
||||||
cfg: named_hypervisor_cfg_with_image_and_kernel,
|
cfg: named_hypervisor_cfg_with_image_and_kernel,
|
||||||
|
@ -10,9 +10,6 @@ pub enum VmConfigError {
|
|||||||
#[error("empty sandbox path")]
|
#[error("empty sandbox path")]
|
||||||
EmptySandboxPath,
|
EmptySandboxPath,
|
||||||
|
|
||||||
#[error("empty VSOCK socket path")]
|
|
||||||
EmptyVsockSocketPath,
|
|
||||||
|
|
||||||
#[error("cannot specify image and initrd")]
|
#[error("cannot specify image and initrd")]
|
||||||
MultipleBootFiles,
|
MultipleBootFiles,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user