]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
17 months agobump version to 7.2-12
Thomas Lamprecht [Mon, 21 Nov 2022 07:36:17 +0000 (08:36 +0100)]
bump version to 7.2-12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoapi: create/update vm: fix clamping cpuunits function calls
Fiona Ebner [Mon, 21 Nov 2022 07:25:13 +0000 (08:25 +0100)]
api: create/update vm: fix clamping cpuunits function calls

When applying the series introducing those calls, the helper was moved
to pve-common's CGroup.pm (see 07c10d5 ("cgroup: move get_cpuunits
helper from qemu-server as clamp_cpu_shares") in pve-common) instead
of pve-guest-common's GuestHelpers.pm. But these calls were not
updated.

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

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agod/control: depend on newer libpve-guest-common-perl 4.2-3
Thomas Lamprecht [Mon, 21 Nov 2022 07:21:40 +0000 (08:21 +0100)]
d/control: depend on newer libpve-guest-common-perl 4.2-3

for new unique tag helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoconfig: ensure that tags are unique
Thomas Lamprecht [Mon, 21 Nov 2022 07:19:33 +0000 (08:19 +0100)]
config: ensure that tags are unique

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 7.2-11
Thomas Lamprecht [Sun, 20 Nov 2022 15:30:32 +0000 (16:30 +0100)]
bump version to 7.2-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agofdb: only manage FDB entries for Linux bridges for now
Thomas Lamprecht [Sun, 20 Nov 2022 15:03:41 +0000 (16:03 +0100)]
fdb: only manage FDB entries for Linux bridges for now

we need to handle OVS setups differently, so for now just ignore it
there (behavior as it was in 7.2)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agofdb: pull out bridge variable
Thomas Lamprecht [Sun, 20 Nov 2022 15:03:16 +0000 (16:03 +0100)]
fdb: pull out bridge variable

no semantic change intended

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 7.2-10
Thomas Lamprecht [Thu, 17 Nov 2022 16:48:06 +0000 (17:48 +0100)]
bump version to 7.2-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomemory hot plug: round down to nearest even phys-bits for heuristics
Thomas Lamprecht [Thu, 17 Nov 2022 16:40:35 +0000 (17:40 +0100)]
memory hot plug: round down to nearest even phys-bits for heuristics

Mira found out that 41 phys-bits the limit is pretty much the same as
with 40, as such odd sizes are a bit unexpected anyway lets mask the
LSB and use that as base, that way we're good again.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 7.2-9
Thomas Lamprecht [Thu, 17 Nov 2022 16:09:21 +0000 (17:09 +0100)]
bump version to 7.2-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomemory hotplug: rework max memory handling, make phys-bits dependent
Thomas Lamprecht [Thu, 17 Nov 2022 14:55:40 +0000 (15:55 +0100)]
memory hotplug: rework max memory handling, make phys-bits dependent

QEMU 7.1 introduced some actual checks for the max memory value in
1caab5cf86bd ("i386/pc: bounds check phys-bits against max used GPA")
and while correct it breaks our by-luck working hard coded max mem of
4 TB for cases with smaller phys bit address sizes, like some older
CPUs or most CPU types have per default if not 'host' or 'max'.

QEMU uses 40 bits per default if the CPU isn't set to host or
phys-bits is not set explicitly.

For 40 bit it seems that depending on machine type one has a max
possible mem of: i440 -> 752, q35 -> 722 GiB, but instead of reducing
it to 704 GiB (512+1128+64) in a hard coded way we acutally check for
the bit size that will probably be used and use that to determine the
max memory size useable.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agocpu config: indentation fixup
Thomas Lamprecht [Thu, 17 Nov 2022 15:45:56 +0000 (16:45 +0100)]
cpu config: indentation fixup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agod/changelog: fixup release
Thomas Lamprecht [Thu, 17 Nov 2022 14:23:26 +0000 (15:23 +0100)]
d/changelog: fixup release

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoqm: add remote-migrate command
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:46 +0000 (14:33 +0100)]
qm: add remote-migrate command

which wraps the remote_migrate_vm API endpoint, but does the
precondition checks that can be done up front itself.

this now just leaves the FP retrieval and target node name lookup to the
sync part of the API endpoint, which should be do-able in <30s ..

an example invocation:

$ qm remote-migrate 1234 4321 'host=123.123.123.123,apitoken=PVEAPIToken=user@pve!incoming=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee,fingerprint=aa:bb:cc:dd:ee:ff:aa:bb:cc:dd:ee:ff:aa:bb:cc:dd:ee:ff:aa:bb:cc:dd:ee:ff:aa:bb:cc:dd:ee:ff:aa:bb' --target-bridge vmbr0 --target-storage zfs-a:rbd-b,nfs-c:dir-d,zfs-e --online

will migrate the local VM 1234 to the host 123.123.1232.123 using the
given API token, mapping the VMID to 4321 on the target cluster, all its
virtual NICs to the target vm bridge 'vmbr0', any volumes on storage
zfs-a to storage rbd-b, any on storage nfs-c to storage dir-d, and any
other volumes to storage zfs-e. the source VM will be stopped but remain
on the source node/cluster after the migration has finished.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agoapi: add remote migrate endpoint
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:45 +0000 (14:33 +0100)]
api: add remote migrate endpoint

entry point for the remote migration on the source side, mainly
preparing the API client that gets passed to the actual migration code
and doing some parameter parsing.

querying of the remote sides resources (like available storages, free
VMIDs, lookup of endpoint details for specific nodes, ...) should be
done by the client - see next commit with CLI example.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agomigrate: add remote migration handling
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:44 +0000 (14:33 +0100)]
migrate: add remote migration handling

remote migration uses a websocket connection to a task worker running on
the target node instead of commands via SSH to control the migration.
this websocket tunnel is started earlier than the SSH tunnel, and allows
adding UNIX-socket forwarding over additional websocket connections
on-demand.

the main differences to regular intra-cluster migration are:
- source VM config and disks are only removed upon request via --delete
- shared storages are treated like local storages, since we can't
assume they are shared across clusters (with potentical to extend this
by marking storages as shared)
- NBD migrated disks are explicitly pre-allocated on the target node via
tunnel command before starting the target VM instance
- in addition to storages, network bridges and the VMID itself is
transformed via a user defined mapping
- all commands and migration data streams are sent via a WS tunnel proxy
- pending changes and snapshots are discarded on the target side (for
  the time being)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agomigrate: refactor remote VM/tunnel start
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:43 +0000 (14:33 +0100)]
migrate: refactor remote VM/tunnel start

no semantic changes intended, except for:
- no longer passing the main migration UNIX socket to SSH twice for
forwarding
- dropping the 'unix:' prefix in start_remote_tunnel's timeout error message

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agomtunnel: add API endpoints
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:42 +0000 (14:33 +0100)]
mtunnel: add API endpoints

the following two endpoints are used for migration on the remote side

POST /nodes/NODE/qemu/VMID/mtunnel

which creates and locks an empty VM config, and spawns the main qmtunnel
worker which binds to a VM-specific UNIX socket.

this worker handles JSON-encoded migration commands coming in via this
UNIX socket:
- config (set target VM config)
-- checks permissions for updating config
-- strips pending changes and snapshots
-- sets (optional) firewall config
- disk (allocate disk for NBD migration)
-- checks permission for target storage
-- returns drive string for allocated volume
- disk-import, query-disk-import, bwlimit
-- handled by PVE::StorageTunnel
- start (returning migration info)
- fstrim (via agent)
- ticket (creates a ticket for a WS connection to a specific socket)
- resume
- stop
- nbdstop
- unlock
- quit (+ cleanup)

this worker serves as a replacement for both 'qm mtunnel' and various
manual calls via SSH. the API call will return a ticket valid for
connecting to the worker's UNIX socket via a websocket connection.

GET+WebSocket upgrade /nodes/NODE/qemu/VMID/mtunnelwebsocket

gets called for connecting to a UNIX socket via websocket forwarding,
i.e. once for the main command mtunnel, and once each for the memory
migration and each NBD drive-mirror/storage migration.

access is guarded by a short-lived ticket binding the authenticated user
to the socket path. such tickets can be requested over the main mtunnel,
which keeps track of socket paths currently used by that
mtunnel/migration instance.

each command handler should check privileges for the requested action if
necessary.

both mtunnel and mtunnelwebsocket endpoints are not proxied, the
client/caller is responsible for ensuring the passed 'node' parameter
and the endpoint handling the call are matching.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agopending: fix typo in variable name
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:41 +0000 (14:33 +0100)]
pending: fix typo in variable name

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agopending changes: allow skipping cloud-init
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:40 +0000 (14:33 +0100)]
pending changes: allow skipping cloud-init

in case of remote migration, we use the `update_vm_api` helper for
checking permissions on the incoming config. this would also cause an
incoming cloud-init image to be overwritten, since the VM is not running
yet at this point.

provide a parameter which can be set by an incoming *remote* migration
to avoid having inconsistent cloud init images on the source and target
side.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agofixup delayed cloudinit hotplug
Wolfgang Bumiller [Thu, 17 Nov 2022 14:16:19 +0000 (15:16 +0100)]
fixup delayed cloudinit hotplug

cloudinit generation needs to see the cloudinit drive so we
need to pass a config with it already updated

Fixes: 4b785da1a92c ("delay cloudinit generation in hotplug")
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agorework cloudinit_record_changed logic
Wolfgang Bumiller [Thu, 17 Nov 2022 13:35:27 +0000 (14:35 +0100)]
rework cloudinit_record_changed logic

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agoparse config: do not validate informative values in cloud init section
Thomas Lamprecht [Thu, 17 Nov 2022 11:46:11 +0000 (12:46 +0100)]
parse config: do not validate informative values in cloud init section

Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agod/control: bump versioned dependency for guest-common
Thomas Lamprecht [Thu, 17 Nov 2022 12:18:50 +0000 (13:18 +0100)]
d/control: bump versioned dependency for guest-common

to ensure the tag helper is available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoapi: update: check for tags permissions with 'assert_tag_permissions'
Dominik Csapak [Wed, 16 Nov 2022 15:48:01 +0000 (16:48 +0100)]
api: update: check for tags permissions with 'assert_tag_permissions'

from GuestHelpers. This function checks all necessary permissions and
raises an exception if the user does not have the correct ones.

This is necessary for the new 'privileged' tags and 'user-tag-access'
permissions to work.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agofix #4321: properly check cloud-init drive permissions
Leo Nunner [Wed, 16 Nov 2022 17:34:29 +0000 (18:34 +0100)]
fix #4321: properly check cloud-init drive permissions

The process for editing Cloud-init drives checked for inconsistent
permissions: for adding, the VM.Config.Disk permission was needed, while
the VM.Config.CDROM permission was needed to remove a drive. The regex
in drive_is_cloudinit needed to be adapted since the drive names have
different formats before/after they are actually generated.

Due to the regex letting names fall through before, Cloud-init drives
were being checked as disks, even though they are actually treated as
CDROM drives. Due to this, it makes more sense to check for
VM.Config.CDROM instead, while also requiring VM.Config.Cloudinit, since
generating a Cloud-init drive already generates default values that are
passed to the VM.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
17 months agobump version to 7.2-8
Thomas Lamprecht [Wed, 16 Nov 2022 17:31:16 +0000 (18:31 +0100)]
bump version to 7.2-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agodrop get_pending_changes and simplify cloudinit_pending api call
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:08 +0000 (18:14 +0100)]
drop get_pending_changes and simplify cloudinit_pending api call

- The forced-remove flag wasn't really used AFAICT and makes
  no sense IMO.
- Whether or not we care about non-MAC changes does not
  belong here, but should instead taken into account in the
  actual hotplug path recording the cloud-init state (iow.
  into $cloudinit_record_changed().)
  (This is not done here atm.)
- It seems much simpler to just have:
  * 'old' = the old value if it's not a new value
  * 'new' = the new value unless it's being deleted
  * If only one of them is set it's an addition or removal.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agodon't call 'cleanup_config' the cloudinit section
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:07 +0000 (18:14 +0100)]
don't call 'cleanup_config' the cloudinit section

It performs schema valdiation (and normalization).

We only ever write values into it which came from an
already validated config, and we also add an additional
"added" key which is not covered by the schema, so this
would fail.

Simply skip it.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agorecord cloud-init changes in the cloudinit section
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:06 +0000 (18:14 +0100)]
record cloud-init changes in the cloudinit section

introducing an 'added' value in the cloudinit section for
values which have not been present when the cloudinit image
has been generated

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agodelay cloudinit generation in hotplug
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:05 +0000 (18:14 +0100)]
delay cloudinit generation in hotplug

Hotpluggieg generated a cloudinit image based on old values
in order to attach the device and later update it again, but
the update was only done if cloudinit hotplug was enabled.
This is weird, let's not.

Also introduce 'apply_cloudinit_config' which also write the
config, which, as it turns out, is the only thing we
actually need anyway, currently.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agoPartially-revert "cloudinit: add cloudinit section for current generated config"
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:04 +0000 (18:14 +0100)]
Partially-revert "cloudinit: add cloudinit section for current generated config"

This partially reverts commit 95a5135dad974c7eae249cf92b62b06fe911af33.
Particularly the unprotected write to the config when
generating the cloudinit file. We leave the rest as is for
now and update the callers to deal with the config later.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agoRevert "cloudinit: avoid unsafe write of VM config"
Wolfgang Bumiller [Wed, 16 Nov 2022 17:14:03 +0000 (18:14 +0100)]
Revert "cloudinit: avoid unsafe write of VM config"

This reverts commit b137c30c3a5e4f5394e961a2048724fa18f86b2c.

In preparation of fixing the special:cloudinig section.

17 months agofix #4284: add read-only to non-hotpluggable disk options
Leo Nunner [Mon, 17 Oct 2022 13:24:00 +0000 (15:24 +0200)]
fix #4284: add read-only to non-hotpluggable disk options

Changing the read-only status of a disk is not possible through QMP, so
it needs to be exempt from the hotpluggable values as to notify the
user.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
17 months agowrite config: only write out special cloudinit config if the vm has it
Thomas Lamprecht [Wed, 16 Nov 2022 11:50:29 +0000 (12:50 +0100)]
write config: only write out special cloudinit config if the vm has it

this is only for the current in use CI stuff, not the actual cloud
init config itself.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomigration: cloudinit check: bump manager dependency and guard with cloudinit drive
Thomas Lamprecht [Wed, 16 Nov 2022 11:45:25 +0000 (12:45 +0100)]
migration: cloudinit check: bump manager dependency and guard with cloudinit drive

The former to ensure the manager that depends on the newer
qemu-server is actually installed and the latter to avoid false
positives

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agonet: increase max queues to 64
Alexandre Derumier [Wed, 16 Nov 2022 04:13:32 +0000 (05:13 +0100)]
net: increase max queues to 64

max supported queues tx + rx = 256, so 128 for combined
https://lists.gnu.org/archive/html/qemu-devel/2015-03/msg03917.html

But from above link it also seems that x86 only supports 80 pairs in
practice, so for now "only" quadruple the limit to 64 and see if we
get user feedback for more requested.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
 [ T: reduce from 128 to 64 and add short rationale for that ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoindentation fix
Thomas Lamprecht [Wed, 16 Nov 2022 11:08:05 +0000 (12:08 +0100)]
indentation fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agocloudinit: avoid unsafe write of VM config
Thomas Lamprecht [Wed, 16 Nov 2022 11:03:49 +0000 (12:03 +0100)]
cloudinit: avoid unsafe write of VM config

there's no guarantee that we're locked here and it also produces
unnecessary extra IO in most cases.

While at it also avoid that a special:cloudinit section is added on
start to *every* VM, which caused another bug to trigger (see prev.
commit) and is just odd for users that ain't using cloudinit

Note in two call sites that we may need to write the config indeed
out there on the caller side.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoconfig: fix dropping description on parsing special cloud init section
Thomas Lamprecht [Wed, 16 Nov 2022 10:32:14 +0000 (11:32 +0100)]
config: fix dropping description on parsing special cloud init section

we now always write out a new clouding special section on start (to
be fixed) independent of any cloudinit drive/config configured or
not, and thus always run into that section after a VM started with
the new qemu-server installed, which in turn set the description
always to undef.

Fixes: 95a5135 ("cloudinit: add cloudinit section for current generated config.")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoparse config: factor out finishing reading the description comment
Thomas Lamprecht [Wed, 16 Nov 2022 10:23:01 +0000 (11:23 +0100)]
parse config: factor out finishing reading the description comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agocleanup validate_cpu_conf
Thomas Lamprecht [Tue, 15 Nov 2022 07:49:04 +0000 (08:49 +0100)]
cleanup validate_cpu_conf

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoconfig to command: avoid line bloat, keep cmd definition near initial pushes
Thomas Lamprecht [Tue, 15 Nov 2022 07:34:47 +0000 (08:34 +0100)]
config to command: avoid line bloat, keep cmd definition near initial pushes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoaffinity: add actual example to description
Thomas Lamprecht [Tue, 15 Nov 2022 07:33:04 +0000 (08:33 +0100)]
affinity: add actual example to description

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoadd fixme comment to replace duplicate nodename cache
Thomas Lamprecht [Tue, 15 Nov 2022 06:27:07 +0000 (07:27 +0100)]
add fixme comment to replace duplicate nodename cache

that function also caches the value, and it recently was changed to
be importable, so we can just import and drop this once a new enough
pve-common is available.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agod/control: make pve-qemu-kvm build-dependency versioned to >= 7.1
Thomas Lamprecht [Sun, 13 Nov 2022 15:46:28 +0000 (16:46 +0100)]
d/control: make pve-qemu-kvm build-dependency versioned to >= 7.1

as we use the current version for in the test bed, e.g., cfg2cmd, so
it would fail on older ones.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agotest: add qemu 7.1 multiqueue netdev test
Alexandre Derumier [Sun, 13 Nov 2022 14:37:38 +0000 (15:37 +0100)]
test: add qemu 7.1 multiqueue netdev test

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
 [ T: fixup missing trailing backslash in test ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agotest: add qemu 7.1 default netdev rx|tx_queue_size=1024
Alexandre Derumier [Sun, 13 Nov 2022 14:37:37 +0000 (15:37 +0100)]
test: add qemu 7.1 default netdev rx|tx_queue_size=1024

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
17 months agovirtio-net: increase defaults rx|tx-queue-size to 1024
Alexandre Derumier [Sun, 13 Nov 2022 14:37:36 +0000 (15:37 +0100)]
virtio-net: increase defaults rx|tx-queue-size to 1024

This is reducing packet drop on high pps, and also needed for dpdk.

Redhat already have use it by default in rhev and his openstack platform too
since 2019.

I'm using it in production since 6 months, I don't have seen performance regression.

fix: (which ask for custom option, but setting it by default seem fine for me)

https://bugzilla.proxmox.com/show_bug.cgi?id=1546
https://bugzilla.proxmox.com/show_bug.cgi?id=2349
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
17 months agofix #4296: virtio-net: enable packed queues for qemu 7.1
Alexandre Derumier [Sun, 13 Nov 2022 14:37:35 +0000 (15:37 +0100)]
fix #4296: virtio-net: enable packed queues for qemu 7.1

virtio 1.1 have improve virtio multiqueue performance,
with a new implementation called "packed queues".

https://www.redhat.com/en/blog/packed-virtqueue-how-reduce-overhead-virtio
https://archive.fosdem.org/2018/schedule/event/virtio/attachments/slides/2167/export/events/attachments/virtio/slides/2167/fosdem_virtio1_1.pdf

This patch enable it by default for qemu 7.1

This don't break old guests with old virtio 1.0 drivers,
as virtio device/devices are forward/backward compatible.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
17 months agotests: cfg2cmd: add multi-q base test for 7.0 machine version
Thomas Lamprecht [Sun, 13 Nov 2022 15:40:23 +0000 (16:40 +0100)]
tests: cfg2cmd: add multi-q base test for 7.0 machine version

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 7.2-7
Thomas Lamprecht [Thu, 10 Nov 2022 16:27:08 +0000 (17:27 +0100)]
bump version to 7.2-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomigrate test: fix some more grave indentation/whitespace errors
Thomas Lamprecht [Sun, 13 Nov 2022 13:54:26 +0000 (14:54 +0100)]
migrate test: fix some more grave indentation/whitespace errors

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomigration : add del_nets_bridge_fdb
Alexandre Derumier [Wed, 24 Aug 2022 16:26:44 +0000 (18:26 +0200)]
migration : add del_nets_bridge_fdb

at the end of a live migration, we need to remove old mac entries
on source host (vm is not yet stopped), before resume vm on target host

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
 [T: resolve conflicts and rework on apply ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agonet devs: avoid registering MAC to fdb if not static
Thomas Lamprecht [Sun, 13 Nov 2022 12:38:55 +0000 (13:38 +0100)]
net devs: avoid registering MAC to fdb if not static

In theory we can have a config with netX records that do not specify
a `macaddr` property, we just auto-generate on in config2cmd for
startup transitively, but don't save that explicitly back to the
config; so while we could parse the /proc/$pid/cmdline or try to get
the info from QMP (not fully straight forward) it seems rather a
hassle; especially if one has in mind that this cannot happen via the
API FWICT; as there a "deletion" *saves* a newly auto generated value
out to the config, same with clone of a VM and restore of a backup.

So, in basically all reasonable cases we got the `macaddr` available,
but if we don't it makes no sense to add a FDB variable for a *newly*
generated one by the parse_net call, as the VM won't use that (well,
at least if one doesn't get "lucky" and it randomly re-generates the
same as on startup), so allow telling parse_net to skip auto
generating MACs and use that in the add-fdb-entries helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agonet devs: code cleanup new fdb mac add helper
Thomas Lamprecht [Sun, 13 Nov 2022 12:37:45 +0000 (13:37 +0100)]
net devs: code cleanup new fdb mac add helper

reduce a level of indentation and modernize slightly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agonet devs: register vNIC mac to FDB on start/resume
Alexandre Derumier [Wed, 24 Aug 2022 16:26:43 +0000 (18:26 +0200)]
net devs: register vNIC mac to FDB on start/resume

On plain VM start (no live migration), we can simply add MAC address
into the fdb. In case of a live migration, we add the mac address
just before the resume.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
17 months agofix #4201: delete cloud-init disk on rollback
Mira Limbeck [Fri, 11 Nov 2022 15:46:35 +0000 (16:46 +0100)]
fix #4201: delete cloud-init disk on rollback

If the config doesn't contain the cloud-init disk anymore after the
rollback, we have to clean it up since otherwise no further disk can be
attached unless the one still existing on the storage is deleted.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
17 months agotest: usb: cover more ports on checking xhci 7.1+
Thomas Lamprecht [Fri, 11 Nov 2022 08:10:18 +0000 (09:10 +0100)]
test: usb: cover more ports on checking xhci 7.1+

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agotests: add tests for various combinations of configs for usb
Dominik Csapak [Fri, 11 Nov 2022 06:59:55 +0000 (07:59 +0100)]
tests: add tests for various combinations of configs for usb

q35 + usb passthrough
q35 + usb3 passthrough
q35 + usb3 passthrough with new xhci controller
old machine type + new usb config error
old machine type + q35 + new usb config error
old ostype (w2k) + new usb config error

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agousb: fixup: include USB config only for non-q35 again
Thomas Lamprecht [Fri, 11 Nov 2022 06:42:55 +0000 (07:42 +0100)]
usb: fixup: include USB config only for non-q35 again

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agousb: small style/code cleanups
Thomas Lamprecht [Thu, 10 Nov 2022 16:02:24 +0000 (17:02 +0100)]
usb: small style/code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agousb: get controllers: avoid separate loop for usb 2 devs and improve variable names
Thomas Lamprecht [Thu, 10 Nov 2022 16:00:58 +0000 (17:00 +0100)]
usb: get controllers: avoid separate loop for usb 2 devs and improve variable names

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agousb: rename check_usb_index into assert_usb_index_is_useable
Thomas Lamprecht [Thu, 10 Nov 2022 15:48:35 +0000 (16:48 +0100)]
usb: rename check_usb_index into assert_usb_index_is_useable

to better convey that this might die

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agofix #3271: USB: allow usb hotplugging for modern guests
Dominik Csapak [Thu, 10 Nov 2022 14:35:58 +0000 (15:35 +0100)]
fix #3271: USB: allow usb hotplugging for modern guests

same as with the extended support for more usb devices, allow
hotplugging for guests that can use the qemu-xhci controller which
require a machine type >= 7.1 and a ostype l26 or windows > 7

if no usb device was passed through on startup, dynamically add
the xhci controller (and remove if the last usb device is unplugged)
so that live migration is still possible

much of the usb hotplug code was already there, but it still needed
a few adaptions, for example we have to add a chardev when adding
a spice redir port (that gets automatically removed when the
usb-redir device gets removed)

since the spice devices use the id 'usbredirdevX' instead of 'usbX', we
have to manually map that a bit around

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agoUSB: increase max usb devices to 14 for newer machine version and ostype
Dominik Csapak [Thu, 10 Nov 2022 14:35:57 +0000 (15:35 +0100)]
USB: increase max usb devices to 14 for newer machine version and ostype

for machine versions >= 7.1 and ostype linux or windows > 7, we use the
qemu-xhci controller where we have up to 14 usable ports, so make them
available to the user

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agofix #4324: USB: use qemu-xhci for machine versions >= 7.1
Dominik Csapak [Thu, 10 Nov 2022 14:35:56 +0000 (15:35 +0100)]
fix #4324: USB: use qemu-xhci for machine versions >= 7.1

going by reports in the forum (e.g. [0]) and semi-official qemu
information[1], we should prefer qemu-xhci over nec-usb-xhci

for compatibility purposes, we guard that behind the machine version,
so that guests with a fixed version don't suddenly have a different usb
controller after a reboot (which could potentially break some hardcoded
guest configs)

0: https://forum.proxmox.com/threads/proxmox-usb-connect-disconnect-loop.117063/
1: https://www.kraxel.org/blog/2018/08/qemu-usb-tips/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agoUSB: use machine_type_is_q35 instead of regex
Dominik Csapak [Thu, 10 Nov 2022 14:35:55 +0000 (15:35 +0100)]
USB: use machine_type_is_q35 instead of regex

we refactored that into PVE::QemuServer::Machine a while ago, so we can
use it here

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agoUSB: print_usbdevice_full: error out on invalid configuration
Dominik Csapak [Thu, 10 Nov 2022 14:35:54 +0000 (15:35 +0100)]
USB: print_usbdevice_full: error out on invalid configuration

should not happen normally, but an inattentive user of that function
may forget to check the validity of the parsed device, so err
on the safe side here

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agomove 'windows_version' to Helpers
Dominik Csapak [Thu, 10 Nov 2022 14:35:53 +0000 (15:35 +0100)]
move 'windows_version' to Helpers

to avoid a cyclic dependency when we want to use that in PVE::QemuServer::USB

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agoprint_tabletdevice_full: make use of $q35 variable
Dominik Csapak [Thu, 10 Nov 2022 14:35:52 +0000 (15:35 +0100)]
print_tabletdevice_full: make use of $q35 variable

just outside of context, we already save the result from
machine_type_is_q35 into the $q35 variable, but never use it.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agopci: cleanup pci: unregister mdev directly inline
Thomas Lamprecht [Thu, 10 Nov 2022 16:01:48 +0000 (17:01 +0100)]
pci: cleanup pci: unregister mdev directly inline

not worth the hassle of a break/depends cycle

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agouse full path for /usr/bin/taskset
Wolfgang Bumiller [Thu, 10 Nov 2022 10:15:43 +0000 (11:15 +0100)]
use full path for /usr/bin/taskset

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agofix #3593: add affinity to qemu
Daniel Bowder [Fri, 1 Jul 2022 00:09:45 +0000 (17:09 -0700)]
fix #3593: add affinity to qemu

Reuse the PVE::CpuSet to validate cpuset formatting.
Add new qemu property called 'affinity' to store the cpuset.
Push taskset command in front of kvm if 'affinity' is set.

Signed-off-by: Daniel Bowder <daniel@bowdernet.com>
17 months agopci: make mediated device sysfs path independent of PCI id
Dominik Csapak [Tue, 20 Sep 2022 12:50:17 +0000 (14:50 +0200)]
pci: make mediated device sysfs path independent of PCI id

mdevs have a host-unique UUID they are indexed with in the PCI-id
independent `/sys/bus/mdev/devices/<uuid>` path, so there is no need
to go through the PCI id for them.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agopci: add/improve HW reservation comments
Thomas Lamprecht [Wed, 9 Nov 2022 07:55:55 +0000 (08:55 +0100)]
pci: add/improve HW reservation comments

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agovm start/stop: cleanup passed-through pci devices in more situations
Dominik Csapak [Tue, 20 Sep 2022 12:50:16 +0000 (14:50 +0200)]
vm start/stop: cleanup passed-through pci devices in more situations

if the preparing of PCI devices or the start of the VM fails, we need
to cleanup the PCI devices (reservations *and* mdevs), or else it
might happen that there are leftovers which must be manually removed.

to include also mdevs now, refactor the cleanup code from
'vm_stop_cleanup' into it's own function, and call that instead of
only 'remove_pci_reservation'

also simplifies the code, such that it now removes all PCI ids
reserved for that VMID, since we cannot have multiple VMs with the
same VMID anyway

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agofix #4228: add start parameter to rollback endpoint for automatic restarting of VM
Stefan Hanreich [Wed, 14 Sep 2022 08:30:53 +0000 (10:30 +0200)]
fix #4228: add start parameter to rollback endpoint for automatic restarting of VM

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
17 months agofix #3890 - GUI: warn for unlikely iothread config
Matthias Heiserer [Mon, 13 Jun 2022 13:54:25 +0000 (15:54 +0200)]
fix #3890 - GUI: warn for unlikely iothread config

Previously, only a plaintext line in the task log showed something was off.
Now, the GUI will show it as a warning.

Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
17 months agoapi: update cloudinit: line reduction/small cleanups
Thomas Lamprecht [Tue, 8 Nov 2022 16:38:18 +0000 (17:38 +0100)]
api: update cloudinit: line reduction/small cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoapi: add cloudinit to available subdirs index
Thomas Lamprecht [Tue, 8 Nov 2022 16:35:04 +0000 (17:35 +0100)]
api: add cloudinit to available subdirs index

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoadd cloudinit hotplug
Alexandre Derumier [Wed, 22 Jun 2022 11:52:05 +0000 (13:52 +0200)]
add cloudinit hotplug

This allow to regenerate config drive if pending values exist
when we change vm options.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agoapi2: add cloudinit_update
Alexandre Derumier [Wed, 22 Jun 2022 11:52:04 +0000 (13:52 +0200)]
api2: add cloudinit_update

This allow to regenerate the config drive with 1 api call.

This also avoid to delete drive first, and recreate it again.

As it's a readonly drive, we can simply live update it,
and eject/replace it with qemu monitor

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agoapi2: add cloudinit config api
Alexandre Derumier [Wed, 22 Jun 2022 11:52:03 +0000 (13:52 +0200)]
api2: add cloudinit config api

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agocloudinit: make cloudnit options fastplug
Alexandre Derumier [Wed, 22 Jun 2022 11:52:02 +0000 (13:52 +0200)]
cloudinit: make cloudnit options fastplug

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agogenerate cloudinit drive on offline plug
Alexandre Derumier [Wed, 22 Jun 2022 11:52:01 +0000 (13:52 +0200)]
generate cloudinit drive on offline plug

Currently when only generate it at vm start

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agocloudinit: add cloudinit section for current generated config.
Alexandre Derumier [Wed, 22 Jun 2022 11:52:00 +0000 (13:52 +0200)]
cloudinit: add cloudinit section for current generated config.

Instead using vm pending options for pending cloudinit generated config,

write current generated cloudinit config in a new [special:cloudinit] SECTION.

Currently, some options like vm name, nic mac address can be hotplugged,
so they are not way to know if the cloud-init disk is already updated.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agomigration: test targetnode min version for cloudinit section
Alexandre Derumier [Wed, 22 Jun 2022 11:51:59 +0000 (13:51 +0200)]
migration: test targetnode min version for cloudinit section

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agovzdump : skip special:cloudinit section
Alexandre Derumier [Wed, 22 Jun 2022 11:51:58 +0000 (13:51 +0200)]
vzdump : skip special:cloudinit section

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agoqemuconfig: load_current_config : delete cloudinit value
Alexandre Derumier [Wed, 22 Jun 2022 11:51:57 +0000 (13:51 +0200)]
qemuconfig: load_current_config : delete cloudinit value

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agoapi: create/update vm: clamp cpuunit value
Fiona Ebner [Fri, 7 Oct 2022 12:41:50 +0000 (14:41 +0200)]
api: create/update vm: clamp cpuunit value

While the clamping already happens before setting the actual systemd
CPU{Shares, Weight}, it can be done here too, to avoid writing new
out-of-range values into the config.

Can't use a validator enforcing this because existing out-of-range
values should not become errors upon parsing the config.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agochange cpu shares: drop superfluous parameter
Thomas Lamprecht [Tue, 8 Nov 2022 15:20:20 +0000 (16:20 +0100)]
change cpu shares: drop superfluous parameter

See the related commit in pve-common.

Originally-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomove get_cpuunits helper to guest-common
Fiona Ebner [Fri, 7 Oct 2022 12:41:48 +0000 (14:41 +0200)]
move get_cpuunits helper to guest-common

while making it take the value directly instead of the config.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 7.2-6
Thomas Lamprecht [Mon, 7 Nov 2022 15:26:42 +0000 (16:26 +0100)]
bump version to 7.2-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agod/control: bump versioned dependency of libpve-common-perl
Thomas Lamprecht [Mon, 7 Nov 2022 15:26:19 +0000 (16:26 +0100)]
d/control: bump versioned dependency of libpve-common-perl

for moved pve-targetstorage schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoschema: move 'pve-targetstorage' to pve-common
Fabian Grünbichler [Wed, 28 Sep 2022 12:50:53 +0000 (14:50 +0200)]
schema: move 'pve-targetstorage' to pve-common

for proper re-use in pve-container.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agobump version to 7.2-5
Thomas Lamprecht [Mon, 7 Nov 2022 15:15:22 +0000 (16:15 +0100)]
bump version to 7.2-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoqm: also move 'unlink' into disk related command group
Thomas Lamprecht [Mon, 7 Nov 2022 13:51:43 +0000 (14:51 +0100)]
qm: also move 'unlink' into disk related command group

missed that this one is also a disk specific command...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoqm: move disk related commands to own group
Thomas Lamprecht [Mon, 7 Nov 2022 13:43:25 +0000 (14:43 +0100)]
qm: move disk related commands to own group

set aliases for the previous ones for backward compat.

There's still cleanup potential, e.g., for snapshots, but to do that
nicely we may need (or want) to extend CLIHandler to accept commands
without fixed params also on the command group itself.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoqm: factor out setting node to local $nodename
Thomas Lamprecht [Mon, 7 Nov 2022 12:57:12 +0000 (13:57 +0100)]
qm: factor out setting node to local $nodename

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