mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: generic vhost-user: add D-Bus API
Allow adding and removing generic vhost-user devices via D-Bus. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This commit is contained in:
committed by
Rob Bradford
parent
df86b2864b
commit
cfb69c68d2
@@ -22,10 +22,10 @@ use super::{ApiAction, ApiRequest};
|
||||
#[cfg(all(target_arch = "x86_64", feature = "guest_debug"))]
|
||||
use crate::api::VmCoredump;
|
||||
use crate::api::{
|
||||
AddDisk, Body, VmAddDevice, VmAddFs, VmAddNet, VmAddPmem, VmAddUserDevice, VmAddVdpa,
|
||||
VmAddVsock, VmBoot, VmCounters, VmCreate, VmDelete, VmInfo, VmPause, VmPowerButton, VmReboot,
|
||||
VmReceiveMigration, VmRemoveDevice, VmResize, VmResizeZone, VmRestore, VmResume,
|
||||
VmSendMigration, VmShutdown, VmSnapshot, VmmPing, VmmShutdown,
|
||||
AddDisk, Body, VmAddDevice, VmAddFs, VmAddGenericVhostUser, VmAddNet, VmAddPmem,
|
||||
VmAddUserDevice, VmAddVdpa, VmAddVsock, VmBoot, VmCounters, VmCreate, VmDelete, VmInfo,
|
||||
VmPause, VmPowerButton, VmReboot, VmReceiveMigration, VmRemoveDevice, VmResize, VmResizeZone,
|
||||
VmRestore, VmResume, VmSendMigration, VmShutdown, VmSnapshot, VmmPing, VmmShutdown,
|
||||
};
|
||||
use crate::seccomp_filters::{Thread, get_seccomp_filter};
|
||||
use crate::{Error as VmmError, NetConfig, Result as VmmResult, VmConfig};
|
||||
@@ -144,6 +144,16 @@ impl DBusApi {
|
||||
self.vm_action(&VmAddFs, fs_config).await
|
||||
}
|
||||
|
||||
async fn vm_add_generic_vhost_user(
|
||||
&self,
|
||||
generic_vhost_user_config: String,
|
||||
) -> Result<Optional<String>> {
|
||||
let generic_vhost_user_config =
|
||||
serde_json::from_str(&generic_vhost_user_config).map_err(api_error)?;
|
||||
self.vm_action(&VmAddGenericVhostUser, generic_vhost_user_config)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn vm_add_net(&self, net_config: String) -> Result<Optional<String>> {
|
||||
let mut net_config: NetConfig = serde_json::from_str(&net_config).map_err(api_error)?;
|
||||
if net_config.fds.is_some() {
|
||||
|
||||
Reference in New Issue
Block a user