]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
3 years agovzdump: increase PBS 'backup' QMP call timeout
Stefan Reiter [Mon, 8 Mar 2021 15:32:30 +0000 (16:32 +0100)]
vzdump: increase PBS 'backup' QMP call timeout

Commit "a941bbd0 client: raise HTTP_TIMEOUT to 120s" in proxmox-backup
did the same, however, we would now still fail after 60 seconds since
the QMP call would time out.

Increase the timeout here to the same +5 seconds to give some time to
receive a response, so if the HTTP call in proxmox-backup times out, we
can still get a useful error message instead of timing out the QMP call
too.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agobump version to 6.3-6
Thomas Lamprecht [Fri, 5 Mar 2021 20:43:05 +0000 (21:43 +0100)]
bump version to 6.3-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: create_vm: check serial and usb permissions
Fabian Ebner [Fri, 5 Mar 2021 10:29:20 +0000 (11:29 +0100)]
api: create_vm: check serial and usb permissions

The existing check_vm_modify_config_perm doesn't do so anymore, but
the check only got re-added to the modify/delete paths. See commits
165be267ebff3f614cc6b56bbb594ef4d456a4e9 and
e30f75c571a6a678f8f1f3dfb2dee1b622b49185 for context.

In the future, it might make sense to generalise the
check_vm_modify_config_perm and have it not only take keys, but both
new and old values, and use that generalised function everywhere.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoalways pin windows VMs to a machine version by default
Thomas Lamprecht [Fri, 5 Mar 2021 19:46:28 +0000 (20:46 +0100)]
always pin windows VMs to a machine version by default

A fix for violating a important standard for booting[0] in recently
packaged QEMU 5.2 surfaced some issues with Windows based VMs in our
forum[1], which seem to be quite sensitive for such changes (it seems
they derive lots of their device assignment from ACPI).
User visible effects are loss of any network configuration due to
windows thinking it was swapped with a new one, and starts with a
fresh config - this is mostly problematic for setups with static
address assignment.

There may be lots of other, more subtle, effects and the PVE admin is
also not always the VM admin, so we really need to avoid such
negative effects. Do this by pinning the version of any windows based
VMs to either the minimum of (5.1, kvm-version) for existing VMs or
the kvm-version at time of VM creation for new ones.

There are patches in pve-manager for user to be able to change the
pinned version themself in the webinterface, so this can now also get
adapted more easily if there surface any other issues (with new or
old version) in the future.

0: https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg08484.html
1: https://forum.proxmox.com/threads/warning-latest-patch-just-broke-all-my-windows-vms-6-3-4-patch-inside.84915/page-2#post-373331

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoostype schema: win10 is valid for win 2019 server too
Thomas Lamprecht [Fri, 5 Mar 2021 19:45:19 +0000 (20:45 +0100)]
ostype schema: win10 is valid for win 2019 server too

the webinterface shows it like this since quite a while already.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocan_run_pve_machine_version: PVE version can really be optional
Thomas Lamprecht [Fri, 5 Mar 2021 17:49:06 +0000 (18:49 +0100)]
can_run_pve_machine_version: PVE version can really be optional

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: machine list: parse as JSON
Thomas Lamprecht [Fri, 5 Mar 2021 15:33:08 +0000 (16:33 +0100)]
api: machine list: parse as JSON

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: add Machine module to query machine types
Stefan Reiter [Thu, 4 Mar 2021 12:52:05 +0000 (13:52 +0100)]
api: add Machine module to query machine types

The file is provided by pve-qemu-kvm.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix #3301: status: add currently running machine and QEMU version to full status
Fabian Ebner [Mon, 1 Mar 2021 15:53:26 +0000 (16:53 +0100)]
fix #3301: status: add currently running machine and QEMU version to full status

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agomachine: split out helper for handling query-machines qmp command result
Fabian Ebner [Mon, 1 Mar 2021 15:53:25 +0000 (16:53 +0100)]
machine: split out helper for handling query-machines qmp command result

to be re-used in the vmstatus() call.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoconfig: parse: also warn about invalid lines
Fabian Ebner [Wed, 3 Mar 2021 11:01:26 +0000 (12:01 +0100)]
config: parse: also warn about invalid lines

as we already do for containers.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agofix #3324: clone disk: use larger blocksize for EFI disk
Fabian Ebner [Mon, 1 Mar 2021 12:02:23 +0000 (13:02 +0100)]
fix #3324: clone disk: use larger blocksize for EFI disk

Moving to Ceph is very slow when bs=1. Instead, use a larger block size in
combination with the (currently) PVE-specific osize option to specify the
desired output size.

Suggested-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agosnapshot-test: mock query-savevm better
Stefan Reiter [Thu, 18 Feb 2021 13:52:34 +0000 (14:52 +0100)]
snapshot-test: mock query-savevm better

Otherwise the new printing functions produce warnings about undefined
numbers. These stats are guaranteed to be returned by real QEMU, so mock
them with some sensible values.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoAPI: update_vm_api: check for CDROM on disk delete
Aaron Lauterer [Fri, 12 Feb 2021 15:57:50 +0000 (16:57 +0100)]
API: update_vm_api: check for CDROM on disk delete

Since CDRoms and disks share the same config keys, we need to check if
it actually is a CDRom and then check the permissions accordingly.

Otherwise it is possible for someone without VM.Config.CDROM
permissions, but with VM.Config.Disk permissions to remove a CD drive
while being unable to create a CDRom drive.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 years agoqmeventd: fix more early broken lines
Thomas Lamprecht [Fri, 12 Feb 2021 08:52:06 +0000 (09:52 +0100)]
qmeventd: fix more early broken lines

increases readabillity, and up to 100 cc is just fine

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.3-5
Thomas Lamprecht [Thu, 11 Feb 2021 17:05:24 +0000 (18:05 +0100)]
bump version to 6.3-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoqmeventd: fix linker flags order
Thomas Lamprecht [Thu, 11 Feb 2021 17:02:18 +0000 (18:02 +0100)]
qmeventd: fix linker flags order

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoqmeventd: allow up to 100 columns per line
Thomas Lamprecht [Thu, 11 Feb 2021 16:21:23 +0000 (17:21 +0100)]
qmeventd: allow up to 100 columns per line

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoqmeventd: catch calloc error
Thomas Lamprecht [Thu, 11 Feb 2021 15:48:51 +0000 (16:48 +0100)]
qmeventd: catch calloc error

even if close to impossible to happen, NULL dereferences are never
nice..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoqmeventd: rework description, mention s.reiter as author
Thomas Lamprecht [Thu, 11 Feb 2021 15:03:31 +0000 (16:03 +0100)]
qmeventd: rework description, mention s.reiter as author

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoqmeventd: change license to AGPLv3 update copyright
Thomas Lamprecht [Thu, 11 Feb 2021 15:01:19 +0000 (16:01 +0100)]
qmeventd: change license to AGPLv3 update copyright

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoqmeventd: explicitly close() pidfds
Stefan Reiter [Tue, 9 Feb 2021 15:24:07 +0000 (16:24 +0100)]
qmeventd: explicitly close() pidfds

In most circumstances a pidfd gets closed automatically once the child
dies, and that *should* be guaranteed by us calling SIGKILL - however,
it seems that sometimes that doesn't happen, leading to leaked file
descriptors[0].

Also add a small note to verbose mode showing when the late-cleanup
actually happens, helped during debug.

[0] https://forum.proxmox.com/threads/cannot-shutdown-vm.83911/

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agosnapshot: clear up log messages
Thomas Lamprecht [Thu, 11 Feb 2021 13:06:02 +0000 (14:06 +0100)]
snapshot: clear up log messages

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosnapshot: reduce logging rate after one minute
Thomas Lamprecht [Thu, 11 Feb 2021 13:05:20 +0000 (14:05 +0100)]
snapshot: reduce logging rate after one minute

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosnapshot: log storage where VM state is saved too
Thomas Lamprecht [Thu, 11 Feb 2021 13:04:19 +0000 (14:04 +0100)]
snapshot: log storage where VM state is saved too

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosavevm: show information about drives during snapshot
Stefan Reiter [Mon, 8 Feb 2021 11:15:11 +0000 (12:15 +0100)]
savevm: show information about drives during snapshot

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosavevm: periodically print progress
Stefan Reiter [Mon, 8 Feb 2021 11:15:10 +0000 (12:15 +0100)]
savevm: periodically print progress

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: bump versioned dependency of libpve-common-perl to 6.3-3
Thomas Lamprecht [Mon, 8 Feb 2021 15:35:19 +0000 (16:35 +0100)]
d/control: bump versioned dependency of libpve-common-perl to 6.3-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: use renderers from Tools instead of duplicating code
Stefan Reiter [Mon, 8 Feb 2021 11:15:09 +0000 (12:15 +0100)]
vzdump: use renderers from Tools instead of duplicating code

...taking card not to lose the custom precision for byte conversion.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotest: migrate: correctly mock storage module
Fabian Ebner [Mon, 8 Feb 2021 14:26:03 +0000 (15:26 +0100)]
test: migrate: correctly mock storage module

by fixing a typo. Since cfs_read_file within the storage module was not mocked,
the tests could fail on some setups. Now that get_bandwidth_limit is mocked,
cfs_read_file is not called anymore, but still mock it too for good measure and
to make it more future-proof.

Reported-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agocloudinit: remove pending delete on online regenerate image
Alexandre Derumier [Sat, 6 Feb 2021 13:39:54 +0000 (14:39 +0100)]
cloudinit: remove pending delete on online regenerate image

currently only pending changes are applied when we regenerate
image on a running vm, but not the pending delete.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
3 years agocloudinit: add opennebula config format
Alexandre Derumier [Sat, 6 Feb 2021 13:01:29 +0000 (14:01 +0100)]
cloudinit: add opennebula config format

This is an alternative format for cloudinit use by opennebula,
https://cloudinit.readthedocs.io/en/latest/topics/datasources/opennebula.html

but it can be also used by opennebula context scripts

https://github.com/OpenNebula/addon-context-linux
https://github.com/OpenNebula/addon-context-windows

This context scripts are simple udev trigger/bash scripts
and allow live configuration changes.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
3 years agobump version to 6.3-4
Thomas Lamprecht [Thu, 28 Jan 2021 16:46:09 +0000 (17:46 +0100)]
bump version to 6.3-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoanchor CPU flag regex to avoid arbitrary flag suffixes
Stefan Reiter [Mon, 18 Jan 2021 13:07:52 +0000 (14:07 +0100)]
anchor CPU flag regex to avoid arbitrary flag suffixes

Previously one could specify a CPU flag like 'pcidfoobar' and it would
be accepted, even though we attempt to filter VM-only flags for
security. AFAICT none of the flags we allow can be turned into any
others just by appending text, but better safe than sorry.

Reported-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix #2788: do not resume vms after backup if they were paused before
Dominik Csapak [Wed, 20 Jan 2021 12:32:04 +0000 (13:32 +0100)]
fix #2788: do not resume vms after backup if they were paused before

by checking if the vm is paused at the beginning and skipping the
resume now we also skip the qga freeze/thaw (which cannot work if the
vm is paused)

moved the 'vm_is_paused' sub from the api to PVE/QemuServer.pm so it
is available everywhere we need it.

since a suspend backup would pause the vm anyway, we can skip that
step also

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoapi: destroy VM: fixup parameter description language
Thomas Lamprecht [Tue, 26 Jan 2021 17:40:20 +0000 (18:40 +0100)]
api: destroy VM: fixup parameter description language

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agostyle fix: missing trailing comma
Thomas Lamprecht [Mon, 25 Jan 2021 15:24:52 +0000 (16:24 +0100)]
style fix: missing trailing comma

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovm destroy: destroy also unusedX config entries
Thomas Lamprecht [Mon, 25 Jan 2021 14:49:39 +0000 (15:49 +0100)]
vm destroy: destroy also unusedX config entries

this was previously covered by the "lets destroy ever disk which
matches the VMID" feature we disarmed a bit.

As unused disks are referenced in the config, it is not subtle to
destroy them (and we always did in the past) so fix that regression
again for explicitly referenced but unused disks.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovm destroy: allow opt-out of purging unreferenced disks
Thomas Lamprecht [Mon, 25 Jan 2021 14:06:19 +0000 (15:06 +0100)]
vm destroy: allow opt-out of purging unreferenced disks

Since an old change released with a version bump on 2009-09-07, we
search all enabled storages for VMID maching volumes on VM removal
and purge those too.

This has multiple pitfalls and may be quite unexpected for some
users.

It can make problems when:
* on recovery a VM is created, before disks are reattached the admin
  notices some settings issues and chooses to just recreate the VM;
  but during destroying the dummy VM all related disks get destroyed
  unconditionally which may result in data loss. This actually
  happened and is the original reason for the decision to change
  this.

* a storage is shared between PVE instance (between a set of clusters
  and/or single nodes), while this is against our rules it may still
  come as a surprise if destroying a VM on node A may destroy
  unrelated and unreferenced disks on the unrelated node B without
  asking or allowing to avoid that.

As this the removal of matching but unreferenced disks can result in
permanent data loss (up to the last backup) and may be to subtle and
unforgiving, allow to opt-out of it.

In the long run we want to make this opt-in, but that is an API
change and so needs to wait for next major release. But, we can adapt
the GUI already to make it opt-in there, catching most of the cases.

side-note: CT do not have this behavior at all

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoqm: import ovf: removed all imported disks on error
Thomas Lamprecht [Mon, 25 Jan 2021 13:58:55 +0000 (14:58 +0100)]
qm: import ovf: removed all imported disks on error

While the do_import method cleans up the current disk it was
importing on any error the following cases are not handled:
* multiple disks, first few succeed then one fails, only the last
  failed one was taken care of before this patch
* error after the import disk loop was not handled

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix drive-mirror completion with cloudinit
Mira Limbeck [Fri, 15 Jan 2021 11:49:24 +0000 (12:49 +0100)]
fix drive-mirror completion with cloudinit

On clone_vm when cloning the disks while the VM is running, we use
drive-mirror. We skip completion until the last disk, but with a
cloudinit disk there's no drive-mirror and so no completion done. If it
is the last disk in the hash, we never complete the drive-mirror jobs
and no further cloning is possible as there are already active jobs
using the disks.

To fix it we have to call qemu_drive_mirror_monitor directly in the case
of cloudinit when completion is requested and there are jobs defined.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
3 years agoaudio: add the none audio backend
Gilles Pietri [Thu, 7 Jan 2021 17:02:43 +0000 (18:02 +0100)]
audio: add the none audio backend

Signed-off-by: Gilles Pietri <contact+dev@gilouweb.com>
3 years agobuildsys: clean: remove migration test runtime files
Thomas Lamprecht [Tue, 12 Jan 2021 11:01:31 +0000 (12:01 +0100)]
buildsys: clean: remove migration test runtime files

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotests: mock storage locking for migration tests
Fabian Ebner [Mon, 11 Jan 2021 12:34:09 +0000 (13:34 +0100)]
tests: mock storage locking for migration tests

by doing it in a local directory instead of /var/lock/pve-manager, which is
used by the installed/non-test PVE code. This also covers the shared case,
which will become relevant after fixing #3229 (currently migration doesn't
touch disks on shared storages).

Reported-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoimprove description of fstrim_cloned_disks
Aaron Lauterer [Tue, 15 Dec 2020 15:22:03 +0000 (16:22 +0100)]
improve description of fstrim_cloned_disks

The phrasing left some room for speculation when this would be triggered.
E.g. after cloning a full VM?

Currently the only instances where it is used is when a disk is moved or
a VM migrated.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 years agotests: allow running migration tests in parallel
Fabian Ebner [Thu, 17 Dec 2020 09:37:02 +0000 (10:37 +0100)]
tests: allow running migration tests in parallel

It's not easily possible to use separate JSON files for the test configuration,
because part of it is generated with perl code. While this could be encoded too,
it seems cleaner to use the "run a single test by specifing the name"
functionality while adding a way for make to obtain a list of the test names.

Each test has (and needs) its own directory now, meaning the log files do not
need to be renamed anymore.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 6.3-3
Thomas Lamprecht [Tue, 15 Dec 2020 15:33:23 +0000 (16:33 +0100)]
bump version to 6.3-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix cloning/restoring of cloudinit disks in raw format
Mira Limbeck [Wed, 2 Dec 2020 12:50:25 +0000 (13:50 +0100)]
fix cloning/restoring of cloudinit disks in raw format

We only added the format extension when it was not 'raw'. But on file level
storages we always require it. To fix this, always add the format
extension if the storage provides the 'path' property.
This is the same logic we use in create_disks for cloudinit disks.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
3 years agod/control: bump versioned dependency on libpve-guest-common-perl (>= 3.1-3)
Thomas Lamprecht [Tue, 15 Dec 2020 14:56:45 +0000 (15:56 +0100)]
d/control: bump versioned dependency on libpve-guest-common-perl (>= 3.1-3)

for new move VM config helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocreate test environment for migration
Fabian Ebner [Tue, 1 Dec 2020 12:07:02 +0000 (13:07 +0100)]
create test environment for migration

and the associated parts for 'qm start'.

Each test will first populate the MigrationTest/run directory
with the relevant configuration files and files keeping track of the
state of everything necessary. Second, the mock-script for migration
is executed, which in turn will execute the 'qm start' mock-script
(if it's an online test that gets far enough). The scripts will simulate
a migration and update the relevant files in the MigrationTest/run directory.
Finally, the main test script will evaluate the state.

The main checks are the volume IDs on the source and target and the VM
configuration itself. Additional checks are the vm_status and expected_calls,
keeping track if certain calls have been made.

The rationale behind creating two mock-scripts is two-fold:
1. It removes the need to hard code responses for the tunnel
   and to recycle logic for determining and allocating migration volumes.
   Some of that logic already happens in the API part, so it was necessary
   to mock the whole CLI-Handler.
2. It allows testing the code relevant for migration in 'qm start' as well,
   and it should even be possible to test different versions of the
   mock-scripts against each other. With a bit of extra work and things
   like 'git worktree', it might even be possible to automate this.

The helper get_patched config is useful to change pre-defined configuration
files on the fly, avoiding the new to explicitly define whole configurations to
test for something in many cases.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: sort volumes migrated with storage_migrate
Fabian Ebner [Tue, 1 Dec 2020 12:07:01 +0000 (13:07 +0100)]
migration: sort volumes migrated with storage_migrate

Having a deterministic order here is useful for testing.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: factor out starting remote tunnel
Fabian Ebner [Tue, 1 Dec 2020 12:07:00 +0000 (13:07 +0100)]
migration: factor out starting remote tunnel

so it can be mocked when testing.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agouse new move_config_to_node method
Fabian Ebner [Tue, 1 Dec 2020 12:06:59 +0000 (13:06 +0100)]
use new move_config_to_node method

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoclone_disk: fix offline clone of efidisk
Fabian Ebner [Mon, 7 Dec 2020 12:15:15 +0000 (13:15 +0100)]
clone_disk: fix offline clone of efidisk

by partially reverting 4df98f2f14348d0ed57529c4c04a1b5ffb840055 and fixing the
line-length issue differently. The commit didn't update two later usages of
$size, breaking copying the efidisk. The other usage as a parameter to
qemu_img_convert() is luckily only cosmetic, for progress output.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoapi: adapt VM destroy description
Thomas Lamprecht [Tue, 15 Dec 2020 13:49:41 +0000 (14:49 +0100)]
api: adapt VM destroy description

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoqm destroy: Extend --purge description
Dominic Jäger [Thu, 10 Dec 2020 09:17:25 +0000 (10:17 +0100)]
qm destroy: Extend --purge description

Add replication jobs & HA. This makes the enumeration complete.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
3 years agobump version to 6.3-2
Thomas Lamprecht [Thu, 3 Dec 2020 17:08:04 +0000 (18:08 +0100)]
bump version to 6.3-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: bump versioned dependency for libpve-common-perl
Thomas Lamprecht [Thu, 3 Dec 2020 16:26:24 +0000 (17:26 +0100)]
d/control: bump versioned dependency for libpve-common-perl

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agouse get_repository from PVE::PBSClient
Dominik Csapak [Thu, 3 Dec 2020 11:43:40 +0000 (12:43 +0100)]
use get_repository from PVE::PBSClient

this fixes the issue that we did not generate the correct repository
url for pbs storages that contained an ipv6 address or a port

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agobump version to 6.3-1
Thomas Lamprecht [Wed, 25 Nov 2020 13:32:57 +0000 (14:32 +0100)]
bump version to 6.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoqmeventd: flush after verbose printing
Dominik Csapak [Tue, 24 Nov 2020 14:04:06 +0000 (15:04 +0100)]
qmeventd: flush after verbose printing

if one would try to use -v in a systemd service, systemd would disable
line buffering for stdout and no output would happen (until the buffer
is full)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoclone disk: avoid errors after disk was moved by QEMU
Thomas Lamprecht [Wed, 25 Nov 2020 13:16:28 +0000 (14:16 +0100)]
clone disk: avoid errors after disk was moved by QEMU

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: cleanup code format of clone_disk call
Thomas Lamprecht [Fri, 20 Nov 2020 11:40:19 +0000 (12:40 +0100)]
api: cleanup code format of clone_disk call

showing off it's monstrosity of a method signature, needs to be
cleaned up in a followup commit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd and use get_qga_key
Thomas Lamprecht [Fri, 20 Nov 2020 11:39:45 +0000 (12:39 +0100)]
add and use get_qga_key

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agostatus: skip query-proxmox-support if VM is offline
Fabian Grünbichler [Wed, 25 Nov 2020 10:26:35 +0000 (11:26 +0100)]
status: skip query-proxmox-support if VM is offline

otherwise pvestatd will print lots of warnings..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoprint query-proxmox-support result in 'full' status
Stefan Reiter [Tue, 24 Nov 2020 15:41:22 +0000 (16:41 +0100)]
print query-proxmox-support result in 'full' status

Extends print_recursive_hash for the CLI to handle JSON booleans so the
result will actually show up in 'qm status --verbose'.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agod/control: bump versioned dependency on pve-storage
Fabian Grünbichler [Tue, 24 Nov 2020 15:28:06 +0000 (16:28 +0100)]
d/control: bump versioned dependency on pve-storage

for 'activate_volumes in storage_migrate', which we now rely on in
migration code

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agodeactivate volumes after storage_migrate
Fabian Ebner [Fri, 6 Nov 2020 14:30:59 +0000 (15:30 +0100)]
deactivate volumes after storage_migrate

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoadapt to new storage_migrate activation behavior
Fabian Ebner [Fri, 6 Nov 2020 14:30:58 +0000 (15:30 +0100)]
adapt to new storage_migrate activation behavior

Offline migrated volumes are now activated within storage_migrate.
Online migrated volumes can be assumed to be already active.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agosystemd scope: add CPUWeight for cgroupv2
Alexandre Derumier [Fri, 30 Oct 2020 09:42:36 +0000 (10:42 +0100)]
systemd scope: add CPUWeight for cgroupv2

3 years agoreplace cgroups_write by cgroup change_cpu_shares && change_cpu_quota
Alexandre Derumier [Fri, 30 Oct 2020 09:42:35 +0000 (10:42 +0100)]
replace cgroups_write by cgroup change_cpu_shares && change_cpu_quota

3 years agoadd PVE::QemuServer::Cgroup
Wolfgang Bumiller [Tue, 24 Nov 2020 11:00:33 +0000 (12:00 +0100)]
add PVE::QemuServer::Cgroup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump version to 6.2-20
Thomas Lamprecht [Thu, 12 Nov 2020 16:09:44 +0000 (17:09 +0100)]
bump version to 6.2-20

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agostop qmeventd after pve-guests and pve-ha-lrm services
Thomas Lamprecht [Thu, 12 Nov 2020 16:04:49 +0000 (17:04 +0100)]
stop qmeventd after pve-guests and pve-ha-lrm services

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Co-developed-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodon't migrate replicated VM whose replication job is marked for removal
Fabian Ebner [Thu, 29 Oct 2020 13:31:32 +0000 (14:31 +0100)]
don't migrate replicated VM whose replication job is marked for removal

while it didn't actually fail, we probably want to avoid the behavior:

With remove_job=full:
    * run_replication called during migration causes the replicated volumes to
      be removed
    * migration continues by fully copying all volumes

With remove_job=local:
    * run_replication called during migration causes the job (and local
      replication snapshots) to be removed
    * migration continues by fully copying all volumes and renaming them to
      avoid collision with the still existing remote volumes

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agofix checks for transfering replication state/switching job target
Fabian Ebner [Thu, 29 Oct 2020 13:31:31 +0000 (14:31 +0100)]
fix checks for transfering replication state/switching job target

In some cases $self->{replicated_volumes} will be auto-vivified
to {} by checks like
next if $self->{replicated_volumes}->{$volid}
and then {} would evaluate to true in a boolean context.

Now the replication information is retrieved once in prepare,
and used to decide whether to make the calls or not.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoRepeat check for replication target in locked section
Fabian Ebner [Thu, 29 Oct 2020 13:31:30 +0000 (14:31 +0100)]
Repeat check for replication target in locked section

No need to warn twice, so the warning from the outside check
was removed.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 6.2-19
Thomas Lamprecht [Thu, 5 Nov 2020 12:37:03 +0000 (13:37 +0100)]
bump version to 6.2-19

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix vm_resume and allow vm_start with QMP status 'shutdown'
Stefan Reiter [Mon, 19 Oct 2020 12:18:41 +0000 (14:18 +0200)]
fix vm_resume and allow vm_start with QMP status 'shutdown'

When the VM is in status 'shutdown', i.e. after the guest issues a
powerdown while a backup is running, QEMU requires a 'system_reset' to
be issued before 'cont' can boot the guest again.

Additionally, when the VM has been powered down during a backup, the
logically correct call would be a 'vm_start', so automatically vm_resume
from vm_start in case this situation occurs. This also means the GUI can
cope with this almost unchanged.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoconfig_to_command: use -no-shutdown option
Stefan Reiter [Mon, 19 Oct 2020 12:18:40 +0000 (14:18 +0200)]
config_to_command: use -no-shutdown option

Ignore shutdowns triggered from within the guest in favor of detecting
them via qmeventd and stopping the QEMU process that way.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agovzdump: use dirty bitmap for not running VMs too
Stefan Reiter [Mon, 19 Oct 2020 12:18:39 +0000 (14:18 +0200)]
vzdump: use dirty bitmap for not running VMs too

Now that VMs can be started during a backup, it makes sense to create a
dirty bitmap in these cases too, since the VM might be resumed and thus
continue running normally even after the backup is done.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agovzdump: connect to qmeventd for duration of backup
Stefan Reiter [Mon, 19 Oct 2020 12:18:38 +0000 (14:18 +0200)]
vzdump: connect to qmeventd for duration of backup

Connect and send the vmid of the VM being backed up. This prevents
qmeventd from SIGTERMing the underlying QEMU instance, even if the guest
shuts itself down, until we close the socket connection (in cleanup,
which happens on success and abort, or if we crash the file handle will
be closed as well).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoqmeventd: add last-ditch effort SIGKILL cleanup
Stefan Reiter [Mon, 19 Oct 2020 12:18:37 +0000 (14:18 +0200)]
qmeventd: add last-ditch effort SIGKILL cleanup

'alarm' is used to schedule an additionaly cleanup round 5 seconds after
sending SIGTERM via terminate_client. This then sends SIGKILL via a
pidfd (if supported by the kernel) or directly via kill, making sure
that the QEMU process is *really* dead and won't be left behind in an
undetermined state.

This shouldn't be an issue under normal circumstances, but can help
avoid dead processes lying around if QEMU hangs after SIGTERM.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoqmeventd: add handling for -no-shutdown QEMU instances
Stefan Reiter [Mon, 19 Oct 2020 12:18:36 +0000 (14:18 +0200)]
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>
3 years agofix #3113: unbreak drive hotplug
Fabian Grünbichler [Thu, 5 Nov 2020 09:12:26 +0000 (10:12 +0100)]
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>
3 years agobump version to 6.2-18
Thomas Lamprecht [Thu, 29 Oct 2020 17:23:23 +0000 (18:23 +0100)]
bump version to 6.2-18

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopartially fix #3056: try to cancel backup without uuid
Dominik Csapak [Mon, 19 Oct 2020 14:11:38 +0000 (16:11 +0200)]
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>
3 years agomigrate: enable dirty-bitmap migration
Stefan Reiter [Thu, 22 Oct 2020 15:34:20 +0000 (17:34 +0200)]
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>
3 years agobump version to 6.2-17
Thomas Lamprecht [Thu, 22 Oct 2020 14:09:03 +0000 (16:09 +0200)]
bump version to 6.2-17

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobootorder: don't print empty 'order=' property
Stefan Reiter [Wed, 21 Oct 2020 09:00:25 +0000 (11:00 +0200)]
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>
3 years agobump version to 6.2-16
Thomas Lamprecht [Mon, 19 Oct 2020 13:51:00 +0000 (15:51 +0200)]
bump version to 6.2-16

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotests: make module truthy
Thomas Lamprecht [Mon, 19 Oct 2020 13:33:16 +0000 (15:33 +0200)]
tests: make module truthy

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotests: do not use for-loop for globs
Thomas Lamprecht [Mon, 19 Oct 2020 13:32:25 +0000 (15:32 +0200)]
tests: do not use for-loop for globs

they are rather inefficient for this

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocloudinit: use normal grep
Thomas Lamprecht [Mon, 19 Oct 2020 13:32:03 +0000 (15:32 +0200)]
cloudinit: use normal grep

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocomment out USB hotplug code
Thomas Lamprecht [Mon, 19 Oct 2020 13:31:38 +0000 (15:31 +0200)]
comment out USB hotplug code

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix some FH close
Thomas Lamprecht [Mon, 19 Oct 2020 13:30:21 +0000 (15:30 +0200)]
fix some FH close

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoPCI: use warnings/strict and fix setting $vga from config2command
Thomas Lamprecht [Fri, 16 Oct 2020 15:53:28 +0000 (17:53 +0200)]
PCI: use warnings/strict and fix setting $vga from config2command

fixes commit 74c17b7a23c8a953d1dcec9bd53449d71d88cd5d 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>
3 years agotree wide cleanups
Thomas Lamprecht [Fri, 16 Oct 2020 15:52:51 +0000 (17:52 +0200)]
tree wide cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: factor out common vm_is_paused code in private helper
Thomas Lamprecht [Fri, 16 Oct 2020 15:51:24 +0000 (17:51 +0200)]
api: factor out common vm_is_paused code in private helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: fix conditional variable declaration
Thomas Lamprecht [Fri, 16 Oct 2020 15:51:05 +0000 (17:51 +0200)]
api: fix conditional variable declaration

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>