mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-03 11:25:20 +00:00
vmm: For --disk error if socket and path is specified
This is an error as the path should be specfied by the unmanaged backend. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
7e599b4450
commit
4579afa091
@ -653,12 +653,12 @@ mod unit_tests {
|
||||
vec![
|
||||
"cloud-hypervisor",
|
||||
"--disk",
|
||||
"path=/path/to/disk/1,vhost_user=true,socket=/tmp/socket1",
|
||||
"vhost_user=true,socket=/tmp/socket1",
|
||||
"path=/path/to/disk/2",
|
||||
],
|
||||
r#"{
|
||||
"disks": [
|
||||
{"path": "/path/to/disk/1", "vhost_user":true, "vhost_socket":"/tmp/socket1"},
|
||||
{"vhost_user":true, "vhost_socket":"/tmp/socket1"},
|
||||
{"path": "/path/to/disk/2"}
|
||||
]
|
||||
}"#,
|
||||
@ -668,12 +668,12 @@ mod unit_tests {
|
||||
vec![
|
||||
"cloud-hypervisor",
|
||||
"--disk",
|
||||
"path=/path/to/disk/1,vhost_user=true,socket=/tmp/socket1,wce=true",
|
||||
"vhost_user=true,socket=/tmp/socket1,wce=true",
|
||||
"path=/path/to/disk/2",
|
||||
],
|
||||
r#"{
|
||||
"disks": [
|
||||
{"path": "/path/to/disk/1", "vhost_user":true, "vhost_socket":"/tmp/socket1", "wce":true},
|
||||
{"vhost_user":true, "vhost_socket":"/tmp/socket1", "wce":true},
|
||||
{"path": "/path/to/disk/2"}
|
||||
]
|
||||
}"#,
|
||||
|
@ -49,6 +49,8 @@ pub enum Error {
|
||||
ParseDiskVhostParam(std::str::ParseBoolError),
|
||||
/// Failed parsing disk wce parameter.
|
||||
ParseDiskWceParam(std::str::ParseBoolError),
|
||||
/// Both socket and path specified
|
||||
ParseDiskSocketAndPath,
|
||||
/// Failed parsing random number generator parameters.
|
||||
ParseRngParams,
|
||||
/// Failed parsing network ip parameter.
|
||||
@ -453,6 +455,10 @@ impl DiskConfig {
|
||||
path = Some(PathBuf::from(path_str))
|
||||
}
|
||||
|
||||
if vhost_socket.as_ref().and(path.as_ref()).is_some() {
|
||||
return Err(Error::ParseDiskSocketAndPath);
|
||||
}
|
||||
|
||||
Ok(DiskConfig {
|
||||
path,
|
||||
readonly: parse_on_off(readonly_str)?,
|
||||
|
Loading…
Reference in New Issue
Block a user