5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-10 01:18:01 +03:00
Commit Graph

1835 Commits

Author SHA1 Message Date
Stefan Reiter
b53ba8d0f1 fixup: use parse_property_string instead of parse_cpu_conf_basic
The latter was removed and replaced with a validator.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-07-09 14:45:21 +02:00
Stefan Reiter
fb9f512c19 backup: detect PBS features and use only supported
If 'query-proxmox-support' is not known to QEMU, assume that no other
features are supported either.

If 'pbs' is not supported at all, error out with a nice message.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-09 13:44:22 +02:00
Stefan Reiter
7b8c4de3b8 fix #2671: include CPU format in man page again
Use the new register_format(3) call to use a validator (instead of a
parser) for 'pve-(vm-)?cpu-conf'. This way the $cpu_fmt hash can be used for
generating the documentation, while still applying the same verification
rules as before.

Since the function no longer parses but only verifies, the parsing in
print_cpu_device/get_cpu_options has to go via JSONSchema directly.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-07-08 10:28:20 +02:00
Thomas Lamprecht
91c9f3b062 vzdump: log: small fixups
reuse can also come from the current backup - so drop the "from last
backup" as this can be very confusing if one reads it after making
the first backup ever, with no last backup existing.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-07 17:32:27 +02:00
Thomas Lamprecht
2098f2ff87 vzdump: fix variable redeclaration warning
happened due to moving the code from another scope which had no $res,
and not noticing as it was still working after all.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-07 08:41:30 +02:00
Thomas Lamprecht
b4be9c0207 backup: PBS: save backup task size
normally this is done centrally in the managers code, but we do not
have the info for PBS there.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-06 21:59:50 +02:00
Thomas Lamprecht
6cdb568c33 backup: query status: use latest up-to-date info when finished
we used the info from the previous loop for some summary logs, fix
that.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-06 21:59:50 +02:00
Thomas Lamprecht
4d159c24d9 backup: restructure log: use human-readable sizes and include PBS info
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-06 21:59:50 +02:00
Thomas Lamprecht
bbdf1ea5c8 backup: rename confusing incremental param to use-dirty-bitmap
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-06 20:33:13 +02:00
Fabian Ebner
9b29cbd0ed update_disksize: make interface leaner
Pass new size directly, so the function doesn't need to know about
how some hash is organized. And return a message directly, instead
of both size-strings. Also dropped the wantarray, because both
existing callers use the message anyways.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-07-01 09:18:13 +02:00
Fabian Ebner
1c2174833b sync_disks: fix check
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-07-01 09:13:06 +02:00
Stefan Reiter
69e6289470 enable dirty-bitmap incremental backups for PBS
The $total != $transferred check is changed to a log, as QEMU reports
only actually transferred bytes, and it is indeed correct for
incremental backups to have differing values from $total.

The 'incremental' parameter is always set, QEMU will figure out if it should
re-use an existing bitmap or create a new one on its own.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-06-29 13:15:47 +02:00
Mira Limbeck
fc701af740 close #2741: add VM.Config.Cloudinit permission
This allows setting ciuser, cipassword and all other cloudinit settings that
are not part of the network without VM.Config.Network permissions.
Keep VM.Config.Network still as fallback so custom roles that add
VM.Config.Network but not VM.Config.Cloudinit don't break.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2020-06-26 09:41:43 +02:00
Dietmar Maurer
f57666e949 avoid backup command timeout with pbs 2020-06-26 09:30:31 +02:00
Thomas Lamprecht
1fac3a0b31 pci: whitespace, indentation and formating fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-25 13:33:26 +02:00
Stefan Reiter
13d689792e fix #2794: allow legacy IGD passthrough
Legacy IGD passthrough requires address 00:1f.0 to not be assigned to
anything on QEMU startup (currently it's assigned to bridge pci.2).
Changing this in general would break live-migration, so introduce a new
hostpci parameter "legacy-igd", which if set to 1 will move that bridge
to be nested under bridge 1.

This is safe because:
* Bridge 1 is unconditionally created on i440fx, so nesting is ok
* Defaults are not changed, i.e. PCI layout only changes when the new
parameter is specified manually
* hostpci forbids migration anyway

Additionally, the PT device has to be assigned address 00:02.0 in the
guest as well, which is usually used for VGA assignment. Luckily, IGD PT
requires vga=none, so that is not an issue either.

See https://git.qemu.org/?p=qemu.git;a=blob;f=docs/igd-assign.txt

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-06-25 13:25:35 +02:00
Stefan Reiter
74c17b7a23 cfg2cmd: hostpci: move code to PCI.pm
To avoid further cluttering config_to_command with subsequent changes.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-06-25 13:25:35 +02:00
Thomas Lamprecht
5a92276e2d trivial whitespace followup fix
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-24 10:59:05 +02:00
Aaron Lauterer
185df962a5 vzdump: move include logic for volumes to method
Move the logic which volumes are included in the backup job to its own
method and adapt the VZDump code accordingly. This makes it possible to
develop other features around backup jobs.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-06-24 10:56:57 +02:00
Fabian Grünbichler
a4e128a9a9 gen_rand_chars: handle errors properly
should not really happen on modern systems, but random_bytes just
returns false if it fails to generate random bytes, in which case we
want to die instead of returning an empty 'random' string.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-06-22 12:03:01 +02:00
Thomas Lamprecht
3c5bdde815 vncproxy: allow to request a generated VNC password
We used the VNC API $ticket as password for VNC, but QEMU limits the
password to the first 8 chars and ignores the rest[0].
As our tickets start with a static string (e.g., "PVE") the entropy
was a bit limited.

For Proxmox VE this does not matters much as the noVNC viewer
provided by has to go always over the API call, and so a valid
ticket and correct permissions for the requested VM are enforced
anyway.

This patch helps external users, which often use NoVNC-Websockify,
circumventing the API and relying solely on the VNC password to avoid
snooping on VNC sessions.

A 'generate-password' parameter is added, if set a password from good
entropy (using libopenssl) is generated.

For simplicity of mapping random bits to ranges we extract 6 bit of
entropy per character and add the integer value of '!' (first
printable ASCII char) to that. This way we get 64^8 possibilities,
which even with millions of guesses per second one would need years
of guessing and mostly just DDOS the server with websocket upgrade
requests.

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

Tested-By: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
2020-06-22 12:01:55 +02:00
Stefan Reiter
1b7824d349 CPUConfig: add add_cpu_json_properties()
Useful for APIs and docs.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-06-18 17:11:47 +02:00
Thomas Lamprecht
b63f34b8a1 fix indentation
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-18 11:26:36 +02:00
Thomas Lamprecht
326007b250 followup whitespace cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-17 14:05:49 +02:00
Fabian Grünbichler
d7856be59e properly parse 'vga' for termproxy
'vga' is a property string, we can't just assume it starts with the default key's value here either.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-06-17 14:04:26 +02:00
Fabian Grünbichler
d3efae29f5 fix #2787: properly parse 'vga' for vncproxy
'vga' is a property string, we can't just assume it starts with the
default key's value.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-06-17 14:04:26 +02:00
Thomas Lamprecht
0530177bd1 netdev MTU: stricter checks and warn if not possible on netdev
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-04 11:19:13 +02:00
Alexandre Derumier
61a14cde8d add virtio host_mtu feature.
This add a new "mtu" param to vm nic,
and force the mtu in the guest for virtio nic only.

Special value: 1 = set the same value than the bridge
2020-06-04 10:58:49 +02:00
Dominik Csapak
55fb78aa4a fix pbs-restore call for non raw images
if we have a format, give it to pbs-restore too
fixes restore of non-raw (e.g. qcow2) images

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-06-04 10:56:09 +02:00
Dominik Csapak
77b24c6267 fix pbs backups of templates/vms without disks
fingerprint is now given with an environment variable not as parameter

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-06-03 14:36:31 +02:00
Fabian Grünbichler
35171ddb0d fix #2774: add early check for non-managed volumes
when checking whether a to-be-added drive's and the VM's replication
status are matching. otherwise, we end up in a failing generic
'parse_volume_id' with no mention of the actual reason.

adding 'replicate=0' to the new drive string fixes the underlying issue
with and without this patch, so this is just a cosmetic/usability
improvement.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-06-02 11:46:08 +02:00
Fabian Grünbichler
e3d3194446 create_disks: fix uninitialized warning
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-06-02 11:46:08 +02:00
Mira Limbeck
d4fa9981b8 fix #2748: make order of interfaces consistent
As perl hashes have random order, sort them before iterating through.
This makes the output of 'qm cloudinit dump <vmid> network' consistent
between calls if the config has not changed.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2020-06-02 11:45:35 +02:00
Dominik Csapak
bf5aef9be3 fix #2697: map netdev_add options to correct json types
netdev_add is now a proper qmp command, which means that it verifies
the parameter types properly

instead of sending strings, we now have to choose the correct
types for the parameters

bool for vhost
and uint64 for queues

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-05-08 12:55:32 +02:00
Fabian Grünbichler
a2ec5a6705 qmrestore: fix restore from STDIN
the special case was dropped when moving this to pve-storage.

fixes commit c6d517835a

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-07 16:12:10 +02:00
Stefan Reiter
a73cc99391 api: allow listing custom and default CPU models
More API calls will follow for this path, for now add the 'index' call to
list all custom and default CPU models.

Any user can list the default CPU models, as these are public anyway, but
custom models are restricted to users with Sys.Audit on /nodes.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-05-06 16:48:08 +02:00
Stefan Reiter
6e72f90bbb api: check Sys.Audit permissions when setting a custom CPU model
Explicitly allows changing other properties than the cputype, even if
the currently set cputype is not accessible by the user. This way, an
administrator can assign a custom CPU type to a VM for a less privileged
user without breaking edit functionality for them.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-05-06 16:48:08 +02:00
Fabian Grünbichler
690748632b vzdump: use new 'pbs' option
instead of storage config to determine whether we are in 'PBS mode'

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-05-06 16:20:46 +02:00
Fabian Grünbichler
ae194a5c5e migrate: cleanup forwarding code
fixing the following two issues:
- the legacy code path was never converted to the new fork_tunnel
signature (which probably means that nothing triggers it in practice
anymore?)
- the NBD Unix socket got forwarded multiple times if more than one disk
was migrated via NBD (this is harmless, but wrong)

for the second issue I opted to keep the code compatible with the
possibility that Qemu starts supporting multiple NBD servers in the
future (and the target node could thus return multiple UNIX socket
paths). currently we can only start one NBD server on one socket, and
each drive-mirror simply starts a new connection over that single
socket.

I took the liberty of renaming the variables/keys since I found
'tunnel_addr' and 'sock_addr' rather confusing.

Reviewed-By: Mira Limbeck <m.limbeck@proxmox.com>
Tested-By: Mira Limbeck <m.limbeck@proxmox.com>

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-05-06 16:16:50 +02:00
Aaron Lauterer
1cc5ed1bc4 cfg2cmd: set audiodev parameter only on qemu >= 4.2
fixes commit 940e2a3a06

QEMU 4.1 will fail to start a guest with an audio device set with:
> Property '.audiodev' not found

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-06 15:14:15 +02:00
Stefan Reiter
058531889f rng: die when trying to pass through disconnected hwrng
If /dev/hwrng exists, but no actual generator is connected (or it is
disabled on the host), QEMU will happily start the VM but crash as soon
as the guest accesses the VirtIO RNG device.

To prevent this unfortunate behaviour, check if a useable hwrng is
connected to the host before allowing the VM to be started.

While at it, clean up config_to_command by moving new and existing rng
source checks to a seperate sub.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-05-06 14:23:04 +02:00
Fabian Grünbichler
6bb12239cc vzdump: fix template backup to stdout
redirecting to the saved STDOUT in case of a template backup or a VM
without any disks failed because of the erroneous '=':

Backup of VM 123123 failed - command '/usr/bin/vma create -v -c [...]' failed:
Bad filehandle: =5 at /usr/share/perl/5.28/IPC/Open3.pm line 58.

https://forum.proxmox.com/threads/vzdump-to-stdout.69364

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-05-06 14:23:04 +02:00
Stefan Reiter
b57d4863e2 cfg2cmd: fix uninitialized value warning on OVMF w/o efidisk
It's possible to have a VM with OVMF but without an efidisk, so don't
call parse_drive on a potential undef value.

Partial revert of 818c3b8d91 ("cfg2cmd: ovmf: code cleanup")

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-05-06 14:23:04 +02:00
Fabian Grünbichler
45fd77bbe3 clone: use new config_lock_shared
and move the lock call and decision logic closer together

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
2020-05-05 11:41:55 +02:00
Fabian Ebner
e29e5be6ef Revert "resize_vm: request new size from storage after resizing"
This reverts commit b5490d8a98.

When resizing a volume of a running VM, a qmp block_resize command
is issued. This is non-blocking, so the size on the storage immediately
after issuing the command might still be the old one.

This is part of the issue reported in bug #2621.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-05-04 17:35:21 +02:00
Dominik Csapak
cd37203880 migrate: skip rescan for efidisk and shared volumes
we really only want to rescan the disk size of the disks we actually
need, and that are only the local disks (for which we have to allocate
the correct size on the target)

also we want to always skip the efidisk, since we get the wanted
size after the loop, and this produced a confusing log line
(for details why we do not want the 'real' size,
see commit 818ce80ec1)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-05-04 17:35:12 +02:00
Fabian Grünbichler
6f4b11e9db migrate: don't accidentally take NBD code paths
by avoiding auto-vivification of $self->{online_local_volumes} via
iteration. most code paths don't care whether it's undef or a reference
to an empty list, but this caused the (already) fixed bug of calling
nbd_stop without having started an NBD server in the first place.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-05-04 17:34:58 +02:00
Fabian Grünbichler
a4c7029dd8 api/destroy: repeat early checks after lock
to protect against concurrent changes

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-05-04 17:33:53 +02:00
Fabian Grünbichler
8284121451 QemuServer: drop unused imported locking functions
lock_file is used by PVE::QemuServer::Memory, but it does properly 'use
PVE::Tools ...' itself so we can drop them in the main module.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-05-04 17:33:32 +02:00
Thomas Lamprecht
1bd6fe132f vzdump: assemble: fix skipping all pending and snapshot config entries
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-04 17:29:09 +02:00