]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
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>
3 years agodrop legacy __read_avail code
Thomas Lamprecht [Fri, 16 Oct 2020 14:52:29 +0000 (16:52 +0200)]
drop legacy __read_avail code

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix various conditionally declared vars
Thomas Lamprecht [Fri, 16 Oct 2020 14:52:11 +0000 (16:52 +0200)]
fix various conditionally declared vars

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotree wide cleanup of s/return undef/return/
Thomas Lamprecht [Fri, 16 Oct 2020 14:20:05 +0000 (16:20 +0200)]
tree wide cleanup of s/return undef/return/

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix clone_disk failing for nonexistent cloudinit disk
Mira Limbeck [Mon, 28 Sep 2020 08:36:31 +0000 (10:36 +0200)]
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>
3 years agofix VM clone from snapshot with cloudinit disk
Mira Limbeck [Mon, 28 Sep 2020 08:36:30 +0000 (10:36 +0200)]
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>
3 years agofix typos
Fabian Ebner [Wed, 14 Oct 2020 11:40:17 +0000 (13:40 +0200)]
fix typos

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agocfg2cmd: add tests for new boot order property
Stefan Reiter [Tue, 6 Oct 2020 13:32:17 +0000 (15:32 +0200)]
cfg2cmd: add tests for new boot order property

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoapi: add handling for new boot order format
Stefan Reiter [Tue, 6 Oct 2020 13:32:16 +0000 (15:32 +0200)]
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>
3 years agofix #3010: add 'bootorder' parameter for better control of boot devices
Stefan Reiter [Tue, 6 Oct 2020 13:32:15 +0000 (15:32 +0200)]
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>
3 years agoadd new 'boot' property format and introduce legacy conversion helpers
Stefan Reiter [Tue, 6 Oct 2020 13:32:14 +0000 (15:32 +0200)]
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>
3 years agocfg2cmd: add test for legacy-style bootorder
Stefan Reiter [Tue, 6 Oct 2020 13:32:13 +0000 (15:32 +0200)]
cfg2cmd: add test for legacy-style bootorder

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix indentation
Stefan Reiter [Tue, 6 Oct 2020 13:32:12 +0000 (15:32 +0200)]
fix indentation

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agobump version to 6.2-15
Thomas Lamprecht [Tue, 29 Sep 2020 15:44:31 +0000 (17:44 +0200)]
bump version to 6.2-15

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofollowup: s/verification/validation/ to avoid confusion
Thomas Lamprecht [Tue, 29 Sep 2020 15:37:31 +0000 (17:37 +0200)]
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>
3 years agovzdump: log 'finishing' state
Stefan Reiter [Mon, 28 Sep 2020 15:48:36 +0000 (17:48 +0200)]
vzdump: log 'finishing' state

...and avoid printing 100% status twice

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agod/control: update
Thomas Lamprecht [Tue, 8 Sep 2020 17:12:36 +0000 (19:12 +0200)]
d/control: update

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/copyright: update
Thomas Lamprecht [Tue, 8 Sep 2020 17:01:54 +0000 (19:01 +0200)]
d/copyright: update

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoline length and formatting fixes
Thomas Lamprecht [Wed, 2 Sep 2020 12:07:02 +0000 (14:07 +0200)]
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>
3 years agotests: add cfg2cmd test for virtio-blk disk with iothread on
Thomas Lamprecht [Wed, 2 Sep 2020 11:27:27 +0000 (13:27 +0200)]
tests: add cfg2cmd test for virtio-blk disk with iothread on

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2570: add 'keephugepages' config
Stefan Reiter [Wed, 2 Sep 2020 09:03:37 +0000 (11:03 +0200)]
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>
3 years agobump version to 6.2-14
Thomas Lamprecht [Mon, 24 Aug 2020 17:34:27 +0000 (19:34 +0200)]
bump version to 6.2-14

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: do not log per disk dirty bitmap state for templates
Thomas Lamprecht [Fri, 21 Aug 2020 12:11:48 +0000 (14:11 +0200)]
vzdump: do not log per disk dirty bitmap state for templates

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2862: properly backup (all) VM templates
Fabian Grünbichler [Thu, 6 Aug 2020 11:13:48 +0000 (13:13 +0200)]
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>
3 years agofollowup cleanup
Thomas Lamprecht [Fri, 21 Aug 2020 08:44:00 +0000 (10:44 +0200)]
followup cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotests: cfg2cmd: check also warnings
Thomas Lamprecht [Fri, 21 Aug 2020 08:38:27 +0000 (10:38 +0200)]
tests: cfg2cmd: check also warnings

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotests: cfg2cmd: get testname earlier
Thomas Lamprecht [Fri, 21 Aug 2020 08:38:08 +0000 (10:38 +0200)]
tests: cfg2cmd: get testname earlier

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoprint_vga_device: check if bios is defined
Stoiko Ivanov [Fri, 21 Aug 2020 08:07:38 +0000 (10:07 +0200)]
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>
3 years agovzdump: show "reused" message even if nothing was transferred
Stefan Reiter [Thu, 20 Aug 2020 13:32:23 +0000 (15:32 +0200)]
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>
3 years agovzdump: allow bandwidth limit for PBS backup too
Stefan Reiter [Thu, 20 Aug 2020 13:32:22 +0000 (15:32 +0200)]
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>
3 years agobump version to 6.2-13
Thomas Lamprecht [Thu, 20 Aug 2020 09:42:53 +0000 (11:42 +0200)]
bump version to 6.2-13

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: restore log behavior for VMs running with older QEMU
Thomas Lamprecht [Thu, 20 Aug 2020 08:45:34 +0000 (10:45 +0200)]
vzdump: restore log behavior for VMs running with older QEMU

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovdzump: padd percentagde done counter, format duration for humans
Thomas Lamprecht [Thu, 20 Aug 2020 08:23:18 +0000 (10:23 +0200)]
vdzump: padd percentagde done counter, format duration for humans

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: output sparseness again
Thomas Lamprecht [Thu, 20 Aug 2020 08:22:44 +0000 (10:22 +0200)]
vzdump: output sparseness again

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: log reused information also if we run only <1s
Thomas Lamprecht [Wed, 19 Aug 2020 18:31:09 +0000 (20:31 +0200)]
vzdump: log reused information also if we run only <1s

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: followup: log total dirtiness again, minor output adaptions
Thomas Lamprecht [Wed, 19 Aug 2020 18:30:30 +0000 (20:30 +0200)]
vzdump: followup: log total dirtiness again, minor output adaptions

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.2-12
Thomas Lamprecht [Wed, 19 Aug 2020 17:46:28 +0000 (19:46 +0200)]
bump version to 6.2-12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocfg2cmd: vga: fix #2749: disable edid for Win+BIOS+VGA machines
Aaron Lauterer [Mon, 27 Jul 2020 13:55:25 +0000 (15:55 +0200)]
cfg2cmd: vga: fix #2749: disable edid for Win+BIOS+VGA machines

Edid support was added with Qemu 5. Windows guests seem to not be able
to get all possible resolutions if the default std VGA device is used as
GPU and the VM boots in BIOS mode. The result is that only one of the
following three resolutions can be configured:

800x600
1024x768
1920x1080

It is important to note that just booting a Windows VM with the edid=off
parameter will not make the large list of resolutions available. It
seems that Windows is caching the list of possible resolutions
somewhere [0].

Uninstalling the 'Microsoft Basic Display Adapter' in the device manager
and rebooting the VM is one way I found to force Windows to recreate the
list of possible resolutions.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
[0] https://lists.nongnu.org/archive/html/qemu-devel/2020-07/msg07128.html

3 years agovzdump: don't use dirty bitmap when VM was off
Stefan Reiter [Wed, 19 Aug 2020 15:02:04 +0000 (17:02 +0200)]
vzdump: don't use dirty bitmap when VM was off

There can't be a dirty bitmap when the VM was off, and if it was off we
will also shut it down after the backup, so no point in creating one.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agovzdump: log 100% percent in case $target is 0
Stefan Reiter [Wed, 19 Aug 2020 15:02:03 +0000 (17:02 +0200)]
vzdump: log 100% percent in case $target is 0

When $target is 0, that means we don't have to upload any data, in which
case we're immediately done.

Otherwise incremental backups with no changes display a really weird
  status: 0% (0.0 B of 0.0 B), duration 0, read: 0 B/s, write: 0 B/s
when they're actually done already.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agovzdump: display actually uploaded chunks as 'write' speed
Stefan Reiter [Wed, 19 Aug 2020 15:02:02 +0000 (17:02 +0200)]
vzdump: display actually uploaded chunks as 'write' speed

Previously 'read' and 'write' would always show the same value, which is
of little use. Change it so 'write' excludes reused bytes, thus
displaying the actual upload speed.

$last_reused needs to be initialized to contain reused data from 'clean'
dirty bitmaps to ensure the first output line is correct.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agovzdump: improve logging output with dirty bitmaps
Stefan Reiter [Wed, 19 Aug 2020 15:02:01 +0000 (17:02 +0200)]
vzdump: improve logging output with dirty bitmaps

Uses the new 'query-pbs-bitmap-info' QMP call to retrieve additional
information about each drive's dirty bitmap. Returned info is also used
to calculate $target by simply adding all the dirty values (dirty is
equal to size in case the entire drive will be backed up).

"Backup is sparse" message is suppressed for PBS, since it makes little
sense (if zero chunks appear in the clean area of a bitmap, they won't
be counted, and a user is probably more interested in the 'reused' data
anyway).

Also removes the need for the hacky $first_round query-backup handling.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agovalidate_cpu_conf: return config
Fabian Ebner [Wed, 12 Aug 2020 11:40:12 +0000 (13:40 +0200)]
validate_cpu_conf: return config

as parse_property_string expects it to.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoAdd missing die statements
Fabian Ebner [Tue, 4 Aug 2020 11:32:44 +0000 (13:32 +0200)]
Add missing die statements

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoAdd dot character to CPU commandline regular expression
Fabian Ebner [Tue, 11 Aug 2020 10:47:03 +0000 (12:47 +0200)]
Add dot character to CPU commandline regular expression

to be able to parse CPU features like "+sse4.2" correctly.

Reported here: https://forum.proxmox.com/threads/zsf-snapshot-unable-to-parse-value-of-runningcpu-got-undefined-value.74094/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agod/control: bump versioned dep on pve-storage
Fabian Grünbichler [Thu, 6 Aug 2020 07:49:17 +0000 (09:49 +0200)]
d/control: bump versioned dep on pve-storage

needed for PBS plugin methods that are called in backup/restore.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>