mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
ci: Extend VFIO test with memory hotplug
One more time, we're extending the VFIO integration test to verify that a VFIO device passed through a VM is still usable after some new memory has been hotplugged. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -692,6 +692,14 @@ mod tests {
|
||||
.map_err(Error::Parsing)?)
|
||||
}
|
||||
|
||||
fn get_total_memory_l2(&self) -> Result<u32, Error> {
|
||||
Ok(self
|
||||
.ssh_command_l2_1("grep MemTotal /proc/meminfo | grep -o \"[0-9]*\"")?
|
||||
.trim()
|
||||
.parse()
|
||||
.map_err(Error::Parsing)?)
|
||||
}
|
||||
|
||||
fn get_entropy(&self) -> Result<u32, Error> {
|
||||
Ok(self
|
||||
.ssh_command("cat /proc/sys/kernel/random/entropy_avail")?
|
||||
@@ -2445,7 +2453,7 @@ mod tests {
|
||||
|
||||
let mut child = GuestCommand::new(&guest)
|
||||
.args(&["--cpus", "boot=4"])
|
||||
.args(&["--memory", "size=1G,file=/dev/hugepages"])
|
||||
.args(&["--memory", "size=2G,file=/dev/hugepages"])
|
||||
.args(&["--kernel", kernel_path.to_str().unwrap()])
|
||||
.default_disks()
|
||||
.args(&[
|
||||
@@ -2597,6 +2605,27 @@ mod tests {
|
||||
7,
|
||||
);
|
||||
|
||||
// Perform memory hotplug in L2 and validate the memory is showing
|
||||
// up as expected. In order to check, we will use the virtio-net
|
||||
// device already passed through L2 as a VFIO device, this will
|
||||
// verify that VFIO devices are functional with memory hotplug.
|
||||
aver!(
|
||||
tb,
|
||||
guest.get_total_memory_l2().unwrap_or_default() > 491_000
|
||||
);
|
||||
guest.ssh_command_l2_1(
|
||||
"sudo bash -c 'echo online > /sys/devices/system/memory/auto_online_blocks'",
|
||||
)?;
|
||||
guest.ssh_command_l1(
|
||||
"sudo /mnt/ch-remote \
|
||||
--api-socket=/tmp/ch_api.sock \
|
||||
resize --memory=1073741824",
|
||||
)?;
|
||||
aver!(
|
||||
tb,
|
||||
guest.get_total_memory_l2().unwrap_or_default() > 982_000
|
||||
);
|
||||
|
||||
let _ = child.kill();
|
||||
let _ = daemon_child.kill();
|
||||
let _ = child.wait();
|
||||
|
||||
Reference in New Issue
Block a user