]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
2 years agoclone disk: pass in efi vars size rather than config
Fabian Ebner [Wed, 9 Mar 2022 10:09:08 +0000 (11:09 +0100)]
clone disk: pass in efi vars size rather than config

It's confusing that the config associated to the destination is
actually a reference to the source config for both existing callers.

Also, disk import will need to base the calculation on the passed-in
drive parameters and not just the current config, so this change is in
preparation for that too.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: group source and target parameters
Fabian Ebner [Wed, 9 Mar 2022 10:09:07 +0000 (11:09 +0100)]
clone disk: group source and target parameters

to make the interface more digestible.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: remove check for min QEMU version 2.7
Fabian Ebner [Wed, 9 Mar 2022 10:09:06 +0000 (11:09 +0100)]
clone disk: remove check for min QEMU version 2.7

Upgrading a cluster node entails re-starting or migrating VMs and even
PVE 6.0 already had QEMU 4.0.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: update: pass correct config when creating disks
Fabian Ebner [Wed, 9 Mar 2022 10:09:05 +0000 (11:09 +0100)]
api: update: pass correct config when creating disks

While the new options should be written to the pending config, the
decisions (currently only one) in create_disks needs to be made for
the current config.

Seems to fix EFI disk creation, but actually, it's only
future-proofing, because, currently, the same OVMF_VARS file is
used independently of $smm.

The correct config is also needed to determine the correct size for
the EFI disk for the upcoming import-from feature.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: create disks: always activate/update size when attaching existing volume
Fabian Ebner [Wed, 9 Mar 2022 10:09:04 +0000 (11:09 +0100)]
api: create disks: always activate/update size when attaching existing volume

For creation, activation and size update never triggered, because the
passed in $conf is essentially the same as the creation $settings, so
the disk was always detected to be the same as the "existing" one. But
actually, all disks are new, so it makes sense to do it.

For update, activation and size update nearly always triggered,
because only the pending changes are passed in as $conf. The case
where it didn't trigger is when the same pending change was made twice
(there are cases where hotplug isn't done, but makes it even more
unlikely).

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodevice unplug: verify that unplugging scsi disk completed
Fabian Ebner [Wed, 9 Mar 2022 10:09:03 +0000 (11:09 +0100)]
device unplug: verify that unplugging scsi disk completed

Avoids the error
  adding drive failed: Duplicate ID 'drive-scsi1' for drive
that could happen when switching over to a new disk (e.g. via qm set),
if unplugging wasn't fast enough.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: vm_start: 'force-cpu' is for internal migration use only
Oguz Bektas [Mon, 7 Mar 2022 13:20:25 +0000 (14:20 +0100)]
api: vm_start: 'force-cpu' is for internal migration use only

'force-cpu' parameter was introduced to allow live-migration of VMs with
custom CPU models; it does not need to be allowed for general use on
vm_start for regular users, since they would be able to set arbitrary
cpu types or cpuid parameters that aren't supported.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2 years agoqmp client: increase timeout for thaw
Fabian Ebner [Wed, 2 Mar 2022 13:21:07 +0000 (14:21 +0100)]
qmp client: increase timeout for thaw

Using a loop of freeze, sleep 5, thaw, sleep 5, an idling Windows 11
VM with 4 cores and 8GiB RAM once took 54 seconds for thawing. It took
less than a second about 90% of the time and maximum of a few seconds
for the majortiy of other cases, but there can be outliers where 10
seconds is not enough.

And there can be hookscripts executed upon thaw, which might also not
complete instantly.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agorestore: remove duplicate check
Fabian Ebner [Fri, 25 Feb 2022 08:58:16 +0000 (09:58 +0100)]
restore: remove duplicate check

The refactoring in 36d4bdcb8621fb85a520fda5e9e948dcdc9c60c6 missed
this. The check is already done as part of the following check_storage
call.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agofix #3733: add 20 seconds timeout when VM backup stopped
Moayad Almalat [Wed, 23 Feb 2022 09:03:24 +0000 (10:03 +0100)]
fix #3733: add 20 seconds timeout when VM backup stopped

2 years agorestore: factor out common early checks into closure
Thomas Lamprecht [Thu, 24 Feb 2022 12:29:42 +0000 (13:29 +0100)]
restore: factor out common early checks into closure

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorestore: early check cloud init target AllocateSpace permission
Thomas Lamprecht [Thu, 24 Feb 2022 12:21:55 +0000 (13:21 +0100)]
restore: early check cloud init target AllocateSpace permission

Originally-by: Matthias Heiserer <m.heiserer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3886: QEMU restore: verify storage allows images before writing
Matthias Heiserer [Thu, 24 Feb 2022 10:45:59 +0000 (11:45 +0100)]
fix #3886: QEMU restore: verify storage allows images before writing

When restoring a backup and the storage the disks would be created on
doesn't allow 'images', the process errors without cleanup.
This is the same behaviour we currently have when the storage is
disabled.

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone disk: force raw format for TPM state
Fabian Ebner [Wed, 16 Feb 2022 10:47:49 +0000 (11:47 +0100)]
clone disk: force raw format for TPM state

The format can't be qcow2 for TPM state, because swtpm reads the file
directly expecting raw data.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agofix #3845: also clamp cpu units to cgroup dependent valid range on hotplug
Thomas Lamprecht [Fri, 11 Feb 2022 08:31:12 +0000 (09:31 +0100)]
fix #3845: also clamp cpu units to cgroup dependent valid range on hotplug

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig2cmd: drop unused get_cpuunits call
Thomas Lamprecht [Fri, 11 Feb 2022 08:30:22 +0000 (09:30 +0100)]
config2cmd: drop unused get_cpuunits call

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocpu units: lower minimum for accessing full cgroupv2 range
Thomas Lamprecht [Fri, 11 Feb 2022 08:29:50 +0000 (09:29 +0100)]
cpu units: lower minimum for accessing full cgroupv2 range

also clamp that up in the v1 case for compat.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocpu units: handle clamping more centrally
Thomas Lamprecht [Fri, 11 Feb 2022 08:28:26 +0000 (09:28 +0100)]
cpu units: handle clamping more centrally

preparation for also clamping on hotplug and lower the minimum in the
schema so that the full v2 range can be used.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: qga file-write: drop the check for base64
Thomas Lamprecht [Thu, 10 Feb 2022 15:27:55 +0000 (16:27 +0100)]
api: qga file-write: drop the check for base64

it's potentially expensive to check and the user already needs to
explicitly turn auto-encoding off, besides QEMU/QGA should handle
that and just error out gracefully on bogus base64 values.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: qga file-write: code/style cleanups/refactoring
Thomas Lamprecht [Thu, 10 Feb 2022 15:26:53 +0000 (16:26 +0100)]
api: qga file-write: code/style cleanups/refactoring

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3683: agent file-write: enable user to encode the content themselves
Dominik Csapak [Thu, 10 Feb 2022 14:52:10 +0000 (15:52 +0100)]
fix #3683: agent file-write: enable user to encode the content themselves

by adding an optional parameter 'encode' (enabled by default). When it
is disabled, the content must be base64 encoded already. This
way, users can send a binary file to the vm by base64 encoding it
themselves

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agomigrate: move tunnel-helpers to pve-guest-common
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:42 +0000 (14:07 +0100)]
migrate: move tunnel-helpers to pve-guest-common

besides the log calls these don't need any parts of the migration state,
so let's make them generic and re-use them for container migration and
replication in the future.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agonbd alloc helper: allow passing in explicit format
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:41 +0000 (14:07 +0100)]
nbd alloc helper: allow passing in explicit format

and make $volname optional, to support remote migration usage without
code duplication.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoupdate_vm: allow simultaneous setting of boot-order and dev
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:40 +0000 (14:07 +0100)]
update_vm: allow simultaneous setting of boot-order and dev

else this fails if we check 'boot' before the device was put into
the config or pending section.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoparse_config: optional strict mode
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:39 +0000 (14:07 +0100)]
parse_config: optional strict mode

when passing a config from one cluster to another, we want to be strict
when parsing - it's better to fail the migration early and upgrade the
target node instead of failing the migration later (when significant
work for transferring disks and/or state has already been done) or not
at all, but silently lose config settings that the target doesn't
understand.

this also might be helpful in other cases - e.g. when restoring from a
backup.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoschema: use pve-bridge-id
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:38 +0000 (14:07 +0100)]
schema: use pve-bridge-id

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agod/control: bump versioned (build-)dependency of libpve-common-perl
Thomas Lamprecht [Wed, 9 Feb 2022 17:47:03 +0000 (18:47 +0100)]
d/control: bump versioned (build-)dependency of libpve-common-perl

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove map_storage to PVE::JSONSchema::map_id
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:37 +0000 (14:07 +0100)]
move map_storage to PVE::JSONSchema::map_id

since we are going to reuse the same mechanism/code for network bridge
mapping and pve-container.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agod/control: bump (build-)dependency of libpve-guest-common-perl
Thomas Lamprecht [Wed, 9 Feb 2022 17:45:48 +0000 (18:45 +0100)]
d/control: bump (build-)dependency of libpve-guest-common-perl

to get new helpers for snapshot

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoagent: code style fix
Thomas Lamprecht [Wed, 9 Feb 2022 17:45:14 +0000 (18:45 +0100)]
agent: code style fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosnapshot: implement __snapshot_activate_storages
Fabian Ebner [Thu, 13 Jan 2022 11:04:02 +0000 (12:04 +0100)]
snapshot: implement __snapshot_activate_storages

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone: repeat more checks after locking
Fabian Grünbichler [Tue, 8 Feb 2022 08:00:31 +0000 (09:00 +0100)]
clone: repeat more checks after locking

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoclone disk: don't modify drive parameter
Fabian Ebner [Thu, 27 Jan 2022 14:01:55 +0000 (15:01 +0100)]
clone disk: don't modify drive parameter

While existing callers are not using the parameter after the call,
the modification is rather unexpected and could lead to bugs quickly.

Also avoid setting an undef value in the hash, but use delete instead.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: move disk: fork before locking
Fabian Ebner [Thu, 27 Jan 2022 14:01:54 +0000 (15:01 +0100)]
api: move disk: fork before locking

using the familiar early+repeated checks pattern from other API calls.
Only intended functional changes are with regard to locking/forking.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: clone: fork before locking
Fabian Ebner [Thu, 27 Jan 2022 14:01:53 +0000 (15:01 +0100)]
api: clone: fork before locking

using the familiar early+repeated checks pattern from other API calls.
Only intended functional changes are with regard to locking/forking.

For a full clone of a running VM without guest agent, this also fixes
issuing vm_{resume,suspend} calls for drive mirror completion.
Previously, those just timed out, because of not getting the lock:

> create full clone of drive scsi0 (rbdkvm:vm-104-disk-0)
> Formatting '/var/lib/vz/images/105/vm-105-disk-0.raw', fmt=raw
> size=4294967296 preallocation=off
> drive mirror is starting for drive-scsi0
> drive-scsi0: transferred 2.0 MiB of 4.0 GiB (0.05%) in 0s
> drive-scsi0: transferred 635.0 MiB of 4.0 GiB (15.50%) in 1s
> drive-scsi0: transferred 1.6 GiB of 4.0 GiB (40.50%) in 2s
> drive-scsi0: transferred 3.6 GiB of 4.0 GiB (90.23%) in 3s
> drive-scsi0: transferred 4.0 GiB of 4.0 GiB (100.00%) in 4s, ready
> all 'mirror' jobs are ready
> suspend vm
> trying to acquire lock...
> can't lock file '/var/lock/qemu-server/lock-104.conf' - got timeout
> drive-scsi0: Cancelling block job
> drive-scsi0: Done.
> resume vm
> trying to acquire lock...
> can't lock file '/var/lock/qemu-server/lock-104.conf' - got timeout

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodrive mirror monitor: warn when suspend/resume/freeze/thaw calls fail
Fabian Ebner [Thu, 27 Jan 2022 14:01:52 +0000 (15:01 +0100)]
drive mirror monitor: warn when suspend/resume/freeze/thaw calls fail

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agopci: allow override of PCI vendor/device ids
Nicholas Sherlock [Tue, 18 Jan 2022 21:38:39 +0000 (21:38 +0000)]
pci: allow override of PCI vendor/device ids

This allows mobile- and vGPUs to be presented to the guest as if they
were the original desktop variants of the card. It also allows
device-ID variants that guests don't know about to be renamed to
match compatible sibling devices the guest does have drivers for
(e.g. to remove manufacturer-specific vendor ID variants that prevent
the use of a device which would otherwise have a supported chipset)

e.g. hostpci0: 03:00,vendor-id=0x8086,device-id=0x10f6

Signed-off-by: Nicholas Sherlock <n.sherlock@gmail.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agofix #3792: cloudinit: use of uninitialized value
Mira Limbeck [Mon, 20 Dec 2021 14:03:59 +0000 (15:03 +0100)]
fix #3792: cloudinit: use of uninitialized value

With the patch adding vendor-data support to cloud-init, a use of
uninitialized value was introduced. This can be fixed by setting it to
an empty string if no vendor-data is defined.

vendor-data can only be set via --cicustom and is optional.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2 years agoavoid writing the config if there are no pending changes to apply
Oguz Bektas [Thu, 2 Dec 2021 11:43:03 +0000 (12:43 +0100)]
avoid writing the config if there are no pending changes to apply

We drop properties which we do not understand and we call
`vmconfig_apply_pending` on stop and before start, so if a user tried
to edit the config or downgraded qemu-server they may get stuff
dropped from the config just by doing a stop/start, which may be a
bit too confusing, also the write is just unnecessary then.

we also have the same skipping logic when starting vms, this way we
avoid calling 'write_config' when there are no present changes to
commit.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2 years agobump version to 7.1-4
Thomas Lamprecht [Mon, 22 Nov 2021 16:07:17 +0000 (17:07 +0100)]
bump version to 7.1-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: send updated TPM state volid to target node
Fabian Grünbichler [Mon, 22 Nov 2021 10:30:11 +0000 (11:30 +0100)]
migrate: send updated TPM state volid to target node

The volid may change if local-storage migration is involved, we need
to tell the target node the new one and update the in-memory config
for starting the target VM accordingly.

Reported here: https://forum.proxmox.com/threads/99906/#post-431345

this possibly breaks migration new -> old iff
- spice is not used (else the explicit ticket wins because it comes
  later)
- a local TPM state volume is used
- that local TPM state volume has a different volume id on the target
  node (switched storage, volname already taken, ..)

because the target node will then mis-interpret the tpmstate0 line as
spice ticket and set it accordingly. if the old tpm state volume ID does
not exist on the target node, migration will fail. if it exists by
chance, it might work albeit with a wrong spice ticket (new because of
this patch) and tpm state volume (pre-existing breakage).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agomigrate: improve start STDIN-parameter parsing
Fabian Grünbichler [Mon, 22 Nov 2021 10:30:10 +0000 (11:30 +0100)]
migrate: improve start STDIN-parameter parsing

only do the compat fallback if no explicit spice ticket was given, and
warn on unknown parameters on STDIN.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agobump version to 7.1-3
Thomas Lamprecht [Tue, 16 Nov 2021 13:04:49 +0000 (14:04 +0100)]
bump version to 7.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: skip tpmstate for NBD migration
Fabian Grünbichler [Tue, 16 Nov 2021 10:52:15 +0000 (11:52 +0100)]
migrate: skip tpmstate for NBD migration

This patch fixes the wrong attempt of setting up an NBD server for
the replicated TPM state volume, in contrast to the other volumes the
TPM state is managed by swtpm and isn't available to QEMU for
block-migration/bitmap tracking.

Note that we do migrate the state volume via a storage migration
anyway if necessary.

This code path was only triggered for replicated VMs with TPM.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.1-2
Thomas Lamprecht [Mon, 15 Nov 2021 15:59:27 +0000 (16:59 +0100)]
bump version to 7.1-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoexclude efidisk and tpmstate for boot disk selection
Dominik Csapak [Mon, 15 Nov 2021 15:56:41 +0000 (16:56 +0100)]
exclude efidisk and tpmstate for boot disk selection

else we cannot create a vm without a disk but with a tpmstate/efidisk,
since the api tries to generate the default bootorder with them included

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agobump version to 7.1-1
Thomas Lamprecht [Mon, 15 Nov 2021 15:27:06 +0000 (16:27 +0100)]
bump version to 7.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopci: do not reserve pci-ids for mediated devices
Dominik Csapak [Mon, 15 Nov 2021 13:07:35 +0000 (14:07 +0100)]
pci: do not reserve pci-ids for mediated devices

else a user cannot use more than one mdev per card per host.
We do not need to reserve them at all, since sysfs will error out
on creation/reuse anyway

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoapi: update: fix missing newline in background-delayed task error
Thomas Lamprecht [Mon, 15 Nov 2021 08:21:48 +0000 (09:21 +0100)]
api: update: fix missing newline in background-delayed task error

this error path is mostly used for re-attaching disks and the like,
and the "check if task is already done" part uses a method to read
the task status that will never include a trailing newline, so add it
our self to avoid "... at /usr/share/perl5/PVE/API2/Qemu.pm line
1480. (500)"

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocfg2cmd: disable SMM when display=none and SeaBIOS is both used
Oguz Bektas [Thu, 11 Nov 2021 12:05:58 +0000 (13:05 +0100)]
cfg2cmd: disable SMM when display=none and SeaBIOS is both used

issue reported in community forum [0][1], like "serial[n]" display we
also need to set this option for "none", otherwise we get a boot
loop.

[0]: https://forum.proxmox.com/threads/99508
[1]: https://forum.proxmox.com/threads/97310/post-427129

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-19
Thomas Lamprecht [Thu, 11 Nov 2021 11:49:13 +0000 (12:49 +0100)]
bump version to 7.0-19

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: move disk: schema indentation and style-nit fixes
Thomas Lamprecht [Thu, 11 Nov 2021 13:00:57 +0000 (14:00 +0100)]
api: move disk: schema indentation and style-nit fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoqm: move-disk: to not make reassign specific options fixed
Thomas Lamprecht [Thu, 11 Nov 2021 12:36:53 +0000 (13:36 +0100)]
qm: move-disk: to not make reassign specific options fixed

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoqm: style/indentation/cleanup fixes for command definition
Thomas Lamprecht [Thu, 11 Nov 2021 12:34:35 +0000 (13:34 +0100)]
qm: style/indentation/cleanup fixes for command definition

and record some possible FIXMEs for a next point/major release

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: bump versioned dependency on libpve-common-perl
Thomas Lamprecht [Thu, 11 Nov 2021 11:40:19 +0000 (12:40 +0100)]
d/control: bump versioned dependency on libpve-common-perl

to ensure the renamed 'storage-pair' is handled correctly..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: factor out storage checks
Fabian Grünbichler [Fri, 5 Nov 2021 13:03:52 +0000 (14:03 +0100)]
migrate: factor out storage checks

to re-use them for incoming remote migrations.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoadapt to renamed storage-pair format
Fabian Grünbichler [Fri, 5 Nov 2021 13:03:51 +0000 (14:03 +0100)]
adapt to renamed storage-pair format

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agod/control: add pve-ha-manager to B-D
Fabian Grünbichler [Fri, 5 Nov 2021 13:03:50 +0000 (14:03 +0100)]
d/control: add pve-ha-manager to B-D

it's needed for tests to succeed.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agocfg2cmd: turn smm off when SeaBIOS and serial display are used
Fabian Ebner [Fri, 5 Nov 2021 13:06:11 +0000 (14:06 +0100)]
cfg2cmd: turn smm off when SeaBIOS and serial display are used

Since commit 277d33454f77ec1d1e0bc04e37621e4dd2424b67 in pve-qemu,
smm=off is no longer the default, but with SeaBIOS and serial display,
this can lead to a boot loop.

Reported in the community forum [0] and reproduced with a Debian 10
VM.

[0]: https://forum.proxmox.com/threads/pve-7-0-all-vms-with-cloud-init-seabios-fail-during-boot-process-bootloop-disk-not-found.97310/post-427129

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodisk reassign: add unused disks directly to config
Aaron Lauterer [Wed, 10 Nov 2021 17:00:13 +0000 (18:00 +0100)]
disk reassign: add unused disks directly to config

Using $update_vm_api for unused disks will cause them to end up as a
pending change if the VM is running.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2 years agodisk reassign: fix assigning to unused slot
Fabian Grünbichler [Wed, 10 Nov 2021 11:41:04 +0000 (12:41 +0100)]
disk reassign: fix assigning to unused slot

this broke with the previous simplification.

Tested-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoreassign disk: more cleanup
Fabian Grünbichler [Wed, 10 Nov 2021 11:11:03 +0000 (12:11 +0100)]
reassign disk: more cleanup

avoid re-using the toplevel variable name

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoreassign disk: fix permission checks
Fabian Grünbichler [Wed, 10 Nov 2021 10:20:20 +0000 (11:20 +0100)]
reassign disk: fix permission checks

with `storage` being optional (and not allowed for reassign operations),
the ACL path in the schema can end up as `/storage/-`, which is wrong.
replace it with an explicit check:

- target `storage` for move disk
- storage from source disk for reassign disk (we only rename here, but
  it's still a new volume on that storage after all)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoreassign disk: various improvements
Fabian Grünbichler [Wed, 10 Nov 2021 10:19:16 +0000 (11:19 +0100)]
reassign disk: various improvements

some style, some missing checks. some duplication reduced a bit.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoapi: move-disk: cleanup very long lines
Aaron Lauterer [Tue, 9 Nov 2021 14:55:36 +0000 (15:55 +0100)]
api: move-disk: cleanup very long lines

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2 years agoapi: move-disk: add move to other VM
Aaron Lauterer [Tue, 9 Nov 2021 14:55:35 +0000 (15:55 +0100)]
api: move-disk: add move to other VM

The goal of this is to expand the move-disk API endpoint to make it
possible to move a disk to another VM. Previously this was only possible
with manual intervertion either by renaming the VM disk or by manually
adding the disks volid to the config of the other VM.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2 years agoDrive: add valid_drive_names_with_unused
Aaron Lauterer [Tue, 9 Nov 2021 14:55:34 +0000 (15:55 +0100)]
Drive: add valid_drive_names_with_unused

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2 years agocli: qm: change move_disk to move-disk
Aaron Lauterer [Tue, 9 Nov 2021 14:55:33 +0000 (15:55 +0100)]
cli: qm: change move_disk to move-disk

also add alias to keep move_disk working.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2 years agoconfig: rollback is possible: add blockers parameter
Fabian Ebner [Thu, 12 Aug 2021 11:01:04 +0000 (13:01 +0200)]
config: rollback is possible: add blockers parameter

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobump version to 7.0-18
Thomas Lamprecht [Thu, 4 Nov 2021 14:30:01 +0000 (15:30 +0100)]
bump version to 7.0-18

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocfg2cmd: switch off ACPI hotplug on bridges for q35 VMs
Thomas Lamprecht [Thu, 21 Oct 2021 07:51:22 +0000 (09:51 +0200)]
cfg2cmd: switch off ACPI hotplug on bridges for q35 VMs

See commit 17858a1695 (hw/acpi/ich9: Set ACPI PCI hot-plug as default
on Q35)[0] in upstream QEMU repository for details about why the change
was made.

As that change affects systemds predictable interface naming[1],
e.g., by going from a previously `ens18` name to `enp6s18`, it may
have rather bad effects for users that did not setup some .link files
to enforce a specific naming by an more stable information like the
NIC's MAC-Address

The alternative would be making the preferred mode of hotplug an
option like `hotplug-mode=<acpi|pcie>`, but it does not seems like
one would like to change that much in the first place...

Note the changes to the tests and especially the tests with q35
machines that did not change.

[0]: https://gitlab.com/qemu-project/qemu/-/commit/17858a1695
[1]: https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html#Naming

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotests: cfg2cmd: add a few q35 related tests
Thomas Lamprecht [Thu, 21 Oct 2021 07:29:00 +0000 (09:29 +0200)]
tests: cfg2cmd: add a few q35 related tests

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: meta: also save the QEMU version installed during creation
Thomas Lamprecht [Thu, 21 Oct 2021 07:19:54 +0000 (09:19 +0200)]
config: meta: also save the QEMU version installed during creation

This is intended to be used to apply some workarounds for the
non-windows ostyped VMs which we'd still like to not pin on a
specific machine version, as normally Linux et al. can cope with such
changes on fresh boot just fine and until now this was a once every
few year issue (albeit systemd's "predictable" interface naming has
some potential to pick up on churn frequency).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: add new meta property with the VM creation time
Thomas Lamprecht [Thu, 21 Oct 2021 07:10:49 +0000 (09:10 +0200)]
config: add new meta property with the VM creation time

currently we only add the creation time (ctime), that was requested
as low priority wish from some users from time to time.

Note that the meta info is not available in the update API endpoints,
and at the moment the code should not change/add/delete it either in
any place.

We may want to update in on actions like clone or backup-restore in
the future, e.g., to also save the time of that event and possibly
the original source VMID, put that can be thought out later.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocloud init: add comment regarding 3 MiB size limit
Thomas Lamprecht [Thu, 4 Nov 2021 12:14:09 +0000 (13:14 +0100)]
cloud init: add comment regarding 3 MiB size limit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Originally-by: Mira Limbeck <m.limbeck@proxmox.com>
2 years agofix #2429: allow to specify cloud-init vendor snippet via cicustom
Constantin Herold [Sat, 30 Oct 2021 14:49:41 +0000 (16:49 +0200)]
fix #2429: allow to specify cloud-init vendor snippet via cicustom

Signed-off-by: Constantin Herold <proxmox8914@herold.me>
Reviewed-by: Mira Limbeck <m.limbeck@proxmox.com>
2 years agoagent hotplug: small style cleanups & comment addition
Thomas Lamprecht [Thu, 4 Nov 2021 07:45:31 +0000 (08:45 +0100)]
agent hotplug: small style cleanups & comment addition

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoqemu-agent: allow hotplug of fstrim_cloned_disk option.
Alexandre Derumier [Wed, 6 Oct 2021 21:58:44 +0000 (23:58 +0200)]
qemu-agent: allow hotplug of fstrim_cloned_disk option.

This option don't have any impact on device itself.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2 years agotest: cfg2cmd: fix command output
Thomas Lamprecht [Wed, 3 Nov 2021 15:45:57 +0000 (16:45 +0100)]
test: cfg2cmd: fix command output

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agovm_commandline: reduce line bloat
Thomas Lamprecht [Wed, 3 Nov 2021 15:21:05 +0000 (16:21 +0100)]
vm_commandline: reduce line bloat

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoprint_keyboarddevice_full: drop unused machine parameter
Thomas Lamprecht [Wed, 3 Nov 2021 15:20:41 +0000 (16:20 +0100)]
print_keyboarddevice_full: drop unused machine parameter

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoscsi_inquiry: refactor and code cleanup
Thomas Lamprecht [Wed, 3 Nov 2021 15:19:10 +0000 (16:19 +0100)]
scsi_inquiry: refactor and code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agokvm_user_version: add explicit return statement
Thomas Lamprecht [Wed, 3 Nov 2021 15:18:00 +0000 (16:18 +0100)]
kvm_user_version: add explicit return statement

while perl returns the (scalar) result of the last expression
automatically its still nicer to explicitly do so..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodrives: ro: code reduction/refactor
Thomas Lamprecht [Wed, 27 Oct 2021 15:00:24 +0000 (17:00 +0200)]
drives: ro: code reduction/refactor

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodrives: expose 'readonly' flag of qemu for scsi/virtio
Dominik Csapak [Wed, 27 Oct 2021 11:35:27 +0000 (13:35 +0200)]
drives: expose 'readonly' flag of qemu for scsi/virtio

this allows a user to set a drive to 'read-only'. This can be useful
if a disk should not be written to, or if the backing file/source is
not writable (like a mapped pbs backup to /dev/loopX).

the option is named 'ro', to achieve consistency with containers

while this could also be achieved by setting 'snapshot=1', this would
create a temporary file in /var/tmp which can get quite big.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agovzdump: increase timeout for QMP 'cont' after backup start
Stefan Reiter [Wed, 27 Oct 2021 11:34:54 +0000 (13:34 +0200)]
vzdump: increase timeout for QMP 'cont' after backup start

Since 'backup' can now work asynchronously, QEMU may not be ready to
receive the next QMP command ('cont') immediately. Thus, increase the
timeout, to avoid aborted backups in slow environments.

There may be a deeper QEMU bug hidden under the covers here too, but at
least one user reported success with simply increasing the timeout:
https://forum.proxmox.com/threads/pve7-pbs2-backup-timeout-qmp-command-cont-failed-got-timeout.95212/page-2#post-426261

See also:
https://bugzilla.proxmox.com/show_bug.cgi?id=3693
https://forum.proxmox.com/threads/problem-seit-update-auf-7-0.97388/
https://forum.proxmox.com/threads/error-with-backup-when-backing-up-qmp-command-query-backup-failed-got-wrong-command-id.88017/page-3#post-416339

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agovm start: only print tpm-related message if there is an instance
Fabian Ebner [Wed, 27 Oct 2021 06:49:37 +0000 (08:49 +0200)]
vm start: only print tpm-related message if there is an instance

Otherwise, this can produce an undef warning and be misleading.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agofix removing cpulimit on running vm
Dominik Csapak [Tue, 12 Oct 2021 11:20:52 +0000 (13:20 +0200)]
fix removing cpulimit on running vm

like in pve-container:
04a62bd ("fix #3506: config: fix removing the cpulimit of a running CT")

reported in the forums (no bug# yet):
https://forum.proxmox.com/threads/issue-with-removing-cpu-limit-from-running-vm.97799/

note that this will break CGv1 without the following fix installed:
https://git.proxmox.com/?p=pve-common.git;a=commitdiff;h=d37a71867

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Oguz Bektas <o.bektas@proxmox.com>
Reviewed-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agouse non SMM ovmf code file for i440fx machines
Dominik Csapak [Mon, 11 Oct 2021 12:10:24 +0000 (14:10 +0200)]
use non SMM ovmf code file for i440fx machines

ovmf with SMM enabled will not boot on i440fx (hangs on graphics
initialization), so load the non SMM variant.

should be no issue regarding live-migration since it never worked with
this anyway.

adapts the test and adds one with q35

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Stefan Reiter <s.reiter@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agobump version to 7.0-17
Thomas Lamprecht [Thu, 21 Oct 2021 09:58:18 +0000 (11:58 +0200)]
bump version to 7.0-17

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig properties: refactor skipping internal options to declarative
Thomas Lamprecht [Thu, 21 Oct 2021 06:23:08 +0000 (08:23 +0200)]
config properties: refactor skipping internal options to declarative

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotests: fixup simple1-template.conf.cmd
Thomas Lamprecht [Wed, 20 Oct 2021 16:18:31 +0000 (18:18 +0200)]
tests: fixup simple1-template.conf.cmd

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocode and indentation cleanups
Thomas Lamprecht [Wed, 20 Oct 2021 15:31:45 +0000 (17:31 +0200)]
code and indentation cleanups

fix the classic indentation error on `additionalProperties` in the
main QEMU API

drop some not so useful empty lines to avoid making rather huge
methods even bigger (more intimidating, less on screen to grasp the
full picture).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig2cmd: code cleanup and indentation reduction
Thomas Lamprecht [Wed, 20 Oct 2021 13:39:20 +0000 (15:39 +0200)]
config2cmd: code cleanup and indentation reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoindentation and fixes
Thomas Lamprecht [Wed, 20 Oct 2021 10:56:57 +0000 (12:56 +0200)]
indentation and fixes

with some style/tw thrown in-between

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix overly long/short lines and typos
Thomas Lamprecht [Wed, 20 Oct 2021 06:24:08 +0000 (08:24 +0200)]
fix overly long/short lines and typos

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoostype: support Windows 11/Server 2022
Stefan Reiter [Mon, 11 Oct 2021 12:55:18 +0000 (14:55 +0200)]
ostype: support Windows 11/Server 2022

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 years agoRevert "config_aware_timeout: add 5s if TPM is configured"
Thomas Lamprecht [Mon, 18 Oct 2021 07:47:42 +0000 (09:47 +0200)]
Revert "config_aware_timeout: add 5s if TPM is configured"

This reverts commit d4e1e1f86232c2c0e2924302fab2f968ef8218b1.

It's bogus, the VM start timeout is only starting to tick after we
started the TPM already...

2 years agoconfig_aware_timeout: add 5s if TPM is configured
Thomas Lamprecht [Mon, 18 Oct 2021 07:43:14 +0000 (09:43 +0200)]
config_aware_timeout: add 5s if TPM is configured

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoswtmp: die early in startup check
Thomas Lamprecht [Mon, 18 Oct 2021 07:42:36 +0000 (09:42 +0200)]
swtmp: die early in startup check

no point in waiting another 50 ms if we know that we'd die already
anyway..

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