mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-04 04:25:45 +00:00
src: Add multiple queue checking in vhost-user-net integration test
Update queue number with 4 to verify if vhost-user-net device and backend could work well with multiple queue. Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
This commit is contained in:
parent
4885dc0ed4
commit
973eb16ae9
35
src/main.rs
35
src/main.rs
@ -2519,16 +2519,17 @@ mod tests {
|
|||||||
.args(&[
|
.args(&[
|
||||||
"--backend",
|
"--backend",
|
||||||
format!(
|
format!(
|
||||||
"ip={},mask=255.255.255.0,sock=/tmp/vunet.sock",
|
"ip={},mask=255.255.255.0,sock=/tmp/vunet.sock,num_queues=4,queue_size=1024",
|
||||||
guest.network.host_ip
|
guest.network.host_ip
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
thread::sleep(std::time::Duration::new(10, 0));
|
||||||
|
|
||||||
let mut cloud_child = Command::new("target/release/cloud-hypervisor")
|
let mut cloud_child = Command::new("target/release/cloud-hypervisor")
|
||||||
.args(&["--cpus", "boot=1"])
|
.args(&["--cpus", "boot=4"])
|
||||||
.args(&["--memory", "size=512M,file=/dev/shm"])
|
.args(&["--memory", "size=512M,file=/dev/shm"])
|
||||||
.args(&["--kernel", guest.fw_path.as_str()])
|
.args(&["--kernel", guest.fw_path.as_str()])
|
||||||
.args(&[
|
.args(&[
|
||||||
@ -2546,11 +2547,16 @@ mod tests {
|
|||||||
])
|
])
|
||||||
.args(&[
|
.args(&[
|
||||||
"--vhost-user-net",
|
"--vhost-user-net",
|
||||||
format!("mac={},sock=/tmp/vunet.sock", guest.network.guest_mac).as_str(),
|
format!(
|
||||||
|
"mac={},sock=/tmp/vunet.sock,num_queues=4,queue_size=1024",
|
||||||
|
guest.network.guest_mac
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
thread::sleep(std::time::Duration::new(10, 0));
|
||||||
// 1 network interface + default localhost ==> 2 interfaces
|
// 1 network interface + default localhost ==> 2 interfaces
|
||||||
// It's important to note that this test is fully exercising the
|
// It's important to note that this test is fully exercising the
|
||||||
// vhost-user-net implementation and the associated backend since
|
// vhost-user-net implementation and the associated backend since
|
||||||
@ -2568,6 +2574,29 @@ mod tests {
|
|||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
|
||||||
|
thread::sleep(std::time::Duration::new(10, 0));
|
||||||
|
|
||||||
|
// The following pci devices will appear on guest with PCI-MSI
|
||||||
|
// interrupt vectors assigned.
|
||||||
|
// 1 virtio-console with 3 vectors: config, Rx, Tx
|
||||||
|
// 1 virtio-blk with 2 vectors: config, Request
|
||||||
|
// 1 virtio-blk with 2 vectors: config, Request
|
||||||
|
// 1 virtio-rng with 2 vectors: config, Request
|
||||||
|
// Since virtio-net has 2 queue pairs, its vectors is as follows:
|
||||||
|
// 1 virtio-net with 5 vectors: config, Rx (2), Tx (2)
|
||||||
|
// Based on the above, the total vectors should 14.
|
||||||
|
aver_eq!(
|
||||||
|
tb,
|
||||||
|
guest
|
||||||
|
.ssh_command("grep -c PCI-MSI /proc/interrupts")
|
||||||
|
.unwrap_or_default()
|
||||||
|
.trim()
|
||||||
|
.parse::<u32>()
|
||||||
|
.unwrap_or_default(),
|
||||||
|
14
|
||||||
|
);
|
||||||
|
|
||||||
|
thread::sleep(std::time::Duration::new(10, 0));
|
||||||
guest.ssh_command("sudo shutdown -h now")?;
|
guest.ssh_command("sudo shutdown -h now")?;
|
||||||
thread::sleep(std::time::Duration::new(5, 0));
|
thread::sleep(std::time::Duration::new(5, 0));
|
||||||
let _ = cloud_child.kill();
|
let _ = cloud_child.kill();
|
||||||
|
Loading…
Reference in New Issue
Block a user