We only have one place where we use it, so add the global flag inline,
instead of collecting and doing it at the end. This makes it consistent
with our other places where we need '-global' flags.

Adapt the tests, since that global flag changes place, the resulting
qemu hardware should be identical, since qemu handles all global flags
at the same time.

Tested live migration of a vm with such a flag from an old node to new
and it worked without problems.

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
Reviewed-by: Fiona Ebner <f.eb...@proxmox.com>
---
no changes
 PVE/QemuServer.pm                                     | 5 ++---
 test/cfg2cmd/custom-cpu-model-host-phys-bits.conf.cmd | 4 ++--
 test/cfg2cmd/custom-cpu-model.conf.cmd                | 4 ++--
 test/cfg2cmd/i440fx-win10-hostpci.conf.cmd            | 4 ++--
 test/cfg2cmd/q35-win10-hostpci.conf.cmd               | 4 ++--
 test/cfg2cmd/q35-windows-pinning.conf.cmd             | 4 ++--
 test/cfg2cmd/spice-win.conf.cmd                       | 4 ++--
 7 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 96786a96..366c83b9 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3441,7 +3441,7 @@ sub config_to_command {
        $conf = $newconf;
     }
 
-    my ($globalFlags, $machineFlags, $rtcFlags) = ([], [], []);
+    my ($machineFlags, $rtcFlags) = ([], []);
     my $devices = [];
     my $bridges = {};
     my $ostype = $conf->{ostype};
@@ -3726,7 +3726,7 @@ sub config_to_command {
     }
 
     if ($winversion >= 6) {
-       push @$globalFlags, 'kvm-pit.lost_tick_policy=discard';
+       push $cmd->@*, '-global', 'kvm-pit.lost_tick_policy=discard';
        push @$machineFlags, 'hpet=off';
     }
 
@@ -4038,7 +4038,6 @@ sub config_to_command {
     push @$cmd, @$devices;
     push @$cmd, '-rtc', join(',', @$rtcFlags) if scalar(@$rtcFlags);
     push @$cmd, '-machine', join(',', @$machineFlags) if 
scalar(@$machineFlags);
-    push @$cmd, '-global', join(',', @$globalFlags) if scalar(@$globalFlags);
 
     if (my $vmstate = $conf->{vmstate}) {
        my $statepath = PVE::Storage::path($storecfg, $vmstate);
diff --git a/test/cfg2cmd/custom-cpu-model-host-phys-bits.conf.cmd 
b/test/cfg2cmd/custom-cpu-model-host-phys-bits.conf.cmd
index 077437d2..cbb3e125 100644
--- a/test/cfg2cmd/custom-cpu-model-host-phys-bits.conf.cmd
+++ b/test/cfg2cmd/custom-cpu-model-host-phys-bits.conf.cmd
@@ -13,6 +13,7 @@
   -nodefaults \
   -boot 
'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg'
 \
   -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -global 'kvm-pit.lost_tick_policy=discard' \
   -cpu 
'athlon,+aes,+avx,enforce,hv_ipi,hv_relaxed,hv_reset,hv_runtime,hv_spinlocks=0x1fff,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vendor_id=testvend,hv_vpindex,+kvm_pv_eoi,-kvm_pv_unhalt,vendor=AuthenticAMD,host-phys-bits=true'
 \
   -m 512 \
   -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \
@@ -23,5 +24,4 @@
   -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \
   -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
   -rtc 'driftfix=slew,base=localtime' \
-  -machine 'hpet=off,type=pc-i440fx-5.1+pve0' \
-  -global 'kvm-pit.lost_tick_policy=discard'
+  -machine 'hpet=off,type=pc-i440fx-5.1+pve0'
diff --git a/test/cfg2cmd/custom-cpu-model.conf.cmd 
b/test/cfg2cmd/custom-cpu-model.conf.cmd
index 5a9daed8..3393441e 100644
--- a/test/cfg2cmd/custom-cpu-model.conf.cmd
+++ b/test/cfg2cmd/custom-cpu-model.conf.cmd
@@ -13,6 +13,7 @@
   -nodefaults \
   -boot 
'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg'
 \
   -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -global 'kvm-pit.lost_tick_policy=discard' \
   -cpu 
'athlon,+aes,+avx,enforce,hv_ipi,hv_relaxed,hv_reset,hv_runtime,hv_spinlocks=0x1fff,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vendor_id=testvend,hv_vpindex,+kvm_pv_eoi,-kvm_pv_unhalt,vendor=AuthenticAMD,+virt-ssbd,phys-bits=40'
 \
   -m 512 \
   -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \
@@ -23,5 +24,4 @@
   -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \
   -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
   -rtc 'driftfix=slew,base=localtime' \
-  -machine 'hpet=off,type=pc-i440fx-5.1+pve0' \
-  -global 'kvm-pit.lost_tick_policy=discard'
+  -machine 'hpet=off,type=pc-i440fx-5.1+pve0'
diff --git a/test/cfg2cmd/i440fx-win10-hostpci.conf.cmd 
b/test/cfg2cmd/i440fx-win10-hostpci.conf.cmd
index 455c898d..06f2f7dd 100644
--- a/test/cfg2cmd/i440fx-win10-hostpci.conf.cmd
+++ b/test/cfg2cmd/i440fx-win10-hostpci.conf.cmd
@@ -15,6 +15,7 @@
   -nodefaults \
   -boot 
'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg'
 \
   -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -global 'kvm-pit.lost_tick_policy=discard' \
   -cpu 
'kvm64,enforce,hv_ipi,hv_relaxed,hv_reset,hv_runtime,hv_spinlocks=0x1fff,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vpindex,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep'
 \
   -m 512 \
   -object 'memory-backend-ram,id=ram-node0,size=256M' \
@@ -33,5 +34,4 @@
   -netdev 
'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on'
 \
   -device 
'virtio-net-pci,mac=2E:01:68:F9:9C:87,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'
 \
   -rtc 'driftfix=slew,base=localtime' \
-  -machine 'hpet=off,type=pc-i440fx-5.1+pve0' \
-  -global 'kvm-pit.lost_tick_policy=discard'
+  -machine 'hpet=off,type=pc-i440fx-5.1+pve0'
diff --git a/test/cfg2cmd/q35-win10-hostpci.conf.cmd 
b/test/cfg2cmd/q35-win10-hostpci.conf.cmd
index cf03989b..4f04b76e 100644
--- a/test/cfg2cmd/q35-win10-hostpci.conf.cmd
+++ b/test/cfg2cmd/q35-win10-hostpci.conf.cmd
@@ -15,6 +15,7 @@
   -nodefaults \
   -boot 
'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg'
 \
   -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -global 'kvm-pit.lost_tick_policy=discard' \
   -cpu 
'kvm64,enforce,hv_ipi,hv_relaxed,hv_reset,hv_runtime,hv_spinlocks=0x1fff,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vpindex,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep'
 \
   -m 512 \
   -object 'memory-backend-ram,id=ram-node0,size=256M' \
@@ -34,5 +35,4 @@
   -netdev 
'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on'
 \
   -device 
'virtio-net-pci,mac=2E:01:68:F9:9C:87,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'
 \
   -rtc 'driftfix=slew,base=localtime' \
-  -machine 'hpet=off,type=pc-q35-5.1+pve0' \
-  -global 'kvm-pit.lost_tick_policy=discard'
+  -machine 'hpet=off,type=pc-q35-5.1+pve0'
diff --git a/test/cfg2cmd/q35-windows-pinning.conf.cmd 
b/test/cfg2cmd/q35-windows-pinning.conf.cmd
index d8570b2c..31a01818 100644
--- a/test/cfg2cmd/q35-windows-pinning.conf.cmd
+++ b/test/cfg2cmd/q35-windows-pinning.conf.cmd
@@ -12,6 +12,7 @@
   -nodefaults \
   -boot 
'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg'
 \
   -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -global 'kvm-pit.lost_tick_policy=discard' \
   -cpu 
'kvm64,enforce,hv_ipi,hv_relaxed,hv_reset,hv_runtime,hv_spinlocks=0x1fff,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vpindex,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep'
 \
   -m 512 \
   -readconfig /usr/share/qemu-server/pve-q35-4.0.cfg \
@@ -20,5 +21,4 @@
   -device 
'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
   -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
   -rtc 'driftfix=slew,base=localtime' \
-  -machine 'hpet=off,type=pc-q35-9.2+pve0' \
-  -global 'kvm-pit.lost_tick_policy=discard'
+  -machine 'hpet=off,type=pc-q35-9.2+pve0'
diff --git a/test/cfg2cmd/spice-win.conf.cmd b/test/cfg2cmd/spice-win.conf.cmd
index 7663522e..32dff365 100644
--- a/test/cfg2cmd/spice-win.conf.cmd
+++ b/test/cfg2cmd/spice-win.conf.cmd
@@ -13,6 +13,7 @@
   -nodefaults \
   -boot 
'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg'
 \
   -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -global 'kvm-pit.lost_tick_policy=discard' \
   -cpu 
'kvm64,enforce,hv_ipi,hv_relaxed,hv_reset,hv_runtime,hv_spinlocks=0x1fff,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vpindex,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep'
 \
   -m 768 \
   -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \
@@ -33,5 +34,4 @@
   -netdev 
'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on'
 \
   -device 
'virtio-net-pci,mac=A2:C0:43:77:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'
 \
   -rtc 'driftfix=slew,base=localtime' \
-  -machine 'hpet=off,type=pc-i440fx-4.0+pve0' \
-  -global 'kvm-pit.lost_tick_policy=discard'
+  -machine 'hpet=off,type=pc-i440fx-4.0+pve0'
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to