mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-21 19:02:30 +00:00
ci: Rustify ovs-dpdk setup and cleanup
Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
a181b77bc8
commit
2e56f0df77
@ -292,12 +292,8 @@ sudo bash -c "echo 1000000 > /sys/kernel/mm/ksm/pages_to_scan"
|
||||
sudo bash -c "echo 10 > /sys/kernel/mm/ksm/sleep_millisecs"
|
||||
sudo bash -c "echo 1 > /sys/kernel/mm/ksm/run"
|
||||
|
||||
# Setup ovs-dpdk
|
||||
# Setup huge-pages for ovs-dpdk
|
||||
echo 2048 | sudo tee /proc/sys/vm/nr_hugepages
|
||||
service openvswitch-switch start
|
||||
ovs-vsctl init
|
||||
ovs-vsctl set Open_vSwitch . other_config:dpdk-init=true
|
||||
service openvswitch-switch restart
|
||||
|
||||
# Run all direct kernel boot (Device Tree) test cases in mod `parallel`
|
||||
time cargo test $features_test "tests::parallel::$test_filter"
|
||||
|
@ -83,12 +83,6 @@ strip target/$BUILD_TARGET/release/ch-remote
|
||||
echo 6144 | sudo tee /proc/sys/vm/nr_hugepages
|
||||
sudo chmod a+rwX /dev/hugepages
|
||||
|
||||
# Setup ovs-dpdk
|
||||
service openvswitch-switch start
|
||||
ovs-vsctl init
|
||||
ovs-vsctl set Open_vSwitch . other_config:dpdk-init=true
|
||||
service openvswitch-switch restart
|
||||
|
||||
export RUST_BACKTRACE=1
|
||||
time cargo test $features_test "tests::live_migration::$test_filter" -- --test-threads=1
|
||||
RES=$?
|
||||
|
@ -202,12 +202,6 @@ sudo bash -c "echo 1 > /sys/kernel/mm/ksm/run"
|
||||
echo 6144 | sudo tee /proc/sys/vm/nr_hugepages
|
||||
sudo chmod a+rwX /dev/hugepages
|
||||
|
||||
# Setup ovs-dpdk
|
||||
service openvswitch-switch start
|
||||
ovs-vsctl init
|
||||
ovs-vsctl set Open_vSwitch . other_config:dpdk-init=true
|
||||
service openvswitch-switch restart
|
||||
|
||||
export RUST_BACKTRACE=1
|
||||
time cargo test $features_test "tests::parallel::$test_filter"
|
||||
RES=$?
|
||||
|
@ -349,8 +349,17 @@ mod tests {
|
||||
cmd.status().expect("Failed to launch ch-remote").success()
|
||||
}
|
||||
|
||||
// Setup two guests and ensure they are connected through ovs-dpdk
|
||||
fn setup_ovs_dpdk_guests(guest1: &Guest, guest2: &Guest, api_socket: &str) -> (Child, Child) {
|
||||
// setup OVS-DPDK bridge and ports
|
||||
fn setup_ovs_dpdk() {
|
||||
// setup OVS-DPDK
|
||||
assert!(exec_host_command_status("service openvswitch-switch start").success());
|
||||
assert!(exec_host_command_status("ovs-vsctl init").success());
|
||||
assert!(exec_host_command_status(
|
||||
"ovs-vsctl set Open_vSwitch . other_config:dpdk-init=true"
|
||||
)
|
||||
.success());
|
||||
assert!(exec_host_command_status("service openvswitch-switch restart").success());
|
||||
|
||||
// Create OVS-DPDK bridge and ports
|
||||
assert!(exec_host_command_status(
|
||||
"ovs-vsctl add-br ovsbr0 -- set bridge ovsbr0 datapath_type=netdev",
|
||||
@ -360,6 +369,14 @@ mod tests {
|
||||
assert!(exec_host_command_status("ovs-vsctl add-port ovsbr0 vhost-user2 -- set Interface vhost-user2 type=dpdkvhostuserclient options:vhost-server-path=/tmp/dpdkvhostclient2").success());
|
||||
assert!(exec_host_command_status("ip link set up dev ovsbr0").success());
|
||||
assert!(exec_host_command_status("service openvswitch-switch restart").success());
|
||||
}
|
||||
fn cleanup_ovs_dpdk() {
|
||||
assert!(exec_host_command_status("ovs-vsctl del-br ovsbr0").success());
|
||||
exec_host_command_status("rm -f ovs-vsctl /tmp/dpdkvhostclient1 /tmp/dpdkvhostclient2");
|
||||
}
|
||||
// Setup two guests and ensure they are connected through ovs-dpdk
|
||||
fn setup_ovs_dpdk_guests(guest1: &Guest, guest2: &Guest, api_socket: &str) -> (Child, Child) {
|
||||
setup_ovs_dpdk();
|
||||
|
||||
let mut child1 = GuestCommand::new(guest1)
|
||||
.args(&["--cpus", "boot=2"])
|
||||
@ -403,6 +420,8 @@ mod tests {
|
||||
});
|
||||
});
|
||||
if r.is_err() {
|
||||
cleanup_ovs_dpdk();
|
||||
|
||||
let _ = child1.kill();
|
||||
let output = child1.wait_with_output().unwrap();
|
||||
handle_child_output(r, &output);
|
||||
@ -439,6 +458,8 @@ mod tests {
|
||||
guest2.ssh_command("nc -vz 172.100.0.1 12345").unwrap();
|
||||
});
|
||||
if r.is_err() {
|
||||
cleanup_ovs_dpdk();
|
||||
|
||||
let _ = child1.kill();
|
||||
let _ = child2.kill();
|
||||
let output = child2.wait_with_output().unwrap();
|
||||
@ -5543,6 +5564,8 @@ mod tests {
|
||||
guest2.ssh_command("nc -vz 172.100.0.1 12345").unwrap();
|
||||
});
|
||||
|
||||
cleanup_ovs_dpdk();
|
||||
|
||||
let _ = child1.kill();
|
||||
let _ = child2.kill();
|
||||
|
||||
@ -7156,6 +7179,8 @@ mod tests {
|
||||
String::from_utf8_lossy(&ovs_output.stderr)
|
||||
);
|
||||
|
||||
cleanup_ovs_dpdk();
|
||||
|
||||
panic!("Test failed: {}", message)
|
||||
};
|
||||
|
||||
@ -7202,6 +7227,8 @@ mod tests {
|
||||
migration_guest
|
||||
.ssh_command("nc -vz 172.100.0.1 12345")
|
||||
.unwrap();
|
||||
|
||||
cleanup_ovs_dpdk();
|
||||
});
|
||||
|
||||
// Clean-up the destination VM and OVS VM, and make sure they terminated correctly
|
||||
|
Loading…
x
Reference in New Issue
Block a user