]> git.proxmox.com Git - qemu-server.git/commitdiff
config2command test: mock kernel_has_vhost_net
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 20 Dec 2018 09:44:13 +0000 (10:44 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 20 Dec 2018 09:44:15 +0000 (10:44 +0100)
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>
PVE/QemuServer.pm
test/run_config2command_tests.pl

index 8b09bcdc5c742da5f15d8b9ed37f76d94852afd8..1ccdccf9410eca194366b0d2ca7be7ca83aa3078 100644 (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";
index 96e67e5d750d32f414c7a6e55d372c5d22f3e2ca..b0cad21d7cee0aacaad56740861e287852fe83ce 100755 (executable)
@@ -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';
     },