vmm, main: Support only zero or one vsock devices

The Linux kernel does not support multiple virtio-vsock devices.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2020-04-28 18:10:32 +01:00
committed by Sebastien Boeuf
parent 9d1f95a3cc
commit 10348f73e4
4 changed files with 33 additions and 71 deletions

View File

@@ -199,7 +199,7 @@ fn create_app<'a, 'b>(
"Virtio VSOCK parameters \"cid=<context_id>,sock=<socket_path>,iommu=on|off\"",
)
.takes_value(true)
.min_values(1)
.number_of_values(1)
.group("vm-config"),
)
.arg(
@@ -1435,34 +1435,13 @@ mod unit_tests {
"/path/to/kernel",
"--vsock",
"cid=123,sock=/path/to/sock/1",
"cid=456,sock=/path/to/sock/2",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": [
{"cid": 123, "sock": "/path/to/sock/1"},
{"cid": 456, "sock": "/path/to/sock/2"}
]
"vsock": {"cid": 123, "sock": "/path/to/sock/1"}
}"#,
true,
),
(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--vsock",
"cid=123,sock=/path/to/sock/1",
"cid=456,sock=/path/to/sock/2",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": [
{"cid": 123, "sock": "/path/to/sock/1"}
]
}"#,
false,
),
(
vec![
"cloud-hypervisor",
@@ -1473,9 +1452,7 @@ mod unit_tests {
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": [
{"cid": 123, "sock": "/path/to/sock/1"}
]
"vsock": {"cid": 123, "sock": "/path/to/sock/1"}
}"#,
false,
),
@@ -1489,9 +1466,7 @@ mod unit_tests {
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": [
{"cid": 123, "sock": "/path/to/sock/1", "iommu": true}
],
"vsock": {"cid": 123, "sock": "/path/to/sock/1", "iommu": true},
"iommu": true
}"#,
true,
@@ -1506,9 +1481,7 @@ mod unit_tests {
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": [
{"cid": 123, "sock": "/path/to/sock/1", "iommu": true}
]
"vsock": {"cid": 123, "sock": "/path/to/sock/1", "iommu": true}
}"#,
false,
),
@@ -1522,9 +1495,7 @@ mod unit_tests {
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": [
{"cid": 123, "sock": "/path/to/sock/1", "iommu": false}
]
"vsock": {"cid": 123, "sock": "/path/to/sock/1", "iommu": false}
}"#,
true,
),