]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
2 years agobump version to 7.0-3
Thomas Lamprecht [Mon, 21 Jun 2021 09:15:21 +0000 (11:15 +0200)]
bump version to 7.0-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: enforce that image content type is available
Fabian Ebner [Fri, 18 Jun 2021 10:59:34 +0000 (12:59 +0200)]
migrate: enforce that image content type is available

and use it for the vdisk_list call too. This avoids scanning (and picking up
volumes from!) storages that are not even configured to hold images.

Previously, the content type was only enforced when a storage map was present.

Also serves a bit as a preparation to enforce content type on guest startup,
because now migration failure happens early and not only when trying to start
the guest on the remote node.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoprefer storage_check_enabled over storage_check_node
Fabian Ebner [Fri, 18 Jun 2021 10:59:33 +0000 (12:59 +0200)]
prefer storage_check_enabled over storage_check_node

storage_check_enabled simply checks for the 'disable' option and then calls
storage_check_node.

While not strictly necessary for a second call where only the storage differs,
e.g. in case of clone, it is more future-proof: if support for a target storage
is added at some point, it might be easy to miss adapting the call.

For the migration checks, the situation is improved by now always catching
disabled (target) storages.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agotest: fix restore config test as unprivileged user
Fabian Ebner [Mon, 31 May 2021 14:27:10 +0000 (16:27 +0200)]
test: fix restore config test as unprivileged user

after upgrading to bullseye, the cfs_read_file call within
restore_update_config_line() results in an error:
    Is a directory!
when done as an unprivileged user.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agovmstatus: don't set PID when VM is not running
Fabian Ebner [Fri, 18 Jun 2021 11:36:40 +0000 (13:36 +0200)]
vmstatus: don't set PID when VM is not running

by avoiding int(undef)

Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoconfig: limit description/comment length to 8 KiB
Thomas Lamprecht [Fri, 18 Jun 2021 11:11:07 +0000 (13:11 +0200)]
config: limit description/comment length to 8 KiB

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agovm status: force int where appropriate
Fabian Ebner [Tue, 1 Jun 2021 06:43:06 +0000 (08:43 +0200)]
vm status: force int where appropriate

to avoid potential problems with stringified numbers in Javascript and
elsewehere.

The vmid was not always an integer as the return schema expects, namely
when there was an opt_vmid argument, because the 'ne' comparision coerced the
vmid to be a string then.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoavoid setting lun number for drives when pvscsi controller is used
Fabian Ebner [Tue, 13 Apr 2021 08:24:14 +0000 (10:24 +0200)]
avoid setting lun number for drives when pvscsi controller is used

Reported in the community forum[0].

In QEMU's hw/scsi/vmw_pvscsi.c in the SCSIBusInfo struct, the max_lun property
is set to 0. This means that in our stack, one cannot have multiple disks and
use 'scsihw: pvscsi' currently, as kvm would fail with
    bad scsi device lun: 1

Instead of increasing the lun number, increase the scsi-id, as we already do for
lsi.* (in hw/scsi/lsi53c895a.c the max_lun property is also 0).

[0]: https://forum.proxmox.com/threads/kvm-bad-scsi-device-lun-1.84318/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
Tested-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agocfg2cmd: add test for efidisk rbd cache handling
Thomas Lamprecht [Wed, 16 Jun 2021 13:24:55 +0000 (15:24 +0200)]
cfg2cmd: add test for efidisk rbd cache handling

I don't think this is something which will get broken by accident but
still nice to "document" this behavior in a regression test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofollowup; shorter code for efidisk rbd cache handling
Thomas Lamprecht [Wed, 16 Jun 2021 13:17:58 +0000 (15:17 +0200)]
followup; shorter code for efidisk rbd cache handling

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3329: turn on cache=writeback for efidisks on rbd
Dominik Csapak [Wed, 16 Jun 2021 13:09:33 +0000 (15:09 +0200)]
fix #3329: turn on cache=writeback for efidisks on rbd

on slower ceph clusters, the write pattern of the ovmf booting process
slows down the boot of the vm, so we turn on caching by default

it seems no other storage (until now) behaves like this. if it does in
the future, we can still add them too, or add a 'cache' property for
the efidisk

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agovm destroy: do not remove unreferenced disks by default
Fabian Ebner [Fri, 4 Jun 2021 13:49:30 +0000 (15:49 +0200)]
vm destroy: do not remove unreferenced disks by default

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agoscan volids: remove superfluous parameter
Fabian Ebner [Fri, 4 Jun 2021 13:49:29 +0000 (15:49 +0200)]
scan volids: remove superfluous parameter

The only caller that didn't use 'images' was removed as part of the migration
refactoring in commit 62a4c963b824c923a4fc82a48c81d0f63ebaddae, so this is not
even a breaking change as the 'PVE 7' comment might've suggested.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agoRevert "revert spice_ticket prefix change in 7827de4"
Fabian Ebner [Fri, 4 Jun 2021 13:49:28 +0000 (15:49 +0200)]
Revert "revert spice_ticket prefix change in 7827de4"

This reverts commit ff09c795edd12b1cc4604ee28a7cdd99cdd1afa8. We wanted to wait
until PVE 7.0 for the change to not break migration new -> old until then.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agobuildsys: change upload dist to bullseye
Thomas Lamprecht [Tue, 8 Jun 2021 07:47:35 +0000 (09:47 +0200)]
buildsys: change upload dist to bullseye

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agovzdump: add master key support
Fabian Grünbichler [Fri, 28 May 2021 12:09:53 +0000 (14:09 +0200)]
vzdump: add master key support

running outdated VMs without master key support will generate a warning
but proceed with a backup without encrypted key upload.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agovzdump: drop legacy fallback logging for dirty-bitmap
Thomas Lamprecht [Wed, 2 Jun 2021 14:48:13 +0000 (16:48 +0200)]
vzdump: drop legacy fallback logging for dirty-bitmap

Users need to reboot at least once for the upgrade to 7.0, so any VM
running is then using a new enough QEMU...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-2
Thomas Lamprecht [Fri, 28 May 2021 11:08:50 +0000 (13:08 +0200)]
bump version to 7.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agolive-restore: merge snapshot/repo log lines into one
Thomas Lamprecht [Fri, 28 May 2021 10:14:34 +0000 (12:14 +0200)]
live-restore: merge snapshot/repo log lines into one

to many lines make task log harder to read

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agolive-restore: add more logging
Stefan Reiter [Tue, 18 May 2021 15:13:44 +0000 (17:13 +0200)]
live-restore: add more logging

To bring it better in line with regular restore, also log the
repository, the snapshot and the target for each drive.

While at it, adjust capitalization of existing log line and clean up
repeated '$1' use.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agodestroy VM: also check if unused volumes are base images
Fabian Ebner [Mon, 19 Apr 2021 08:46:43 +0000 (10:46 +0200)]
destroy VM: also check if unused volumes are base images

It's arguably not likely in practice that only an unused volume is still in use
as a base image, but do it for completeness sake.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodestroy VM: always remove (referenced) VM state volumes
Fabian Ebner [Mon, 19 Apr 2021 08:46:42 +0000 (10:46 +0200)]
destroy VM: always remove (referenced) VM state volumes

With --destroy-unreferenced-disks 0 they were not removed yet, but no use in
keeping them around.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoqm: assume correct VNC setup in 'vncproxy', disallow passwordless
Stefan Reiter [Thu, 27 May 2021 10:27:51 +0000 (12:27 +0200)]
qm: assume correct VNC setup in 'vncproxy', disallow passwordless

The QMP 'change' command is no longer available since QEMU 6.0, so this
cannot work - instead of replacing it, we can just remove it however.

The 'if' branch would only set the VNC socket path anew and enable
password mode, which is always set and enabled on startup already.
The 'else' branch was intended for certificate login (?), which
according to the FIXME comment is long gone anyway - simply forbid
'vncproxy' without the PVE ticket environment variable set.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agocfg2cmd: use long form QEMU parameters to avoid warning in 6.0
Stefan Reiter [Thu, 27 May 2021 10:27:50 +0000 (12:27 +0200)]
cfg2cmd: use long form QEMU parameters to avoid warning in 6.0

QEMU warns us about this:

kvm: -chardev socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait: warning: short-form boolean option 'server' deprecated
Please use server=on instead
kvm: -chardev socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait: warning: short-form boolean option 'nowait' deprecated
Please use wait=off instead
kvm: -vnc unix:/var/run/qemu-server/100.vnc,password: warning: short-form boolean option 'password' deprecated
Please use password=on instead

The new syntax is backwards compatible to at least QEMU 4.0.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agovmstatus: make template property optional
Fabian Ebner [Thu, 11 Mar 2021 10:26:47 +0000 (11:26 +0100)]
vmstatus: make template property optional

to avoid printing 'template: ' with 'qm status <id> --verbose' if it's false.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: clone: sort vm disks to keep numbers consistent
Lorenz Stechauner [Wed, 26 May 2021 14:19:17 +0000 (16:19 +0200)]
api: clone: sort vm disks to keep numbers consistent

reported by user in forum:
https://forum.proxmox.com/threads/problem-when-copying-template-with-2-discs.89851/

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
3 years agobump version to 7.0-1
Thomas Lamprecht [Thu, 13 May 2021 17:11:22 +0000 (19:11 +0200)]
bump version to 7.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodebian: update compat, copyright, ..
Thomas Lamprecht [Thu, 13 May 2021 17:09:29 +0000 (19:09 +0200)]
debian: update compat, copyright, ..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.4-2
Thomas Lamprecht [Thu, 29 Apr 2021 14:16:51 +0000 (16:16 +0200)]
bump version to 6.4-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2862: allow sata/ide template backups
Fabian Grünbichler [Mon, 26 Apr 2021 12:11:03 +0000 (14:11 +0200)]
fix #2862: allow sata/ide template backups

for IDE and SATA, setting the whole drive into readonly mode is not
possible. skip the readonly flag for such drives as a workaround until
we find a better solution.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofix bootdisk_size for new bootorder config scheme
Dominik Csapak [Mon, 8 Mar 2021 13:43:38 +0000 (14:43 +0100)]
fix bootdisk_size for new bootorder config scheme

Previously, we ever only had a single boot *disk*, while possibly
having multiple cdroms/nics in the boot order

e.g. the config:

 boot: dnc
 bootdisk: scsi0
 ide0: media=cdrom,none
 scsi0: xxx
 net0: ...

would return the size of scsi0 even though it would first boot
from cdrom/network.

When editing the bootorder with such a legacy config, we
remove the 'bootdisk' property and replace the legacy notation
with an explicit order, but we only search the first disk
for the size now.

Restore that behaviour by iterating over all disks in the boot
order property string until we get one that is not a cdrom
and has a size.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoRevert "migration: do not set default speed limit"
Thomas Lamprecht [Thu, 29 Apr 2021 12:27:41 +0000 (14:27 +0200)]
Revert "migration: do not set default speed limit"

The default was changed for 5.2, so while it is not 32 MiB/s anymore,
it is still 128 MiB/s which I did not notice on my 1 Gbps (or < 125
MiB/s) setup. For users with links faster than one gigabit it now did
some limiting - so setup a very high limit so than even 100G should
not max this out.

This reverts commit a89bd100846f8e923aa7d15863b92e6e2d7264d2.

3 years agobump version to 6.4-1
Thomas Lamprecht [Fri, 23 Apr 2021 14:26:59 +0000 (16:26 +0200)]
bump version to 6.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomigrate: fix memory migration start time
Fabian Ebner [Fri, 23 Apr 2021 12:31:40 +0000 (14:31 +0200)]
migrate: fix memory migration start time

The variable is only ever used for calculating the average speed of memory
migration, but it was set before disk mirroring already. But the disk
sizes are not included in the calculation, resulting in (very) wrong values.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoqemu_img_convert: add missing newline for progress output
Fabian Ebner [Thu, 22 Apr 2021 06:57:57 +0000 (08:57 +0200)]
qemu_img_convert: add missing newline for progress output

which was accidentally removed by b5e9d97bdf8a63a542f8cbb3c1d0821ee731f796.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agofix #3369: auto-start vm after failed stopmode backup
Dylan Whyte [Tue, 20 Apr 2021 13:14:37 +0000 (15:14 +0200)]
fix #3369: auto-start vm after failed stopmode backup

Fixes an issue in which a VM/CT fails to automatically restart after a
failed stop-mode backup.

Also fixes a minor typo in a comment

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agolive-restore: hold 'create' lock during operation
Stefan Reiter [Wed, 21 Apr 2021 14:25:25 +0000 (16:25 +0200)]
live-restore: hold 'create' lock during operation

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agolive-restore: don't remove VM on error
Stefan Reiter [Wed, 21 Apr 2021 14:25:24 +0000 (16:25 +0200)]
live-restore: don't remove VM on error

Potentially an admin can still recover some data, or wants to inspect
the state.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoqmrestore: add live-restore option
Stefan Reiter [Wed, 21 Apr 2021 14:25:23 +0000 (16:25 +0200)]
qmrestore: add live-restore option

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodrive: volume in-use check: remove unused closure parameter
Fabian Ebner [Mon, 19 Apr 2021 13:39:50 +0000 (15:39 +0200)]
drive: volume in-use check: remove unused closure parameter

and simplify the calling iteration.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: keep log rate steady if polling gets more frequent
Thomas Lamprecht [Mon, 19 Apr 2021 20:01:05 +0000 (22:01 +0200)]
migration: keep log rate steady if polling gets more frequent

Either we're done in a few seconds anyway, or if the VM dirties lots
of pages we need quite a bit of time, and then it does not help to
output roughly the same status 10 times a second...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomigration: rework logging to more humand friendly, less spammy
Thomas Lamprecht [Mon, 19 Apr 2021 19:54:33 +0000 (21:54 +0200)]
migration: rework logging to more humand friendly, less spammy

* use render_bytes where possible, to get quick to read and grasp
  units printed
* xbzrle is only interesting if actually pages/bytes are send using
  it, so only log in that case
* log if VM dirties more than we send
* log current speed we get from QEMU

In general there are less lines logged and huge integers are avoided.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomigration: factor out variable + code cleanup
Thomas Lamprecht [Mon, 19 Apr 2021 19:51:21 +0000 (21:51 +0200)]
migration: factor out variable + code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomigration: log: s/migration_caps/migration capabilities/
Thomas Lamprecht [Mon, 19 Apr 2021 19:48:31 +0000 (21:48 +0200)]
migration: log: s/migration_caps/migration capabilities/

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomigration: do not set default speed limit
Thomas Lamprecht [Mon, 19 Apr 2021 19:46:49 +0000 (21:46 +0200)]
migration: do not set default speed limit

the claim that QEMU limits this to 32M otherwise is bogus, at least
with any current QEMU version..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomigration: refactor and tidy-up code
Thomas Lamprecht [Mon, 19 Apr 2021 12:56:12 +0000 (14:56 +0200)]
migration: refactor and tidy-up code

Use an early die so that the rest can loose an indentation level for
the actual migration status reporting code

Extract common used members of the stat hash for shorter code.

use `git show -w --word-diff=color --word-diff-regex='\w+'` for
getting a better view of actual changes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomigration: move finishing block jobs to phase2 for better/uniform error handling
Fabian Ebner [Fri, 29 Jan 2021 15:11:43 +0000 (16:11 +0100)]
migration: move finishing block jobs to phase2 for better/uniform error handling

avoids the possibility to die during phase3_cleanup and instead of needing to
duplicate the cleanup ourselves, benefit from phase2_cleanup doing so.

The duplicate cleanup was also very incomplete: it didn't stop the remote kvm
process (leading to 'VM already running' when trying to migrate again
afterwards), but it removed its disks, and it didn't unlock the config, didn't
close the tunnel and didn't cancel the block-dirty bitmaps.

Since migrate_cancel should do nothing after the (non-storage) migrate process
has completed, even that cleanup step is fine here.

Since phase3 is empty at the moment, the order of operations is still the same.

Also add a test, that would complain about finish_tunnel not being called before
this patch. That test also checks that local disks are not already removed
before finishing the block jobs.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: split out replication from scan_local_volumes
Fabian Ebner [Fri, 29 Jan 2021 15:11:42 +0000 (16:11 +0100)]
migration: split out replication from scan_local_volumes

and avoid one loop over the config, by extending foreach_volid to include the
drivename.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: keep track of replicated volumes via local_volumes
Fabian Ebner [Fri, 29 Jan 2021 15:11:41 +0000 (16:11 +0100)]
migration: keep track of replicated volumes via local_volumes

by extending filter_local_volumes.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: use storage_migration for checks instead of online_local_volumes
Fabian Ebner [Fri, 29 Jan 2021 15:11:40 +0000 (16:11 +0100)]
migration: use storage_migration for checks instead of online_local_volumes

Like this we don't need to worry about auto-vivifaction.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: cleanup_remotedisks: simplify and include more disks
Fabian Ebner [Fri, 29 Jan 2021 15:11:39 +0000 (16:11 +0100)]
migration: cleanup_remotedisks: simplify and include more disks

Namely, those migrated with storage_migrate by using the information from
volume_map. Call cleanup_remotedisks in phase1_cleanup as well, because that's
where we end if sync_offline_local_volumes fails, and some disks might already
have been transfered successfully. Note that the local disks are still here, so
this is fine.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: simplify removal of local volumes and get rid of self->{volumes}
Fabian Ebner [Fri, 29 Jan 2021 15:11:38 +0000 (16:11 +0100)]
migration: simplify removal of local volumes and get rid of self->{volumes}

This also changes the behavior to remove the local copies of offline migrated
volumes only after the migration has finished successfully (this is relevant
for mixed settings, e.g. online migration with unused/vmstate disks).

local_volumes contains both, the volumes previously in $self->{volumes}
and the volumes in $self->{online_local_volumes}, and hence is the place
to look for which volumes we need to remove. Of course, replicated
volumes still need to be skipped.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: add nbd migrated volumes to volume_map earlier
Fabian Ebner [Fri, 29 Jan 2021 15:11:37 +0000 (16:11 +0100)]
migration: add nbd migrated volumes to volume_map earlier

and avoid a little bit of duplication by creating a helper

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: save targetstorage and bwlimit in local_volumes hash and re-use information
Fabian Ebner [Fri, 29 Jan 2021 15:11:36 +0000 (16:11 +0100)]
migration: save targetstorage and bwlimit in local_volumes hash and re-use information

It is enough to call get_bandwith_limit once for each source_storage.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: fix calculation of bandwith limit for non-disk migration
Fabian Ebner [Fri, 29 Jan 2021 15:11:35 +0000 (16:11 +0100)]
migration: fix calculation of bandwith limit for non-disk migration

The case with:
1. no generic 'migration' limit from the storage plugin
2. a migrate_speed limit in the VM config
was broken. It would assign 0 to migrate_speed when picking the minimum value
and then default to the default value. Fix it by checking if bwlimit is 0
before picking the minimum.

Also, make it a bit more readable by avoiding the trick of //-assigning bwlimit
before the units match up and relying on getting back the original bwlimit value
as the minimum. Instead, only ||-assign after the units match up and don't rely
on other things.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: split out config_update_local_disksizes from scan_local_volumes
Fabian Ebner [Fri, 29 Jan 2021 15:11:34 +0000 (16:11 +0100)]
migration: split out config_update_local_disksizes from scan_local_volumes

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: avoid re-scanning all volumes
Fabian Ebner [Fri, 29 Jan 2021 15:11:33 +0000 (16:11 +0100)]
migration: avoid re-scanning all volumes

by using the information obtained in the first scan. This
also makes sure we only scan local storages.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agomigration: split sync_disks into two functions
Fabian Ebner [Fri, 29 Jan 2021 15:11:32 +0000 (16:11 +0100)]
migration: split sync_disks into two functions

by making local_volumes class-accessible. One functions is for scanning all local
volumes and one is for actually syncing offline volumes via storage_migrate. The
exception is replicated volumes, this still happens during the scan for now.

Also introduce a filter_local_volumes helper, to makes life easier.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agotest: migration: add parse_volume_id calls
Fabian Ebner [Fri, 29 Jan 2021 15:11:31 +0000 (16:11 +0100)]
test: migration: add parse_volume_id calls

so it fails when something bad comes in.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agorestore: update config: remove unused parameter
Fabian Ebner [Thu, 18 Mar 2021 09:44:50 +0000 (10:44 +0100)]
restore: update config: remove unused parameter

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agotest: add tests for restoring config
Fabian Ebner [Thu, 18 Mar 2021 09:44:49 +0000 (10:44 +0100)]
test: add tests for restoring config

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agod/control: bump pve-storage dependency for new vdisk param
Thomas Lamprecht [Sun, 18 Apr 2021 16:04:29 +0000 (18:04 +0200)]
d/control: bump pve-storage dependency for new vdisk param

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofilter by content type when using vdisk_list
Fabian Ebner [Mon, 22 Mar 2021 14:32:43 +0000 (15:32 +0100)]
filter by content type when using vdisk_list

except for migration, where it would be subtly backwards-incompatible. Since
there is a scan_volids call for migration, we can't default to filtering in
scan_volids just yet.

Also allows to get rid of the existing filtering hack in rescan().

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agocfg2cmd: fix +pveN machine types with pxe
Stefan Reiter [Wed, 31 Mar 2021 14:39:23 +0000 (16:39 +0200)]
cfg2cmd: fix +pveN machine types with pxe

Pinned machine versions like "pc-i440fx-4.2+pve2.pxe" would otherwise
get a second "+pve0" suffix, which is incorrect.

Also deal with non-pve pinned versions correctly, i.e.
"pc-i440fx-5.2.pxe" becomes "pc-i440fx-5.2+pve0.pxe".

Handle .pxe suffixes in Machine.pm as well, and add two test cases.

Co-developed-by: Luca Berneking <luca@berneking.net>
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodrive: volume in-use check: fix fallback path comparison
Fabian Ebner [Thu, 15 Apr 2021 10:10:57 +0000 (12:10 +0200)]
drive: volume in-use check: fix fallback path comparison

When checking whether a volume is still referenced by a snapshot, the volid
itself is first checked. When the volid is different, we fall back to comparing
the path.

As the first value to be compared is a volume's path, the second value better be
a volume's path too, and not a snapshot's path.

See also 77019edfe0c190c949cdc0b0e3b4ad2ca37313b3 for historical context.

The error that led me here:
* had a VM with ZFS over iSCSI storage with an exsiting snapshot
* add new unused drive
* try to remove the unsued drive
* fails, because ZFS (not Pool!) Plugin does not support snapshot paths.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 6.3-11
Thomas Lamprecht [Thu, 15 Apr 2021 16:32:10 +0000 (18:32 +0200)]
bump version to 6.3-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodrive mirror: stop logging progress for a disk after it got ready
Thomas Lamprecht [Thu, 15 Apr 2021 15:52:52 +0000 (17:52 +0200)]
drive mirror: stop logging progress for a disk after it got ready

If, why ever, got "not-ready" again we'd log again the next round.

Improves the behavior for multiple disks, especially on migration
where we mirrored the local disks one by one, but kept reporting on
prev. ones.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoimage convert: use human-readable units in progress report
Thomas Lamprecht [Thu, 15 Apr 2021 15:51:01 +0000 (17:51 +0200)]
image convert: use human-readable units in progress report

similar to what driver mirror monitor was changed too

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoindentation line-length cleanup
Thomas Lamprecht [Thu, 15 Apr 2021 15:50:13 +0000 (17:50 +0200)]
indentation line-length cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorestore PBS: use actual PVE::QemuConfig interface for destroying a config on error
Thomas Lamprecht [Tue, 6 Apr 2021 17:43:44 +0000 (19:43 +0200)]
restore PBS: use actual PVE::QemuConfig interface for destroying a config on error

avoid further spaghettification of our code base...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs_live_restore: code cleanup, avoid prefixin local package
Thomas Lamprecht [Tue, 6 Apr 2021 17:43:03 +0000 (19:43 +0200)]
pbs_live_restore: code cleanup, avoid prefixin local package

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomirror monitor: rework periodic status reporting
Thomas Lamprecht [Tue, 6 Apr 2021 17:39:41 +0000 (19:39 +0200)]
mirror monitor: rework periodic status reporting

orient on the backup output which got reworked for PVE 6.2/6.3

Avoid overwhelming the user with redundant information, and use human
readable units.

before:
> restore-drive-scsi5: transferred: 167772160 bytes remaining: 8422162432 bytes total: 8589934592 bytes progression: 1.95 % busy: 1 ready: 0

after:
> restore-drive-scsi0: transferred 720.0 MiB of 32.0 GiB (2.20%) in 12s

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolive restore: slightly more status output
Thomas Lamprecht [Tue, 6 Apr 2021 17:38:53 +0000 (19:38 +0200)]
live restore: slightly more status output

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomirror monitor: avoid overlong hash access, use intermediate variable
Thomas Lamprecht [Tue, 6 Apr 2021 15:46:19 +0000 (17:46 +0200)]
mirror monitor: avoid overlong hash access, use intermediate variable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomirror monitor: refactoring/code cleanup
Thomas Lamprecht [Tue, 6 Apr 2021 14:59:14 +0000 (16:59 +0200)]
mirror monitor: refactoring/code cleanup

mostly s/\$job/$job_id/ and s/foreach/for/ + sort.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolive restore: start/delete blockdev jobs in deterministic order
Thomas Lamprecht [Tue, 6 Apr 2021 14:51:04 +0000 (16:51 +0200)]
live restore: start/delete blockdev jobs in deterministic order

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: restore: better error messages
Thomas Lamprecht [Tue, 6 Apr 2021 08:15:20 +0000 (10:15 +0200)]
api: restore: better error messages

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: restore: start and live-restore do not conflict
Thomas Lamprecht [Tue, 6 Apr 2021 08:12:47 +0000 (10:12 +0200)]
api: restore: start and live-restore do not conflict

if live-restore is set then the VM is actually started before, so we
can just skip it..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoprint drive: prefix drive-ID on errors
Thomas Lamprecht [Tue, 6 Apr 2021 08:12:08 +0000 (10:12 +0200)]
print drive: prefix drive-ID on errors

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolive-restore: register qmeventd handle
Stefan Reiter [Wed, 3 Mar 2021 09:56:11 +0000 (10:56 +0100)]
live-restore: register qmeventd handle

Similar to backups, prevent QEMU from being killed by qmeventd during
the live-restore, so a guest can shut itself down without aborting the
restore operation.

Note that the 'close' is only to be explicit, the handle will also be
closed in case an operation errors (i.e. when the 'eval' is left).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoextract register_qmeventd_handle to QemuServer.pm
Stefan Reiter [Wed, 3 Mar 2021 09:56:10 +0000 (10:56 +0100)]
extract register_qmeventd_handle to QemuServer.pm

...to be reused by live-restore.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoenable live-restore for PBS
Stefan Reiter [Wed, 3 Mar 2021 09:56:09 +0000 (10:56 +0100)]
enable live-restore for PBS

Enables live-restore functionality using the 'alloc-track' QEMU driver.
This allows starting a VM immediately when restoring from a PBS
snapshot. The snapshot is mounted into the VM, so it can boot from that,
while guest reads and a 'block-stream' job handle the restore in the
background.

If an error occurs, the VM is deleted and all data written during the
restore is lost.

The VM remains locked during the restore, which automatically prohibits
any modifications to the config while restoring. Some modifications
might potentially be safe, however, this is experimental enough that I
believe this would cause more bad stuff(tm) than actually satisfy any
use cases.

Pool handling is slightly adjusted so the VM can be added to the pool
before the restore starts.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agocfg2cmd: allow PBS snapshots as backing files for drives
Stefan Reiter [Wed, 3 Mar 2021 09:56:08 +0000 (10:56 +0100)]
cfg2cmd: allow PBS snapshots as backing files for drives

Uses the custom 'alloc-track' filter node to redirect writes to the
original drives target, while unwritten blocks will be read from the
specified PBS snapshot.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agomake qemu_drive_mirror_monitor more generic
Stefan Reiter [Wed, 3 Mar 2021 09:56:07 +0000 (10:56 +0100)]
make qemu_drive_mirror_monitor more generic

...so it works with other block jobs as well. Intended use case is
block-stream, which also requires a new "auto" (wait only) completion
mode, since it finishes automatically anyway.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agobump version to 6.3-10
Thomas Lamprecht [Tue, 30 Mar 2021 16:41:03 +0000 (18:41 +0200)]
bump version to 6.3-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoschema: mention special syntax for allocating a new volume
Fabian Ebner [Tue, 2 Mar 2021 12:02:04 +0000 (13:02 +0100)]
schema: mention special syntax for allocating a new volume

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agofix #2670: cloudinit enable SLAAC
Mira Limbeck [Mon, 29 Mar 2021 12:07:15 +0000 (14:07 +0200)]
fix #2670: cloudinit enable SLAAC

cloud-init's SLAAC option was disabled in 2018 because there was no
support for it. Now that cloud-init 19.4 or newer versions are more
widespread, we can finally reenable it.

Also include minimum required cloud-init version for SLAAC support in
format description.

Tested on Ubuntu 20.04 (ci 20.4), CentOS 8 (ci 19.4), Debian 10 (ci
20.2).

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
3 years agofix #3314: IPv6 requires type 'static6'
Mira Limbeck [Mon, 29 Mar 2021 12:07:14 +0000 (14:07 +0200)]
fix #3314: IPv6 requires type 'static6'

A fix was also provided in bugzilla by user wsapplegate:
https://bugzilla.proxmox.com/show_bug.cgi?id=3314

Tested on Ubuntu 20.04, CentOS 8 and Debian 10.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
3 years agoincrease timeout for QMP block_resize
Stefan Reiter [Tue, 30 Mar 2021 15:59:52 +0000 (17:59 +0200)]
increase timeout for QMP block_resize

In testing this usually completes almost immediately, but in theory this
is a storage/IO operation and as such can take a bit to finish. It's
certainly not unthinkable that it might take longer than the default *3
seconds* we've given it so far. Make it a minute.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agobump version to 6.3-9
Thomas Lamprecht [Fri, 26 Mar 2021 08:47:34 +0000 (09:47 +0100)]
bump version to 6.3-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: improve error logging for query-proxmox-support
Stefan Reiter [Wed, 17 Mar 2021 10:19:35 +0000 (11:19 +0100)]
vzdump: improve error logging for query-proxmox-support

Only show "not supported by QEMU version" message if we determine that
to be the actual cause, just print the error otherwise.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoapi: migrate: fix variable name
Fabian Ebner [Tue, 23 Mar 2021 09:15:23 +0000 (10:15 +0100)]
api: migrate: fix variable name

Commit abff03211f28018ce193911173afa39ba1a6ff24 switched to iterating over the
values instead of the keys, but didn't update the variable name. Use target_sid,
because target is already in use for the target node.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agosnapshot: set migration caps before savevm-start
Stefan Reiter [Tue, 16 Mar 2021 16:30:23 +0000 (17:30 +0100)]
snapshot: set migration caps before savevm-start

A "savevm" call (both our async variant and the upstream sync one) use
migration code internally. As such, they both expect migration
capabilities to be set.

This is usually not a problem, as the default set of capabilities is ok,
however, it leads to differing snapshot settings if one does a snapshot
after a machine has been live-migrated (as the capabilities will persist
from that), which could potentially lead to discrepencies in snapshots
(currently it seems to be fine, but it still makes sense to set them to
safeguard against future changes).

Note that we do set the "dirty-bitmaps" capability now (if
query-proxmox-support reports true), which has three effects:

1) PBS dirty-bitmaps are preserved in snapshots, enabling
   fast-incremental backups to work after rollback (as long as no newer
   backups exist), including for hibernate/resume
2) snapshots taken from now on, with a QEMU version supporting bitmap
   migration, *might* lead to incompatibility of these snapshots with
   QEMU versions that don't know about bitmaps at all (i.e. < 5.0 IIRC?)
   - forward compatibility is still given, and all other capabilities we
   set go back to very old versions
3) since we now explicitly disable bitmap saving if the version doesn't
   report support, we avoid crashes even with not-updated QEMU versions

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agorestore vma: fix applying storage-specific bandwidth limit
Fabian Ebner [Mon, 15 Mar 2021 11:57:27 +0000 (12:57 +0100)]
restore vma: fix applying storage-specific bandwidth limit

At this stage, there are no keys in %storage_limits to iterate over. The
refactoring in commit 9f3d73bc353c79f84498122b779764184f504005 broke the logic
by accident.

Also explicitly set zero if there is no limit to avoid repeating the
get_bandwith_limit call for the same storage. When accessing the value later,
zero is already correctly handled as 'no limit'.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 6.3-8
Thomas Lamprecht [Fri, 12 Mar 2021 09:01:16 +0000 (10:01 +0100)]
bump version to 6.3-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoimprove windows VM version pinning on VM creation
Thomas Lamprecht [Fri, 12 Mar 2021 08:58:12 +0000 (09:58 +0100)]
improve windows VM version pinning on VM creation

unify code paths to ensure more consistent behavior, especially on
future changes.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoqm status: sort hash keys on verbose output
Thomas Lamprecht [Thu, 11 Mar 2021 14:04:26 +0000 (15:04 +0100)]
qm status: sort hash keys on verbose output

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.3-7
Thomas Lamprecht [Tue, 9 Mar 2021 07:21:50 +0000 (08:21 +0100)]
bump version to 6.3-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorestore: write new config to variable first
Fabian Ebner [Mon, 8 Mar 2021 12:26:57 +0000 (13:26 +0100)]
restore: write new config to variable first

and use file_set_contents to really commit it afterwards. Mostly done as a
preparation for the later patch for sanitizing the config on restore, but
shouldn't hurt by itself either.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
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>