vmm: lib: Allow config changes before the VM is booted

Instead of erroring out when trying to change the configuration of the
VM somewhere between the VM was created but not yet booted, let's allow
users to change that without any issue, as long as the VM has already
been created.

Fixes: #3639

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio
2022-01-27 12:05:32 +01:00
committed by Bo Chen
parent b780a916bb
commit 5d2db68f67
2 changed files with 315 additions and 56 deletions

View File

@@ -210,7 +210,7 @@ pub enum ApiResponsePayload {
VmmPing(VmmPingResponse),
/// Vm action response
VmAction(Vec<u8>),
VmAction(Option<Vec<u8>>),
}
/// This is the response sent by the VMM API server through the mpsc channel.
@@ -439,7 +439,7 @@ fn vm_action(
api_evt.write(1).map_err(ApiError::EventFdWrite)?;
let body = match response_receiver.recv().map_err(ApiError::ResponseRecv)?? {
ApiResponsePayload::VmAction(response) => Some(Body::new(response)),
ApiResponsePayload::VmAction(response) => response.map(Body::new),
ApiResponsePayload::Empty => None,
_ => return Err(ApiError::ResponsePayloadType),
};