mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
tests: Use ch-remote to add/remove devices in test_vfio
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
5c3ce9dd00
commit
abccf766ce
@@ -172,6 +172,7 @@ sudo setcap cap_net_admin+ep target/release/vhost_user_net
|
|||||||
|
|
||||||
# We always copy a fresh version of our binary for our L2 guest.
|
# We always copy a fresh version of our binary for our L2 guest.
|
||||||
cp target/release/cloud-hypervisor $VFIO_DIR
|
cp target/release/cloud-hypervisor $VFIO_DIR
|
||||||
|
cp target/release/ch-remote $VFIO_DIR
|
||||||
|
|
||||||
# Enable KSM with some reasonable parameters so that it won't take too long
|
# Enable KSM with some reasonable parameters so that it won't take too long
|
||||||
# for the memory to be merged between two processes.
|
# for the memory to be merged between two processes.
|
||||||
|
|||||||
+7
-12
@@ -2407,13 +2407,11 @@ mod tests {
|
|||||||
guest
|
guest
|
||||||
.ssh_command_l1("echo 1af4 1041 | sudo tee /sys/bus/pci/drivers/vfio-pci/new_id")?;
|
.ssh_command_l1("echo 1af4 1041 | sudo tee /sys/bus/pci/drivers/vfio-pci/new_id")?;
|
||||||
guest.ssh_command_l1(
|
guest.ssh_command_l1(
|
||||||
"sudo curl \
|
"sudo /mnt/ch-remote \
|
||||||
--unix-socket /tmp/ch_api.sock \
|
--api-socket=/tmp/ch_api.sock \
|
||||||
-i \
|
add-device path=/sys/bus/pci/devices/0000:00:07.0,id=vfio123",
|
||||||
-X PUT http://localhost/api/v1/vm.add-device \
|
|
||||||
-H 'Accept: application/json' -H 'Content-Type: application/json' \
|
|
||||||
-d '{\"path\":\"/sys/bus/pci/devices/0000:00:07.0\",\"id\":\"vfio123\"}'",
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
thread::sleep(std::time::Duration::new(10, 0));
|
thread::sleep(std::time::Duration::new(10, 0));
|
||||||
|
|
||||||
// Let's also verify from the third virtio-net device passed to
|
// Let's also verify from the third virtio-net device passed to
|
||||||
@@ -2448,12 +2446,9 @@ mod tests {
|
|||||||
// device through the "remove-device" command responsible for
|
// device through the "remove-device" command responsible for
|
||||||
// unplugging VFIO devices.
|
// unplugging VFIO devices.
|
||||||
guest.ssh_command_l1(
|
guest.ssh_command_l1(
|
||||||
"sudo curl \
|
"sudo /mnt/ch-remote \
|
||||||
--unix-socket /tmp/ch_api.sock \
|
--api-socket=/tmp/ch_api.sock \
|
||||||
-i \
|
remove-device vfio123",
|
||||||
-X PUT http://localhost/api/v1/vm.remove-device \
|
|
||||||
-H 'Accept: application/json' -H 'Content-Type: application/json' \
|
|
||||||
-d '{\"id\":\"vfio123\"}'",
|
|
||||||
)?;
|
)?;
|
||||||
thread::sleep(std::time::Duration::new(10, 0));
|
thread::sleep(std::time::Duration::new(10, 0));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user