Commit Graph

2945 Commits

Author SHA1 Message Date
Fabian Grünbichler
dbc817ba4a reassign disk: various improvements
some style, some missing checks. some duplication reduced a bit.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-11-10 11:49:36 +01:00
Aaron Lauterer
70c0ad6687 api: move-disk: cleanup very long lines
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2021-11-09 16:16:00 +01:00
Aaron Lauterer
a94532188d 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>
2021-11-09 16:16:00 +01:00
Aaron Lauterer
1071373027 Drive: add valid_drive_names_with_unused
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2021-11-09 16:16:00 +01:00
Aaron Lauterer
2817091d33 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>
2021-11-09 16:16:00 +01:00
Fabian Ebner
7a16336dd2 config: rollback is possible: add blockers parameter
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-11-08 10:34:00 +01:00
Thomas Lamprecht
b20f267061 bump version to 7.0-18
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-04 15:30:30 +01:00
Thomas Lamprecht
cc18103635 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>
2021-11-04 15:30:30 +01:00
Thomas Lamprecht
02cfca4b71 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>
2021-11-04 15:30:30 +01:00
Thomas Lamprecht
af2a1a1cdb 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>
2021-11-04 15:30:30 +01:00
Thomas Lamprecht
26b443c846 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>
2021-11-04 15:30:22 +01:00
Thomas Lamprecht
115cb432bc 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>
2021-11-04 13:14:17 +01:00
Constantin Herold
101beafe0d 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>
2021-11-04 12:46:07 +01:00
Thomas Lamprecht
33f8b88782 agent hotplug: small style cleanups & comment addition
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-04 08:46:22 +01:00
Alexandre Derumier
74ea2c65a9 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>
2021-11-04 08:37:03 +01:00
Thomas Lamprecht
d08e787cae test: cfg2cmd: fix command output
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-03 16:46:28 +01:00
Thomas Lamprecht
e8a268100b vm_commandline: reduce line bloat
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-03 16:35:57 +01:00
Thomas Lamprecht
6971c38ed9 print_keyboarddevice_full: drop unused machine parameter
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-03 16:35:57 +01:00
Thomas Lamprecht
f606d5bd6f scsi_inquiry: refactor and code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-03 16:35:57 +01:00
Thomas Lamprecht
8eb73377c1 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>
2021-11-03 16:21:22 +01:00
Thomas Lamprecht
1f91f7b464 drives: ro: code reduction/refactor
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-27 17:00:24 +02:00
Dominik Csapak
12e1d472e3 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>
2021-10-27 13:53:11 +02:00
Stefan Reiter
6a5589010e 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>
2021-10-27 13:51:45 +02:00
Fabian Ebner
23bee97d05 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>
2021-10-27 13:23:18 +02:00
Dominik Csapak
25de70ae59 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>
2021-10-22 11:55:08 +02:00
Dominik Csapak
90b20b152c 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>
2021-10-21 12:38:58 +02:00
Thomas Lamprecht
c21013ac58 bump version to 7.0-17
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-21 11:58:18 +02:00
Thomas Lamprecht
5a08fb9c8b config properties: refactor skipping internal options to declarative
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-21 08:23:11 +02:00
Thomas Lamprecht
3d0ee5d41c tests: fixup simple1-template.conf.cmd
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-20 18:18:31 +02:00
Thomas Lamprecht
3326ae19de 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>
2021-10-20 17:31:45 +02:00
Thomas Lamprecht
fa3b3ce067 config2cmd: code cleanup and indentation reduction
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-20 15:39:20 +02:00
Thomas Lamprecht
483ceeabef indentation and fixes
with some style/tw thrown in-between

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-20 12:56:59 +02:00
Thomas Lamprecht
8d88a59433 fix overly long/short lines and typos
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-20 08:24:08 +02:00
Stefan Reiter
179b9f1ba5 ostype: support Windows 11/Server 2022
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2021-10-18 09:53:44 +02:00
Thomas Lamprecht
2c29655663 Revert "config_aware_timeout: add 5s if TPM is configured"
This reverts commit d4e1e1f862.

It's bogus, the VM start timeout is only starting to tick after we
started the TPM already...
2021-10-18 09:47:42 +02:00
Thomas Lamprecht
d4e1e1f862 config_aware_timeout: add 5s if TPM is configured
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-18 09:43:46 +02:00
Thomas Lamprecht
90c41bac8f 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>
2021-10-18 09:43:46 +02:00
Thomas Lamprecht
6bbcd71f94 code style: readability cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-18 09:43:46 +02:00
Stefan Reiter
f85951dc82 swtpm: wait for pidfile
swtpm may take a little bit to daemonize, so the pidfile might not be
available right after run_command. Causes an ugly warning about using an
undefined value in a match, so wait up to 5s for it to appear.

Note that in testing this loop only ever got to the first or second
iteration, so I believe the timeout duration should be more than enough.

Also add a missing 'usleep' import, 'usleep' was used before but never
imported, apparently the other case never got triggered...

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2021-10-18 09:43:46 +02:00
Stefan Reiter
9d83932d7c snapshot: fix tpmstate with rbd
QEMU doesn't know about the tpmstate, so 'do_snapshots_with_qemu' should
never return true in that case. Note that inconsistencies related to
snapshot timing do not matter much, as the actual TPM data is exported
together with other device state by QEMU anyway.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2021-10-18 09:43:45 +02:00
Thomas Lamprecht
212220a4fa vm_start: better name systemd scope property variable
`properties` is a bit ambiguous and as we have scope and start
runtime properties in the same scope it's good to avoid that
ambiguity.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-18 09:43:45 +02:00
Thomas Lamprecht
c077cc166e cloudinit: opennebula: refactor to reduce code bloat
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-15 19:58:16 +02:00
Thomas Lamprecht
2eee6748a0 cloudinit: better use of string variable interpolation
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-15 19:58:16 +02:00
Thomas Lamprecht
d01de38cb6 pci: prepare: improve no-IOMMU error message
give some context

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-15 19:58:16 +02:00
Dominik Csapak
1fb1822ec9 fix #3258: block vm start when pci device is already in use
on vm start, we reserve all pciids that we use, and
remove the reservation again in vm_stop_cleanup

first with only a time-based reservation but after the vm is started,
we reserve again but with the pid.

for this, we have to move the start_timeout calculation above the
hostpci handling.

also moved the pci initialization out of the conf parsing loop
so that we can reserve all ids before we actually touch any of them

while touching the lines, fix the indentation

this way, when a vm starts with a pci device that is already configured
for a different running vm, will not be started and the user gets
the error that the device is already in use

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-15 19:58:16 +02:00
Thomas Lamprecht
a01593676c pci reservation: rework helpers style and readability wise
both style and readability are naturally subjective to a certain
degree...

Also, this patch mixes a bit much into one thing, but splitting that
up would mean lots of work I just wanted to avoid, sorry about that.

Among other things:

- avoid a level of indentation in the reserve loop
- rename pciids to reservation_list where it was a better fit
- make reserve set either pid or time to avoid suggesting that we
  save both
- rename parameters to requested/dropped IDs for easier understanding
  what's going on in the code
- avoid old_pid/pid, use running_pid and reserver_pid instead to
  clarify what they actually mean
- drop useless returns to avoid suggesting the return value has any
  use and save some lnes
- use a hash slice to delete all dropped IDs at once, shorter and
  faster
- use 5 second timeout for reservation, this does nothing intensive
  nor does it wait for anything, so the critical section should be
  really short, 5s is really long enough for a wait..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-15 19:58:16 +02:00
Thomas Lamprecht
bda0ebff2d pci reservation: move lock/reservation file into /run/qemu-server
lck needs to die, the days of any 8.3 file naming schemes are long
gone (in the server space that is ;)

/var/run is /run so use the shorter, and while /var/lock is a OK
place for the locks we try to keep lock and lock-object together
nowadays. The qemu-server sub-directory avoids overly cluttering the
already crowded top-level /run dir

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-15 18:17:34 +02:00
Thomas Lamprecht
cda95d5223 pci reservation: encode locklessness of parsers in name
to avoid that they're misused

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-15 14:44:50 +02:00
Dominik Csapak
3bfee796f4 pci: add helpers to (un)reserve pciids for a vm
saves a list of pciid <-> vmid mappings in /var/run
that we can check when we start a vm

if we're not given a pid but a timeout, we save the time when the
reservation will run out (current time + timeout + 5s) since each
vm start (until we can save the pid) varies from config to config

reserve_pci_usage and remove_pci_reservation always expect a list of ids
so that we can update the reservation for a vm all at once

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2021-10-11 09:07:52 +02:00
Thomas Lamprecht
71cb8e0f87 pci related code cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-11 08:39:28 +02:00