mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: config: Check NetConfig::socket set if vhost_user is set
This check was already included in the DiskConfig validation but missing for NetConfig. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -3206,6 +3206,9 @@ impl VmConfig {
|
||||
if net.vhost_user && !self.backed_by_shared_memory() {
|
||||
return Err(ValidationError::VhostUserRequiresSharedMemory);
|
||||
}
|
||||
if net.vhost_user && net.vhost_socket.is_none() {
|
||||
return Err(ValidationError::VhostUserMissingSocket);
|
||||
}
|
||||
if net.vhost_user && net.rate_limiter_config.is_some() {
|
||||
return Err(ValidationError::VhostUserRateLimiterNotSupported);
|
||||
}
|
||||
@@ -5639,6 +5642,17 @@ id=\"{id}\",pci_segment={pci_segment},queue_sizes={queue_sizes}"
|
||||
Err(ValidationError::VhostUserRequiresSharedMemory)
|
||||
);
|
||||
|
||||
let mut invalid_config = valid_config.clone();
|
||||
invalid_config.memory.shared = true;
|
||||
invalid_config.net = Some(vec![NetConfig {
|
||||
vhost_user: true,
|
||||
..net_fixture()
|
||||
}]);
|
||||
assert_eq!(
|
||||
invalid_config.validate(),
|
||||
Err(ValidationError::VhostUserMissingSocket)
|
||||
);
|
||||
|
||||
let mut still_valid_config = valid_config.clone();
|
||||
still_valid_config.net = Some(vec![NetConfig {
|
||||
vhost_user: true,
|
||||
|
||||
Reference in New Issue
Block a user