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

2439 Commits

Author SHA1 Message Date
Thomas Lamprecht
7c4351f7d4 fix #2580: api/delete: drop VM from HA resources if purge is set
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-12 13:39:00 +01:00
Thomas Lamprecht
7ed8e940f1 d/control: bump versioned dependency for libpve-guest-common-perl (>= 3.0-5)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-12 11:11:58 +01:00
Dietmar Maurer
f6168f1a6a archive_pbs: call backup_cancel only when job is really started 2020-03-11 11:47:24 +01:00
Dietmar Maurer
d2cc2cbe69 archive_vma: call backup_cancel only when job is really started 2020-03-11 11:47:24 +01:00
Dietmar Maurer
e400f5e523 PVE/QemuServer.pm - proxmox backup server restore: use new pbs-restore binary
This is much faster than using a pipe with qemu-img.
2020-03-11 11:47:24 +01:00
Dietmar Maurer
9f3d73bc35 cleanup backup code: share code between restore_vma_archive and restore_proxmox_backup_archive 2020-03-11 11:47:24 +01:00
Dietmar Maurer
d1e92cf622 implement restore from proxmox backup storage 2020-03-11 11:47:24 +01:00
Dietmar Maurer
c5983223b0 add support for proxmox backup 2020-03-11 11:47:24 +01:00
Kamil Trzcinski
148850f693 Append newline to all QGA commands
Since the MacOS Mojave Apple ships AppleQEMUGuestAgent by default.
However, it does not fully adhere to QGA specs as they do expect each
command to be newline delimited.

This makes each command to be newline delimited which is harmless for
all other systems (Windows, Linux), but enable guest agent by default
without any changes on OSX.

Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
2020-03-11 11:11:45 +01:00
Alexandre Derumier
28e129cccb sdn: use sdn tap_create|plug
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-10 19:08:31 +01:00
Thomas Lamprecht
86a2e85a26 cloudinit: make genisoimage only output errors
avoids a genisoimage output like:
> Total translation table size: 0
> Total rockridge attributes bytes: 417
> Total directory bytes: 0
> Path table size(bytes): 10
> Max brk space used 0
> 178 extents written (0 MB)

on every VM start.

Rather than that useless output, tell genisoimage to be quiet, which
still prints errors but nothing else. Additionally print a short
single line about that we're to create the cloud-init iso.

Reformat while at it.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-10 14:50:39 +01:00
Thomas Lamprecht
37e9b2d031 d/control: bump versioned dependency for libpve-guest-common-perl (>= 3.0-4)
for the moved definedness-safe comparison methods

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-10 14:28:29 +01:00
Thomas Lamprecht
81d6e4e1b8 followup: do not import unused methods
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-10 14:26:29 +01:00
Oguz Bektas
0f1af9e777 QemuServer: use helper functions from GuestHelpers
removes safe_string_ne and safe_num_ne code which is now shared in
GuestHelpers. also change all the calls to use the shared definitions.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2020-03-10 09:39:15 +01:00
Thomas Lamprecht
00d8327000 bump version to 6.1-7
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-09 19:37:05 +01:00
Fabian Ebner
0ad295f9fb Consistently use format determined in 'PVE::Storage::foreach_volid'
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
LGTM-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-03-09 19:36:58 +01:00
Fabian Ebner
5eca0c3643 sync_disks: Always set 'snapshots' for qcow2 and vmdk volumes
This fixes an issue when migrating a VM with an unused volume with format
qcow2 or vmdk. Since 'snapshots' wasn't set, storage_migrate wanted to
export/import with format raw+size instead. Therefore it used (instead of
just 'dd') 'qemu-img convert', which fails when its output leaves through
a pipe. Upon importing, a second error is present, because the format from
the volume ID doesn't match the format of the stream and there is no
conversion yet.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
LGTM-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-03-09 19:36:45 +01:00
Thomas Lamprecht
b2d27b3242 update_disksize: small code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-07 18:34:21 +01:00
Fabian Ebner
63e313f386 Also update disk size if there was no old size
If for whatever reason there is no size in the property string
of a drive, 'qm rescan' would do nothing for that drive and
live migration would also fail.

Also adds a check to avoid potential auto-vivification of volid_hash->{$volid}

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-03-07 18:23:57 +01:00
Fabian Ebner
a3597c9448 Use MAX_UNUSED_DISKS from Drive.pm to avoid duplication
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-03-07 18:23:57 +01:00
Fabian Ebner
776c5f5067 Rename disksize to bootdisk_size and print_drive_full to print_drive_commandline_full
to avoid confusion with print_drive

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-03-07 18:23:57 +01:00
Fabian Ebner
e0fd2b2f84 Create Drive.pm and move drive-related code there
The initialization for the drive keys in $confdesc is changed
to be a single for-loop iterating over the keys of $drivedesc_hash and
the initialization of the unusedN keys is move to directly below it.

To avoid the need to change all the call sites, functions with more than
a few callers are exported from the submodule and imported into QemuServer.pm.

For callers of the now imported functions within QemuServer.pm, the prefix
PVE::QemuServer is dropped, because it is unnecessary and now even confusing.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-03-07 18:23:57 +01:00
Fabian Ebner
ad396d54e4 Use parse_drive for EFI disk
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-03-07 18:23:57 +01:00
Fabian Ebner
28438925dc Replace drivename_hash with drivedesc_hash
which contains the full descriptions of the drives, and
make parse_drive not depend on $confdesc anymore.
In preparation to moving drive-related code to its own module.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-03-07 18:23:57 +01:00
Stefan Reiter
2cf61f33d9 fix #2264: add virtio-rng device
Allow a user to add a virtio-rng-pci (an emulated hardware random
number generator) to a VM with the rng0 setting. The setting is
version_guard()-ed.

Limit the selection of entropy source to one of three:
/dev/urandom (preferred): Non-blocking kernel entropy source
/dev/random: Blocking kernel source
/dev/hwrng: Hardware RNG on the host for passthrough

QEMU itself defaults to /dev/urandom (or the equivalent getrandom()
call) if no source file is given, but I don't fully trust that
behaviour to stay constant, considering the documentation [0] already
disagrees with the code [1], so let's always specify the file ourselves.

/dev/urandom is preferred, since it prevents host entropy starvation.
The quality of randomness is still good enough to emulate a hwrng, since
a) it's still seeded from the kernel's true entropy pool periodically
and b) it's mixed with true entropy in the guest as well.

Additionally, all sources about entropy predicition attacks I could find
mention that to predict /dev/urandom results, /dev/random has to be
accessed or manipulated in one way or the other - this is not possible
from a VM however, as the entropy we're talking about comes from the
*hosts* blocking pool.

More about the entropy and security implications of the non-blocking
interface in [2] and [3].

Note further that only one /dev/hwrng exists at any given time, if
multiple RNGs are available, only the one selected in
'/sys/devices/virtual/misc/hw_random/rng_current' will feed the file.
Selecting this is left as an exercise to the user, if at all required.

We limit the available entropy to 1 KiB/s by default, but allow the user
to override this. Interesting to note is that the limiter does not work
linearly, i.e. max_bytes=1024/period=1000 means that up to 1 KiB of data
becomes available on a 1000 millisecond timer, not that 1 KiB is
streamed to the guest over the course of one second - hence the
configurable period.

The default used here is the same as given in the QEMU documentation [0]
and has been verified to affect entropy availability in a guest by
measuring /dev/random throughput. 1 KiB/s is enough to avoid any
early-boot entropy shortages, and already has a significant impact on
/dev/random availability in the guest.

[0] https://wiki.qemu.org/Features/VirtIORNG
[1] https://git.qemu.org/?p=qemu.git;a=blob;f=crypto/random-platform.c;h=f92f96987d7d262047c7604b169a7fdf11236107;hb=HEAD
[2] https://lwn.net/Articles/261804/
[3] https://lwn.net/Articles/808575/

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-03-06 18:09:04 +01:00
Thomas Lamprecht
d0cdb1de07 cpu models: add missing comma
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-06 17:57:46 +01:00
Alexandre Derumier
bb84db9d3e cpu models: qemu 4.2 : add skylake, icelake, cascadelake notsx
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2020-03-06 17:57:46 +01:00
Alexandre Derumier
257ae68768 cpu models : add icelake-{server|client}
exist since 2018
https://git.qemu.org/?p=qemu.git;a=commit;h=8a11c62da9146dd89aee98947e6bd831e65a970d

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2020-03-06 17:57:46 +01:00
Thomas Lamprecht
109a095068 QGA exec: note limits explicit in CLI and API
The http-server has a 64KB payload limit for post requests, so note
that explicit even if it's a theoretical maximum as the reamainig
params also need some space in the request

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-06 17:57:46 +01:00
Stefan Reiter
d8f61794f6 fix #2612: allow input-data in guest exec and make command optional
'input-data' can be used to pass arbitrary data to a guest when running
an agent command with 'guest-exec'. Most guest-agent implementations
treat this as STDIN to the command given by "path"/"arg", but some go as
far as relying solely on this parameter, and even fail if "path" or
"arg" are set (e.g. Mikrotik Cloud Hosted Router) - thus "command" needs
to be made optional.

Via the API, an arbitrary string can be passed, on the command line ('qm
guest exec'), an additional '--pass-stdin' flag allows to forward STDIN
of the qm process to 'input-data', with a size limitation of 1 MiB to
not overwhelm QMP.

Without 'input-data' (API) or '--pass-stdin' (CLI) behaviour is unchanged.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-03-03 14:34:02 +01:00
Stefan Reiter
29eb909ee0 fix #2611: use correct operation in get_bandwidth_limit
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-03-03 11:47:13 +01:00
Fabian Ebner
d7117b5adb print_drive: Use $skip to avoid the need to copy the hash
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-25 12:29:38 +01:00
Fabian Ebner
375db731f7 Align size to 1 KiB bytes before doing 'qmp block_resize'
1. Avoids the error
"VM 111 qmp command 'block_resize' failed - The new size must be a multiple of 512"
for qcow2 disks.
2. Because volume_import expects disk sizes to be a multiple of 1 KiB.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-19 15:31:41 +01:00
Stefan Reiter
1249d579ea vzdump: exclude efidisks from backups of non-OVMF machines
Machines running with SeaBIOS don't have the efidisk attached, so QEMU
cannot back it up and fails with "unknown drive".

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-02-17 15:47:04 +01:00
Stefan Reiter
a04dd5c455 Simplify QEMU version check and require 3.0+
Some of the recent QMP changes require at least 2.8.0, but since the
oldest version we officially package for 6.x is 4.0.0 anyway, checking
for at least 3.0 should not break anyone's setup.

Note that this does not affect machine version checks, only the
installed QEMU binary version.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-02-12 11:19:29 +01:00
Stefan Reiter
b8fb1c03c3 version_guard scsi drive count
Live-migrating a VM with more than 14 SCSI disks to a node that doesn't
support it yet is broken. Use a bumped pve-version to represent that and
give the user a nice error message instead.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-02-12 10:32:57 +01:00
Stefan Reiter
ac0077cc33 Use 'QEMU version' -> '+pve-version' mapping for machine types
The previously introduced approach can fail for pinned versions when a
new QEMU release is introduced. The saner approach is to use a mapping
that gives one pve-version for each QEMU release.

Fortunately, the old system has not been bumped yet, so we can still
change it without too much effort.

QEMU versions without a mapping are assumed to be pve0, 4.1 is mapped to
pve1 since thats what we had as our default previously.

Pinned machine versions (i.e. pc-i440fx-4.1) are always assumed to be
pve0, for specific pve-versions they'd have to be pinned as well (i.e.
pc-i440fx-4.1+pve1).

The new logic also makes the pve-version dynamic, and starts VMs with
the lowest possible 'feature-level', i.e. if a feature is only available
with 4.1+pve2, but the VM isn't using it, we still start it with
4.1+pve0.

We die if we don't support a version that is requested from us. This
allows us to use the pve-version as live-migration blocks (i.e. bumping
the version and then live-migrating a VM which uses the new feature (so
is running with the bumped version) to an outdated node will present the
user with a helpful error message and fail instead of silently modifying
the config and only failing *after* the migration).

$version_guard is introduced in config_to_command to use for features
that need to check pve-version, it automatically handles selecting the
newest necessary pve-version for the VM.

Tests have to be adjusted, since all of them now resolve to pve0 instead
of pve1. EXPECT_ERROR matching is changed to use 'eq' instead of regex
to allow special characters in error messages.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-02-12 10:32:57 +01:00
Thomas Lamprecht
8541f8cddb bump version to 6.1-6
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-10 06:40:45 +01:00
Fabian Ebner
b5490d8a98 resize_vm: request new size from storage after resizing
Because of alignment and rounding in the storage backend, the effective
size might not match the 'newsize' parameter we passed along.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-07 13:37:54 +01:00
Stefan Reiter
65af8c312e qmp: use query-cpus-fast for hotplug
query-cpus has been deprecated since 2.12.0 [0] in favor of
query-cpus-fast, which no longer incurs a guest performance penalty on
the guest. The returned information is the same as far as our use case
is concerned.

[0] https://qemu.weilnetz.de/doc/qemu-doc.html#Deprecated-features

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-02-06 13:50:33 +01:00
Stefan Reiter
485449e37b qmp: use migrate-set-parameters in favor of deprecated options
migrate_set_downtime, migrate_set_speed and migrate-set-cachesize have
all been deprecated since 2.8 or 2.11 [0]. They still work, but no
reason not to use the correct version.

Note that the downtime-limit parameter switched from seconds to
milliseconds, so convert to that. Slightly improve log output with units
while at it.

[0] https://qemu.weilnetz.de/doc/qemu-doc.html#Deprecated-features

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-02-06 13:50:33 +01:00
Stefan Reiter
922869f223 qmp: use 'id' parameter instead of 'device'
'device' is deprecated since 2.8 in favor of 'id' [0], but since we
always consistently set the id on our drives anyway we can substitute it
easily.

[0] see files qapi/block.json and qapi/block-core.json in QEMU source
code, the online documentation doesn't mention it AFAICT

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-02-06 13:50:33 +01:00
Stefan Reiter
ce9fce7985 qmp: use 'blockdev-change-medium' instead of generic 'change'
...and cleanup surrounding code a bit.

'change' is deprecated, and according to the qapi definition in QEMU it
is 'strongly recommended' to avoid using it.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-02-06 13:50:33 +01:00
Stefan Reiter
9e7bce2c88 Remove unused $force parameter
The fixme got it right :)

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-02-06 13:50:33 +01:00
Fabian Grünbichler
683ab65491 migrate: re-order lines to improve readability
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-02-05 09:43:09 +01:00
Fabian Ebner
1764fa05d0 Extract volume ID before calling 'parse_volume_id'
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-05 08:41:05 +01:00
Fabian Ebner
8b02e56870 rename 'volid' to 'drivestr' where it's not only a volume ID
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-05 08:41:05 +01:00
Fabian Ebner
86ea0ed0e0 Fix description for vm_config and change description for vm_pending
The description for vm_config was out of date and from the description
for vm_pending it was hard to tell what the difference to vm_config was.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-05 08:37:52 +01:00
Fabian Grünbichler
e099bad488 fixup: re-add target check
that accidentally got dropped while re-factoring previous commit

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-02-05 08:35:14 +01:00
Oguz Bektas
d069275fc9 fix #2578: check if $target is provided in clone
regression introduced with commit a85ff91b

previously we set $target to undef if it's localnode or localhost, then
we check if node exists.

with regression commit, behaviour changes as we do the node check in
else, but $target may be undef. this causes an error:

    no such cluster node ''

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>

improved readability

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-02-05 08:31:01 +01:00