(&self, vm_config: String)
| 211 | } |
| 212 | |
| 213 | async fn vm_create(&self, vm_config: String) -> Result<()> { |
| 214 | let api_sender = self.clone_api_sender().await; |
| 215 | let api_notifier = self.clone_api_notifier()?; |
| 216 | |
| 217 | let mut vm_config: Box<VmConfig> = serde_json::from_str(&vm_config).map_err(api_error)?; |
| 218 | |
| 219 | if let Some(ref mut nets) = vm_config.net { |
| 220 | if nets.iter().any(|net| net.fds.is_some()) { |
| 221 | warn!("Ignoring FDs sent via the D-Bus request body"); |
| 222 | } |
| 223 | for net in nets { |
| 224 | net.fds = None; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | blocking::unblock(move || VmCreate.send(api_notifier, api_sender, vm_config)) |
| 229 | .await |
| 230 | .map_err(api_error)?; |
| 231 | |
| 232 | Ok(()) |
| 233 | } |
| 234 | |
| 235 | async fn vm_delete(&self) -> Result<()> { |
| 236 | self.vm_action(&VmDelete, ()).await.map(|_| ()) |
no test coverage detected