5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-03-11 16:58:28 +03:00

3248 Commits

Author SHA1 Message Date
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
Hannes Duerr
629923d025 migration: secure and use source volume names for deactivation
During migration, the volume names may change if the name is already in
use at the target location. We therefore want to save the original names
so that we can deactivate the original volumes afterwards.

Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
2024-01-30 10:41:45 +01:00
Fiona Ebner
613fed51fa drive: product/vendor: add comment with rationale for limits
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-01-26 11:28:32 +01:00
Hannes Duerr
d1feab4aa2 fix #4957: add vendor and product information passthrough for SCSI-Disks
adds vendor and product information for SCSI devices to the json schema
and checks in the VM create/update API call if it is possible to add
these to QEMU as a device option

Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
[FE: add missing space to exception message
     use config option for exception e.g. scsi0 rather than 'product'
     style fixes]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-01-26 11:12:58 +01:00
Fabian Grünbichler
c1b2092d5e qemu_volume_snapshot_delete: drop (now) unused parameter
since we always determine the deviceid, passing in a possibly wrong value makes
no sense and could actually re-introduce bugs.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
2024-01-09 10:25:11 +01:00
Fiona Ebner
c60586838a fix #2258: select correct device when removing drive snapshot via QEMU
The QMP command needs to be issued for the device where the disk is
currently attached, not for the device where the disk was attached at
the time the snapshot was taken.

Fixes the following scenario with a disk image for which
do_snapshots_with_qemu() is true (i.e. qcow2 or RBD+krbd=0):
1. Take snapshot while disk image is attached to a given bus+ID.
2. Detach disk image.
3. Attach disk image to a different bus+ID.
4. Remove snapshot.

Previously, this would result in an error like:
> blockdev-snapshot-delete-internal-sync' failed - Cannot find device=drive-scsi1 nor node_name=drive-scsi1

While the $running parameter for volume_snapshot_delete() is planned
to be removed on the next storage plugin APIAGE reset, it currently
causes an immediate return in Storage/Plugin.pm. So passing a truthy
value would prevent removing a snapshot from an unused qcow2 disk that
was still used at the time the snapshot was taken. Thus, and because
some exotic third party plugin might be using it for whatever reason,
it's necessary to keep passing the same value as before.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-01-09 10:11:17 +01:00
Hannes Duerr
a17c753528 drive: Create get_scsi_devicetype
Encapsulation of the functionality for determining the scsi device type
in a new function for reusability in QemuServer/Drive.pm

Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
2024-01-05 16:26:25 +01:00
Hannes Duerr
028aee4554 Move NEW_DISK_RE to QemuServer/Drive.pm
Prepare for introduction of new helper

Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
2024-01-05 16:26:25 +01:00
Hannes Duerr
ad464e0b87 Move path_is_scsi to QemuServer/Drive.pm
Prepare for introduction of new helper

Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
2024-01-05 16:26:25 +01:00
Fiona Ebner
498d7da470 fix #4501: TCP migration: start vm: move port reservation and usage closer together
Currently, volume activation, PCI reservation and resetting systemd
scope happen in between, so the 5 second expiretime used for port
reservation is not always enough.

It's possible to defer telling QEMU where it should listen for
migration and do so after it has been started via QMP. Therefore, the
port reservation can be moved very close to the actual usage.

Mentioned here for completeness and can still be done as an additional
change later if desired: next_migrate_port could be modified to
optionally return the open socket and it should be possible to pass
the file descriptor directly to QEMU, but that would require accepting
the connection before on the Perl side (otherwise leads to ENOTCONN
107). While it would avoid any races, it's not the most elegant
and the change at hand should be enough in all practical situations.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Hannes Duerr <h.duerr@proxmox.com>
2024-01-03 11:31:53 +01:00
Alexandre Derumier
2f2da05217 cpu config: add QEMU 8.1 cpu models
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
[FE: add prefix to commit title, capitalize QEMU]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-12-12 11:27:42 +01:00
Fiona Ebner
2754b7e4d6 schema: mention that migration with VNC clipboard is not yet supported
as this might be surprising to users.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-11-29 10:25:16 +01:00
Markus Frank
bb30eedfc6 migration: do not allow live-migration with clipboard=vnc
It is not yet supported for QEMU's vdagent device which is used for
the VNC clipboard.

The migration precondition API call will now treat the VNC clipboard
as a local resource. Thus the GUI blocks migration and shows:
"Can't migrate VM with local resources: clipboard=vnc"

QemuMigrate's prepare function will also abort live migration early
when using the VNC clipboard.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
[FE: adapt commit message a bit]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-11-29 10:18:43 +01:00
Thomas Lamprecht
d440f52417 bump version to 8.0.10
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-22 14:12:52 +01:00
Stefan Lendl
0b034c15f4 sdn: pass vmid and hostname to add_dhcp_mapping
if no DHCP mapping was found in IPAM it will request a new IP which
requires these values.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
2023-11-21 20:51:56 +01:00
Wolfgang Bumiller
3d9a9c579c bump version to 8.0.9
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-11-21 15:47:55 +01:00
Wolfgang Bumiller
219540e6e4 d/control: recommend libpve-network-perl >= 0.8.3
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-11-21 14:52:17 +01:00
Wolfgang Bumiller
8497232bf5 fixup an sdn call outside the have_sdn guard
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-11-21 13:25:51 +01:00
Alexandre Derumier
3f14f206a0 nic online bridge/vlan change: link disconnect/reconnect
We want to notify guest of the change, so it can resubmit dhcp request,
or send gratuitous arp,...

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-11-21 13:24:50 +01:00