mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Add id option to VFIO hotplug
Add a new id option to the VFIO hotplug command so that it matches the VFIO coldplug semantic. This is done by refactoring the existing code for VFIO hotplug, where VmAddDeviceData structure is replaced by DeviceConfig. This structure is the one used whenever a VFIO device is coldplugged, which is why it makes sense to reuse it for the hotplug codepath. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -36,7 +36,7 @@ pub use self::http::start_http_thread;
|
||||
pub mod http;
|
||||
pub mod http_endpoint;
|
||||
|
||||
use crate::config::VmConfig;
|
||||
use crate::config::{DeviceConfig, VmConfig};
|
||||
use crate::vm::{Error as VmError, VmState};
|
||||
use std::io;
|
||||
use std::sync::mpsc::{channel, RecvError, SendError, Sender};
|
||||
@@ -125,11 +125,6 @@ pub struct VmResizeData {
|
||||
pub desired_ram: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub struct VmAddDeviceData {
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub struct VmRemoveDeviceData {
|
||||
pub id: String,
|
||||
@@ -199,7 +194,7 @@ pub enum ApiRequest {
|
||||
VmResize(Arc<VmResizeData>, Sender<ApiResponse>),
|
||||
|
||||
/// Add a device to the VM.
|
||||
VmAddDevice(Arc<VmAddDeviceData>, Sender<ApiResponse>),
|
||||
VmAddDevice(Arc<DeviceConfig>, Sender<ApiResponse>),
|
||||
|
||||
/// Remove a device from the VM.
|
||||
VmRemoveDevice(Arc<VmRemoveDeviceData>, Sender<ApiResponse>),
|
||||
@@ -359,7 +354,7 @@ pub fn vm_resize(
|
||||
pub fn vm_add_device(
|
||||
api_evt: EventFd,
|
||||
api_sender: Sender<ApiRequest>,
|
||||
data: Arc<VmAddDeviceData>,
|
||||
data: Arc<DeviceConfig>,
|
||||
) -> ApiResult<()> {
|
||||
let (response_sender, response_receiver) = channel();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user