5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-05 09:17:55 +03:00
Commit Graph

2439 Commits

Author SHA1 Message Date
Stefan Reiter
3ff8500175 qmeventd: add handling for -no-shutdown QEMU instances
We take care of killing QEMU processes when a guest shuts down manually.
QEMU will not exit itself, if started with -no-shutdown, but it will
still emit a "SHUTDOWN" event, which we await and then send SIGTERM.

This additionally allows us to handle backups in such situations. A
vzdump instance will connect to our socket and identify itself as such
in the handshake, sending along a VMID which will be marked as backing
up until the file handle is closed.

When a SHUTDOWN event is received while the VM is backing up, we do not
kill the VM. And when the vzdump handle is closed, we check if the
guest has started up since, and only if it's determined to still be
turned off, we then finally kill QEMU.

We cannot wait for QEMU directly to finish the backup (i.e. with
query-backup), as that would kill the VM too fast for vzdump to send the
last 'query-backup' to mark the backup as successful and done.

For handling 'query-status' messages sent to QEMU, a state-machine-esque
protocol is implemented into the Client struct (ClientState). This is
necessary, since QMP works asynchronously, and results arrive on the
same channel as events and even the handshake.

For referencing QEMU Clients from vzdump messages, they are kept in a
hash table. This requires linking against glib.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-11-05 11:22:47 +01:00
Fabian Grünbichler
acfc6ef8e0 fix #3113: unbreak drive hotplug
by adding the missing argument (otherwise all the other ones are shifted
one slot to the left, which is of course bogus).

this has been broken since 2018 (d559309), but was only made
visible/caused a failure with the recent changes adding

use strict;
use warnings;

to PVE::QemuServer::PCI

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-11-05 10:29:21 +01:00
Thomas Lamprecht
8c9021cd69 bump version to 6.2-18
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-29 18:23:23 +01:00
Dominik Csapak
edae17185b partially fix #3056: try to cancel backup without uuid
if the 'backup' qmp call itself times out or fails, we still want to
try to cancel the backup, else it can happen that there is still
a backup running even when vzdump thinks it was canceled

qapi docs says that backup cancel always returns success, even
if no backup is running

since we hold a global and a per vm lock for the backup, this should be
ok, since we should not reach this code without that lock

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-10-29 18:19:06 +01:00
Stefan Reiter
acc10e5159 migrate: enable dirty-bitmap migration
We query QEMU if it's safe before enabling it, as on versions without
the necessary patches it not only would be useless, but can actually
lead to hangs.

PBS state is always migrated, as it's a small amount of data anyway, so
we don't need to set a specific flag for it.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-10-29 18:18:02 +01:00
Thomas Lamprecht
31655cbb7f bump version to 6.2-17
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-22 16:09:03 +02:00
Stefan Reiter
4c27b18c08 bootorder: don't print empty 'order=' property
Specifying 'boot: order=' was intended to be used for an empty bootorder
(i.e. no boot devices), but as it turns out our format parser doesn't
like empty '-list' properties if they are nested in a subformat.

Fixing this in JSONSchema sounds like a risky move, so instead just
write 'boot: ' (without 'order=') to indicate an empty bootorder. The
rest of the code handles it just fine, as this was valid before too.

Incidentally also fixes a bug where you couldn't create a new VM without
any disks if no explicit 'boot' property was specified (i.e. a simple
'qm create 100' without any parameters would fail).

Reported-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-10-22 08:47:45 +02:00
Thomas Lamprecht
75127d1996 bump version to 6.2-16
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-19 15:51:54 +02:00
Thomas Lamprecht
2bf945fcb9 tests: make module truthy
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-19 15:33:16 +02:00
Thomas Lamprecht
ce11958aab tests: do not use for-loop for globs
they are rather inefficient for this

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-19 15:32:31 +02:00
Thomas Lamprecht
6ef6d68f6c cloudinit: use normal grep
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-19 15:32:03 +02:00
Thomas Lamprecht
50bbe37787 comment out USB hotplug code
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-19 15:31:38 +02:00
Thomas Lamprecht
808a65b522 fix some FH close
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-19 15:30:53 +02:00
Thomas Lamprecht
41af2dfc25 PCI: use warnings/strict and fix setting $vga from config2command
fixes commit 74c17b7a23 which moved
this code here, but forgot to pass $vga ref, as the module was not
using warning nor strict mode this was not caught..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-16 18:03:32 +02:00
Thomas Lamprecht
f7d1505b0c tree wide cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-16 18:03:32 +02:00
Thomas Lamprecht
009cbf61bc api: factor out common vm_is_paused code in private helper
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-16 17:51:24 +02:00
Thomas Lamprecht
11c601e9ad api: fix conditional variable declaration
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-16 17:51:05 +02:00
Thomas Lamprecht
ca3ac88200 drop legacy __read_avail code
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-16 16:52:29 +02:00
Thomas Lamprecht
e5d611c382 fix various conditionally declared vars
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-16 16:52:11 +02:00
Thomas Lamprecht
d1c1af4b02 tree wide cleanup of s/return undef/return/
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-16 16:20:05 +02:00
Mira Limbeck
d0abc7746a fix clone_disk failing for nonexistent cloudinit disk
After migration or a rollback the cloudinit disk might not be allocated, so
volume_size_info() fails. As we override the value anyway for cloudinit
and efi disks simply move the volume_size_info() call into the 'else'
branch.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2020-10-16 15:39:43 +02:00
Mira Limbeck
f8c4b2c5ba fix VM clone from snapshot with cloudinit disk
All volumes contained in $vollist are activated. In this case a snapshot
of the volume. For cloudinit disks no snapshots are created so don't add
it to the list of volumes to activate as it otherwise fails with no
logical volume found.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2020-10-16 15:39:43 +02:00
Fabian Ebner
32e5405084 fix typos
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-10-16 15:39:13 +02:00
Stefan Reiter
6c4f3e6d15 cfg2cmd: add tests for new boot order property
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-10-14 12:30:50 +02:00
Stefan Reiter
078c109fae api: add handling for new boot order format
The API is updated to handle the deprecation correctly, i.e. when
updating the 'order' attribute, the old 'legacy' (default_key) values
are removed (would now be ignored anyway).

When removing a device that is in the bootorder list, it will be removed
from the aforementioned. Note that non-existing devices in the list will
not cause an error - they will simply be ignored - but it's still nice
to not have them in there.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-10-14 12:30:50 +02:00
Stefan Reiter
2141a802b8 fix #3010: add 'bootorder' parameter for better control of boot devices
(also fixes #3011)

Deprecates the old-style 'boot' and 'bootdisk' options by adding a new
'order=' subproperty to 'boot'.

This allows a user to specify more than one disk in the boot order,
helping with newer versions of SeaBIOS/OVMF where disks without a
bootindex won't be initialized at all (breaks soft-raid and some LVM
setups).

This also allows specifying a bootindex for USB and hostpci devices,
which was not possible before. Floppy boot support is not supported in
the new model, but I doubt that will be a problem (AFAICT we can't even
attach floppy disks to a VM?).

Default behaviour is intended to stay the same, i.e. while new VMs will
receive the new 'order' property, it will be set so the VM starts the
same as before (using get_default_bootorder).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-10-14 12:30:50 +02:00
Stefan Reiter
5cfa9f5f73 add new 'boot' property format and introduce legacy conversion helpers
The format is unused in this commit, but will replace the current
string-based format of the 'boot' property. It is included since the
parameter of bootorder_from_legacy follows it.

Two helper methods are introduced:
* bootorder_from_legacy: Parses the legacy format into a hash closer to
    what the new format represents
* get_default_bootdevices: Encapsulates the legacy default behaviour if
    nothing is specified in the boot order

resolve_first_disk is simplified and gets a new $cdrom parameter to
control the behaviour of excluding CD-ROMs or instead searching for only
them.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-10-14 12:30:50 +02:00
Stefan Reiter
3441a023dd cfg2cmd: add test for legacy-style bootorder
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-10-14 12:30:50 +02:00
Stefan Reiter
d0a86b2425 fix indentation
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-10-14 12:30:50 +02:00
Thomas Lamprecht
dbcc2dbb94 bump version to 6.2-15
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-09-29 17:44:31 +02:00
Thomas Lamprecht
d5b0cfb197 followup: s/verification/validation/ to avoid confusion
We use verification for something more in-depth on the PBS server, so
avoid that term to avoid misunderstandings.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-09-29 17:39:28 +02:00
Stefan Reiter
1eb7e59017 vzdump: log 'finishing' state
...and avoid printing 100% status twice

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-09-29 17:28:15 +02:00
Thomas Lamprecht
460e50689f d/control: update
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-09-08 19:12:36 +02:00
Thomas Lamprecht
4a92ecd882 d/copyright: update
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-09-08 19:01:54 +02:00
Thomas Lamprecht
4df98f2f14 line length and formatting fixes
In accord to updated perl style guide
https://pve.proxmox.com/wiki/Perl_Style_Guide#Breaking_long_lines_and_strings

Mostly try to avoid >100 column lines and update some descriptions
from 80 to 100 column limit, improving readability.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-09-02 14:07:12 +02:00
Thomas Lamprecht
6e5bda530e tests: add cfg2cmd test for virtio-blk disk with iothread on
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-09-02 13:27:27 +02:00
Stefan Reiter
f36e9894ff fix #2570: add 'keephugepages' config
We already keep hugepages if they are created with the kernel
commandline (hugepagesz=x hugepages=y), but some setups (specifically
hugepages across multiple NUMA nodes) cannot be configured that way.
Since we always clear these hugepages at VM shutdown, rebooting a VM
that uses them might not work, since the requested count might not be
available anymore by the time we want to use them (also, we would then
no longer allocate them correctly on the NUMA nodes).

Add a 'keephugepages' parameter to skip cleanup and simply leave them
untouched.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-09-02 12:45:57 +02:00
Thomas Lamprecht
116df99cc6 bump version to 6.2-14
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-24 19:34:27 +02:00
Thomas Lamprecht
5749c38350 vzdump: do not log per disk dirty bitmap state for templates
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-21 14:11:48 +02:00
Fabian Grünbichler
4ef13a7f9a fix #2862: properly backup (all) VM templates
until we maybe have a 'pbs-backup' that links Qemu and PBS like
'pbs-restore', we need to do a regular backup for the template case to
support all storage types and image formats.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-08-21 13:45:55 +02:00
Thomas Lamprecht
3eb2f3eb56 followup cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-21 10:44:00 +02:00
Thomas Lamprecht
1e27bda1aa tests: cfg2cmd: check also warnings
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-21 10:38:27 +02:00
Thomas Lamprecht
90d96715f8 tests: cfg2cmd: get testname earlier
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-21 10:38:08 +02:00
Stoiko Ivanov
b5d32c6be2 print_vga_device: check if bios is defined
Otherwise a warning is printed if the bios is not set in the config.

reported via community forum:
https://forum.proxmox.com/threads/warning-in-qemuserver.74683/

reproduced and tested that the patch fixes the issue.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2020-08-21 10:12:27 +02:00
Stefan Reiter
1ca43f1cde vzdump: show "reused" message even if nothing was transferred
This still works even if all drives were clean. It then shows the very
magical line:

  INFO: backup was done incrementally, reused 34.00 GiB (100%)

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-08-20 15:54:54 +02:00
Stefan Reiter
2790636afd vzdump: allow bandwidth limit for PBS backup too
QEMU handles it just as well as with VMA, so this was probably just
forgotten to implement for PBS.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-08-20 15:54:54 +02:00
Thomas Lamprecht
75f25f44bc bump version to 6.2-13
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-20 11:42:53 +02:00
Thomas Lamprecht
f856671495 vzdump: restore log behavior for VMs running with older QEMU
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-20 10:45:34 +02:00
Thomas Lamprecht
a40295b6aa vdzump: padd percentagde done counter, format duration for humans
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-20 10:25:08 +02:00
Thomas Lamprecht
d35412a32a vzdump: output sparseness again
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-20 10:25:08 +02:00