5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-06 13:17:56 +03:00
Commit Graph

3316 Commits

Author SHA1 Message Date
Fiona Ebner
81a8c4e5ee qmeventd: also treat 'prelaunch' and 'suspended' states as active
Otherwise, a VM in those states would be terminated after a backup
in handle_qmp_return() with QMP 'quit', which is pretty bad in case
of the 'suspended' state.

Does not change the fact that a VM started in prelaunch mode for
backup is terminated later (that is handled by the Perl code).

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-04-23 16:46:20 +02:00
Thomas Lamprecht
6ba1f1c0c3 os type: add Windows Server 2025 as supported with win11 type
Martin tested the 2025 preview and it worked fine  using the win11 OS
type.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-20 16:19:17 +02:00
Thomas Lamprecht
0089920f42 bump version to 8.1.4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-20 12:28:39 +02:00
Thomas Lamprecht
43569a32ae api: create vm: fix missing import for serializing machine type
The machine handling was transformed into a full fledged property
string with a (sub) format, but the single call-site for print_machine
was seemingly not tested, as this could have never worked due to a
missing import of the print_property_string helper.

Fixes: 8082eb8 ("config: define machine schema as property-string")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-20 12:27:30 +02:00
Thomas Lamprecht
e2c1459968 bump version to 8.1.3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-19 20:32:51 +02:00
Thomas Lamprecht
21e3a39e48 d/control: bump versioned pve-firewall dependency
to ensure the is_nftables helper is available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-19 20:11:56 +02:00
Stefan Hanreich
29728dbf83 firewall: add handling for new nft firewall
When the nftables firewall is enabled, we do not need to create
firewall bridges.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
 [ TL: use a more meaningful variable name and add a comment ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-19 20:09:20 +02:00
Fiona Ebner
4c042b2802 bump version to 8.1.2
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-04-19 16:47:54 +02:00
Fiona Ebner
5d85728282 backup: implement fleecing option
Management for fleecing images is implemented here. If the fleecing
option is set, for each disk (except EFI disk and TPM state) a new
fleecing image is allocated on the configured fleecing storage (same
storage as original disk by default). The disk is attached to QEMU
with the 'size' parameter, because the block node in QEMU has to be
the exact same size and the newly allocated image might be bigger if
the storage has a coarser allocation or rounded up. After backup, the
disks are detached and removed from the storage.

If the storage supports qcow2, use that as the fleecing image format.
This allows saving some space even on storages that do not properly
support discard, like, for example, older versions of NFS.

Since there can be multiple volumes with the same volume name on
different storages, the fleecing image's name cannot be just based on
the original volume's name. The schema vm-ID-fleece-N(.FORMAT) with N
incrementing for each disk is used.

Partially inspired by the existing handling of the TPM state image
during backup.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-04-19 15:47:42 +02:00
Fiona Ebner
36377acfbd backup: disk info: also keep track of size
which will be needed to allocate fleecing images.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-04-19 15:47:42 +02:00
Dominik Csapak
4fd49b4a04 clone disk: prevent 'uninitialized value' warning for unused check
since commit
1f743141 (fix #1905: Allow moving unused disks)

we want to check the source drive name for 'unused', but in case of
importing a volume from the 'import' content type (e.g. from esxi),
there is no source drive name. So we have to first check if it's
defined.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-04-19 08:58:40 +02:00
Friedrich Weber
9f3651d9b7 api: stop: reword overrule-shutdown parameter description
The previous wording made it sound like all "visible" tasks were
aborted, which is not the case: A user with Sys.Audit but without
Sys.Modify may see a task that was started by a different user, but
overrule-shutdown would not abort the task.

Change wording to better reflect that not all visible tasks may be
aborted.

Also, add a full-stop that was previously missing.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
2024-04-18 23:08:30 +02:00
Friedrich Weber
b04a334eab api: fix spacing and punctuation in shutdown and stop descriptions
Add missing spaces and full-stops and wrap strings according to Perl
style guide.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
2024-04-18 23:08:30 +02:00
Thomas Lamprecht
63eda17045 d/control: bump versioned dependencies for libpve-guest-common-perl
to ensure that the new abort_guest_tasks helper is available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-17 20:42:51 +02:00
Friedrich Weber
50b5893b50 fix #4474: qemu api: add overrule-shutdown parameter to stop endpoint
The new `overrule-shutdown` parameter is boolean and defaults to 0. If
it is 1, all active `qmshutdown` tasks for the same VM (which are
visible to the user/token) are aborted before attempting to stop the
VM.

Passing `overrule-shutdown=1` is forbidden for HA resources.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
2024-04-17 20:42:26 +02:00
Filip Schauer
1f743141e3 fix #1905: Allow moving unused disks
In the past, moving unused disks to another storage was prohibited due
to oversights in the handling of unused disks. This commit rectifies
this limitation by allowing the movement of unused disks.

Historical context:
* 16 Sep 2010 r5164 qemu-server/pve2: The disknames sub was removed.
* 17 Sep 2010 r5170 qemu-server/pve2: Unused disks were introduced.
* 28 Jan 2011 r5461 qemu-server/pve2: The same disknames sub that was
   removed in r5164 was brought back. Since unused disks were not around
   yet in r5164 the disknames sub did not consider unused disks.
* 6-8 Aug 2012 c1175c92..f91b2e45 qemu-server.git: Disk resize was
   introduced. In commit c1175c92 in sub qemu_block_resize unused disks
   were not taken into account and in commit 2f48a4f5 (8 Aug 2012) the
   resize API call was changed to only allow disks matching the ones in
   the disknames sub. Since sub disknames did not contain any unused
   disks, those were not allowed at all in the resize API call.
* 27 May 2013 586bfa78 qemu-server.git: Disk move was introduced. The
   API call implementation borrowed heavily from disk resize, including
   the behaviour of not taking unused disks into account. Thus, unused
   disk could not be moved, which persists to this day.

In summary, this behaviour was introduced because the handling of unused
disks was overlooked and it was never changed.

There is no inherent reason why unused disks should be restricted from
being moved to another storage. These disks cannot use the
qemu_drive_mirror, but they can still be moved with qemu_img_convert,
the same way as any other disk of a stopped VM.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2024-04-12 11:45:25 +02:00
Markus Frank
2db4c27283 fix #3784: config: Parameter for guest vIOMMU + test-cases
vIOMMU enables the option to passthrough pci devices to L2 VMs in L1
VMs via Nested Virtualisation and adds an extra isolation.

Uses the new property-string from the "config: define machine schema
as property-string"-commit to add the viommu option to the machine
parameter.

Currently there are two vIOMMU implementation in QEMU to choose:
intel or virtio

Virtio-iommu is more recent but less used in production than intel-iommu.

The assert_valid_machine_property function prevents using intel-iommu with
i440fx.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
 [ TL: tiny coding style fix to extract variable inside if expr ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-11 16:40:17 +02:00
Markus Frank
8082eb8ca1 config: define machine schema as property-string
Convert the machine parameter to a property-string and use the machine
type as the default key for backward compatibility.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
2024-04-11 10:18:27 +02:00
Thomas Lamprecht
20fc9811ec style fix: improve device-type variable name
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-10 13:56:50 +02:00
Hannes Duerr
6906c2ab33 drive: style fix the name of the get_scsi_device_type method
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-10 13:56:50 +02:00
Hannes Duerr
7e2065956f fix #5363: cloudinit: make creation of scsi cloudinit discs possible again
Upon obtaining the device type, a check is performed to determine if it
is a CD drive. It is important to note that Cloudinit drives are always
assigned as CD drives. If the drive has not yet been allocated, the test
will fail due to the unset cd attribute.
To avoid this, an explicit check is now performed to determine if it is
a Cloudinit drive that has not yet been assigned.

Fixes: d1feab4 ("fix #4957: add vendor and product information passthrough for SCSI-Disks")
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
2024-04-10 13:56:41 +02:00
Dominik Csapak
f0923f49e9 usb: fix undef error on string match
'$entry->{host}' can be empty, so we have to check for that before
doing a regex check, otherwise we get ugly errors in the log

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-03-22 14:17:53 +01:00
Thomas Lamprecht
7299e18567 bump version to 8.1.1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-14 14:04:37 +01:00
Filip Schauer
caa88bc80a cpu config: die on hotplug of non x86_64 CPUs
When attempting a CPU hotplug on an architecture other than x86_64, die
with a clean error instead of attempting a hotplug with a known
non-working device command line. Also move the corresponding FIXME up to
the error.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2024-03-14 14:01:21 +01:00
Fiona Ebner
f6039cedf1 disk import: warn when fallback is used instead of requested format
Might avoid some confusion. Reported in the community forum:
https://forum.proxmox.com/threads/142988/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-03-14 14:01:12 +01:00
Wolfgang Bumiller
ddca7afe61 import: remove useless typoed error message
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-14 13:37:16 +01:00
Wolfgang Bumiller
81b984433b also support live-import with absolute paths
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-14 13:37:16 +01:00
Thomas Lamprecht
e8710a9ae7 qm: add VM import command
Add a command that can be used together with volumes from the new
'import' content type of storage plugins.

For now only the new ESXi exposes that content type, but in the long
run its planned to migrate over the existing OVF/OVA infra and extend
it so that it will replace the 'ovfimport' command.

Originally-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: split out to separate commit and add message, fix completing
   VMID to propose unused ones, note explicitly when in dry-run mode ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-14 13:35:11 +01:00
Wolfgang Bumiller
eb06e48657 support live-import for 'import-from' disk options on create
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 16:29:58 +01:00
Wolfgang Bumiller
5b8d01f575 generalize live restore code
instead of a "pbs-backing" parameter we now have a
"live-restore-backing" parameter containing the `-blockdev` arg and
its name, which also means we print the blockdev earlier

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-11 10:41:42 +01:00
Thomas Lamprecht
d08923a607 d/changelog: drop import-from fix entry, regression got never out
The fix is for a regression that never made it into a bumped package,
so no need to mention it in the changelog.

Reported-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-11 10:40:24 +01:00
Thomas Lamprecht
4f2404057e config: update network: code-style & readability improvements
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-10 18:29:53 +01:00
Thomas Lamprecht
7c0f763d0c config: apply pending: code-style & readability improvements
among other things, avoid one indentation level by returning early
from the eval.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-10 18:29:26 +01:00
Thomas Lamprecht
3fde43d2ec config: pending network: avoid undef-warning on old/new comparison
A network device of a VM does not necessarily has to be connected to
an actual bridge, so when a new pending value is set we need to use
the undef-safe compare helpers when checking if there was a change
between old and new value, as otherwise one gets ugly "use of
uninitialized value in string ne" warnings.

Link: https://forum.proxmox.com/threads/143072/
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-10 18:27:22 +01:00
Wolfgang Bumiller
9a1b5d0e71 add missing import
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-10 16:00:43 +01:00
Thomas Lamprecht
199fa6eee3 bump version to 8.1.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-08 15:16:40 +01:00
Thomas Lamprecht
5ebb6018ed cpu config: implement is_native_arch locally for now
could be a better fit in PVE::Tools, like proposed by Filip, but OTOH.
Tools is already crowded as is, so wait if we need it on more places
outside of qemu-server.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-08 15:16:40 +01:00
Fiona Ebner
c7c2e4dbd1 QMP client: sort commands with 10 minutes timeout alphabetically
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-03-08 14:37:29 +01:00
Fiona Ebner
bb600b7bf2 QMP client: add missing use statement for UNIX Sockets module
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-03-08 14:37:21 +01:00
Fiona Ebner
0d00383d0e QMP client: remove unnecessary question mark from comment
There might've been a question back when it got first added in commit
9d689077 ("use long timeouts for snapshot monitor command"). But
nowadays, the value is well-established. Changing it would affect
quite a few operations, so that should not be done without good
reason and is likely better done for the specific operation.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-03-08 14:35:16 +01:00
Fiona Ebner
b0d1a00a24 QMP client: increase default timeout for drive-mirror to 10 minutes
like for other block operations.

Reported in the community forum:
https://forum.proxmox.com/threads/141238/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-03-08 14:35:16 +01:00
Filip Schauer
d1a7abd07c cpu config: Unify the default value for 'kvm'
Make the default value for 'kvm' consistent, taking into account
whether the VM will run on the same CPU architecture as the host.

This would be a breaking change to CPU hotplug for VMs with a
different CPU architecture running on an x86_64 host, as in this case
the default CPU type for CPU hotplug changes from 'kvm64' to 'qemu64'.
However, CPU hotplug of non x86_64 architectures is not supported
anyway, so this is not a breaking change after all.

It should be noted that this change does alter the CPU hotplug
behaviour when emulating an x86_64 CPU on a non-x86_64 host. This is
however not officially supported in Proxmox VE.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2024-03-08 14:24:37 +01:00
Filip Schauer
bb42334981 Move is_native from PVE::QemuServer to PVE::Tools
Move is_native from PVE::QemuServer to PVE::Tools and rename it to
is_native_arch to be more descriptive.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2024-03-08 14:24:32 +01:00
Filip Schauer
89d5b1c90b prevent starting a 32-bit VM using a 64-bit OVMF BIOS
Instead of starting a VM with a 32-bit CPU type and a 64-bit OVMF image,
throw an error before starting the VM telling the user that OVMF is not
supported on 32-bit CPU types.

To obtain a list of 32-bit CPU types, refer to the builtin_x86_defs in
target/i386/cpu.c of QEMU. Exclude any entries that have the long mode
feature (CPUID_EXT2_LM).

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2024-03-08 14:24:32 +01:00
Filip Schauer
5416ff700f cpu config: add helper to get the default CPU type
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
2024-03-08 14:24:32 +01:00
Dominik Csapak
a672c578e0 mediated device pass-through: fix race condition on VM reboot
When rebooting a VM from PVE (via CLI/API), the reboot code is called
under a guest lock, which creates a reboot request, shuts down the VM
and then calls the regular cleanup code, which includes the mdev
cleanup.

In parallel, the qmeventd observes that the VM process has gone, and
starts 'qm cleanup' which is (among other tasks) also starts the VM
again if a reboot from the PVE side is pending.
The qmeventd synchronizes this through a lock on the guest, with a
default timeout of 10 seconds.

Since we currently also always wait 10 seconds for the NVIDIA driver
to clean up the mdev, this creates a race condition for the cleanup
lock. IOW., when the call to `qm cleanup` starts before we started to
sleep for 10 seconds, it will not be able to acquire its lock and not
start the vm again.

To avoid the race condition in practice, do two things:
* increase the timeout in `qm cleanup` to 60 seconds.
  Technically this still might run into a timeout, as we can configure
  up to 16 mediated devices with each delaying 10 seconds in the worst
  case, but realistically most users won't configure more than two or
  three of them, if even that.

* change the hard-coded `sleep 10` to a loop sleeping for 1 second
  each before checking the state again. This shortens the timeout when
  the NVIDIA driver did not require the full 10s to finish the
  clean-up.

Further, add a bit of logging, so one can properly see in the task log
what is happening at which point in time.

Fixes: 49c51a60 (pci: workaround nvidia driver issue on mdev cleanup)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Mira Limbeck <m.limbeck@proxmox.com>
 [ TL: change warn to print, reword commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-08 14:15:38 +01:00
Thomas Lamprecht
04736ecbd5 api: clone vm: comment and style clean-up deactivation error-handling
Make the post-if check for the target not already running more
prominent by using a full if block.

Also comment on why we ignore the error here, while the commit
changing that explained it well, this is one of the things that might
be better of with a in-code comment (as doing the deactivation is
described as important here, so one might wonder why the code
continues if that fails)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-08 13:51:30 +01:00
Hannes Duerr
9d6126e8db fix #1734: clone VM: if deactivation fails demote error to warning
When a template with disks on LVM is cloned to another node, the
volumes are first activated, then cloned and deactivated again after
cloning.

However, if clones of this template are now created in parallel to
other nodes, it can happen that one of the tasks can no longer
deactivate the logical volume because it is still in use.  The reason
for this is that we use a shared lock.
Since the failed deactivation does not necessarily have consequences,
we downgrade the error to a warning, which means that the clone tasks
will continue to be completed successfully.

Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
2024-03-08 13:40:42 +01:00
Fiona Ebner
40786ff967 api: fix using import-from with SCSI disks
by fixing the SCSI feature compatibility check helper. The helper is
also called for disks using import-from, so it has to use the extended
schema when parsing the drive.

Fixes: d1feab4a ("fix #4957: add vendor and product information passthrough for SCSI-Disks")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-01-31 12:30:37 +01:00
Fabian Grünbichler
9946d6fa57 fix #4085: properly activate cicustom storage(s)
PVE::Storage::path() neither activates the storage of the passed-in volume, nor
does it ensure that the returned value is actually a file or block device, so
this actually fixes two issues. PVE::Storage::abs_filesystem_path() actually
takes care of both, while still calling path() under the hood (since $volid
here is always a proper volid, unless we change the cicustom schema at some
point in the future).

Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-01-31 12:28:46 +01:00