Commit Graph

2713 Commits

Author SHA1 Message Date
Fabian Ebner
93a1c63f4c test: migration: add parse_volume_id calls
so it fails when something bad comes in.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-04-18 18:30:41 +02:00
Fabian Ebner
eabac302ba restore: update config: remove unused parameter
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-04-18 18:10:28 +02:00
Fabian Ebner
c62d7cf547 test: add tests for restoring config
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-04-18 18:10:28 +02:00
Thomas Lamprecht
41ab78c626 d/control: bump pve-storage dependency for new vdisk param
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-18 18:04:29 +02:00
Fabian Ebner
d0ff75d9b4 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>
2021-04-18 18:03:44 +02:00
Stefan Reiter
d4be7f31b5 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>
2021-04-18 17:58:56 +02:00
Fabian Ebner
a0d8d8592a 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 77019edfe0 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>
2021-04-18 17:26:05 +02:00
Thomas Lamprecht
04fac98acc bump version to 6.3-11
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-15 18:32:10 +02:00
Thomas Lamprecht
67daf6921b 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>
2021-04-15 17:52:54 +02:00
Thomas Lamprecht
b5e9d97bdf 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>
2021-04-15 17:51:04 +02:00
Thomas Lamprecht
fd70c84362 indentation line-length cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-15 17:50:13 +02:00
Thomas Lamprecht
bb419195f9 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>
2021-04-06 19:43:47 +02:00
Thomas Lamprecht
bfb1267858 pbs_live_restore: code cleanup, avoid prefixin local package
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-06 19:43:03 +02:00
Thomas Lamprecht
3b56383bdb 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>
2021-04-06 19:40:21 +02:00
Thomas Lamprecht
a09b39f163 live restore: slightly more status output
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-06 19:40:08 +02:00
Thomas Lamprecht
1057fc7436 mirror monitor: avoid overlong hash access, use intermediate variable
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-06 17:46:19 +02:00
Thomas Lamprecht
0ea24bf080 mirror monitor: refactoring/code cleanup
mostly s/\$job/$job_id/ and s/foreach/for/ + sort.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-06 16:59:18 +02:00
Thomas Lamprecht
8986e36e85 live restore: start/delete blockdev jobs in deterministic order
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-06 16:51:04 +02:00
Thomas Lamprecht
b973806ef1 api: restore: better error messages
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-06 10:20:26 +02:00
Thomas Lamprecht
a0e27afb5e 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>
2021-04-06 10:12:49 +02:00
Thomas Lamprecht
a183df68a5 print drive: prefix drive-ID on errors
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-06 10:12:08 +02:00
Stefan Reiter
26697640d6 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>
2021-04-01 10:58:13 +02:00
Stefan Reiter
65911545dd extract register_qmeventd_handle to QemuServer.pm
...to be reused by live-restore.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2021-04-01 10:58:13 +02:00
Stefan Reiter
26731a3c15 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>
2021-04-01 10:58:13 +02:00
Stefan Reiter
5921764c26 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>
2021-04-01 10:58:13 +02:00
Stefan Reiter
9e67172296 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>
2021-04-01 10:58:13 +02:00
Thomas Lamprecht
43bf6fc982 bump version to 6.3-10
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-30 18:41:03 +02:00
Fabian Ebner
98c3d99e64 schema: mention special syntax for allocating a new volume
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-03-30 18:37:16 +02:00
Mira Limbeck
988be8d052 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>
2021-03-30 18:25:06 +02:00
Mira Limbeck
617a864ac2 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>
2021-03-30 18:25:06 +02:00
Stefan Reiter
190c846141 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>
2021-03-30 18:20:44 +02:00
Thomas Lamprecht
6fb2887644 bump version to 6.3-9
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-26 09:47:34 +01:00
Stefan Reiter
2cfb09053c 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>
2021-03-24 06:51:40 +01:00
Fabian Ebner
bd61033e30 api: migrate: fix variable name
Commit abff03211f 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>
2021-03-24 06:51:40 +01:00
Stefan Reiter
27a5be5376 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>
2021-03-16 20:44:51 +01:00
Fabian Ebner
c89642784d 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 9f3d73bc35 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>
2021-03-15 13:22:58 +01:00
Thomas Lamprecht
8e6bcc507a bump version to 6.3-8
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-12 10:01:16 +01:00
Thomas Lamprecht
0761e6194a 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>
2021-03-12 10:00:46 +01:00
Thomas Lamprecht
7f0285e133 qm status: sort hash keys on verbose output
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-11 15:04:26 +01:00
Thomas Lamprecht
31c8e14bf2 bump version to 6.3-7
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-09 08:21:50 +01:00
Fabian Ebner
98a4b3fbc4 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>
2021-03-08 17:10:49 +01:00
Stefan Reiter
46b676c0b1 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>
2021-03-08 17:10:07 +01:00
Thomas Lamprecht
533cde8f33 bump version to 6.3-6
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-05 21:43:05 +01:00
Fabian Ebner
0761ee013f 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
165be267eb and
e30f75c571 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>
2021-03-05 21:15:23 +01:00
Thomas Lamprecht
4dd1e83c75 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>
2021-03-05 20:46:46 +01:00
Thomas Lamprecht
1f5828f2de 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>
2021-03-05 20:45:21 +01:00
Thomas Lamprecht
9edb618257 can_run_pve_machine_version: PVE version can really be optional
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-05 18:49:06 +01:00
Thomas Lamprecht
36b0269724 api: machine list: parse as JSON
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-05 16:33:08 +01:00
Stefan Reiter
304e51d369 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>
2021-03-05 16:25:28 +01:00
Fabian Ebner
949112c350 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>
2021-03-04 13:57:17 +01:00