From 5115ad6e566e6b411e605bc421b71aa5d1c5dde1 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 30 Apr 2020 13:43:11 +0100 Subject: [PATCH] vmm: config: Support on/off/true/false for all booleans Migrate missing boolean controls over to the Toggle to handle all values. Fixes: #936 Signed-off-by: Rob Bradford --- vmm/src/config.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/vmm/src/config.rs b/vmm/src/config.rs index fb6d356d1..e9c0a7854 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -644,18 +644,21 @@ impl DiskConfig { .map_err(Error::ParseDisk)? .unwrap_or_else(default_diskconfig_num_queues); let vhost_user = parser - .convert("vhost_user") + .convert::("vhost_user") .map_err(Error::ParseDisk)? - .unwrap_or(false); + .unwrap_or(Toggle(false)) + .0; let vhost_socket = parser.get("socket"); let wce = parser - .convert("wce") + .convert::("wce") .map_err(Error::ParseDisk)? - .unwrap_or_else(default_diskconfig_wce); + .unwrap_or_else(|| Toggle(default_diskconfig_wce())) + .0; let poll_queue = parser - .convert("poll_queue") + .convert::("poll_queue") .map_err(Error::ParseDisk)? - .unwrap_or_else(default_diskconfig_poll_queue); + .unwrap_or_else(|| Toggle(default_diskconfig_poll_queue())) + .0; let id = parser.get("id"); if parser.is_set("wce") && !vhost_user { @@ -795,9 +798,10 @@ impl NetConfig { .map_err(Error::ParseNetwork)? .unwrap_or_else(default_netconfig_num_queues); let vhost_user = parser - .convert("vhost_user") + .convert::("vhost_user") .map_err(Error::ParseNetwork)? - .unwrap_or(false); + .unwrap_or(Toggle(false)) + .0; let vhost_socket = parser.get("socket"); let id = parser.get("id");