config2command test: mock kernel_has_vhost_net

just return true for now, the use is guarded by an 'is_native($arch)'
check anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2018-12-20 10:44:13 +01:00
parent e1bdc0debc
commit db70021bcf
2 changed files with 7 additions and 2 deletions

View File

@ -1387,7 +1387,9 @@ sub kvm_user_version {
}
my $kernel_has_vhost_net = -c '/dev/vhost-net';
sub kernel_has_vhost_net {
return -c '/dev/vhost-net';
}
sub valid_drive_names {
# order is important - used to autoselect boot disk
@ -1973,7 +1975,7 @@ sub print_netdev_full {
my $vhostparam = '';
if (is_native($arch)) {
$vhostparam = ',vhost=on' if $kernel_has_vhost_net && $net->{model} eq 'virtio';
$vhostparam = ',vhost=on' if kernel_has_vhost_net() && $net->{model} eq 'virtio';
}
my $vmname = $conf->{name} || "vm$vmid";

View File

@ -110,6 +110,9 @@ $qemu_server_module->mock(
kvm_version => sub {
return $current_test->{qemu_version} // $base_env->{real_qemu_version};
},
kernel_has_vhost_net => sub {
return 1; # TODO: make this per-test configurable?
},
get_host_arch => sub() {
return $current_test->{host_arch} // 'x86_64';
},