Commit Graph

2302 Commits

Author SHA1 Message Date
Stefan Reiter
6db4c69e1d cfg2cmd: test runs_at_least_qemu_version and version_cmp explicitly
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-09 11:42:49 +01:00
Stefan Reiter
8b26544e50 cfg2cmd: minor cleanup
We never shipped a 4.1.0 QEMU, so it makes more sense to test as 4.1.1

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-09 11:42:49 +01:00
Thomas Lamprecht
c7728fdb85 followup: minor cleanup/error message spelling
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-09 11:30:14 +01:00
Dominik Csapak
844b55fb89 fix #2510: hostpci: always check if device exists
if the user set a device as hostpci with the 'shorthand' syntax:

hostpciX: 00:12

we ignored it on starting and showcmd and continued.
Since the user explicitly wanted to passthrough a device, we now check
if there is actually a device with that id

for explicitly configured devices (00:12.1), we did not check if it exists,
but the kvm call failed with a non-obvious error message

now we always call 'lspci' from SysFSTools to check if it actually exists,
and fail if not. With this, we can drop the workaround for adding
'0000' if no domain was given, since lspci does it already for us

this fixes #2510, an issue with using mediated devices where the users did not have
the domain in the config, since we forgot to add the default domain there

the only issue with this patch is that it changes the behaviour of
'showcmd' slightly, as in now, we die if the device was explicitly
given, but did not exists (we showed the commandline, now we fail)

this also slightly changes the commandline for qemu (adding always
the domain), which is not a problem since we cannot live migrate
or snapshot such vms, but we have to adapt the tests

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-12-09 11:30:14 +01:00
Dominik Csapak
0360faadc7 cfg2cmd test: add tests for multifunction devices
by mocking the lspci call

the mocked lspci code is basically the same as the real one,
only difference is the source of the devices and
there is no verbose flag

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-12-09 11:30:14 +01:00
Thomas Lamprecht
db40988ec9 Revert "fix #2478: record python3-minimal as build dependency"
This reverts commit 951b1783cd.
2019-12-09 10:32:46 +01:00
Thomas Lamprecht
bdd1feef5b fix #2469: fix qemu-img convert src_format detection
This reverts commit c5151cb8bb which is
a revert of the wrongly done revert of
commit e2414e73ce.
2019-12-09 10:31:33 +01:00
Thomas Lamprecht
340dbcf730 create_efidisk: poll the real size after volume creation
some storage backends have bigger granularity than the default 128k
size from the EFIVARS template file, so we actually need to poll the
real created disk size, as it will be used to create the target
volume for local storage migration on running VMs, if it's to small
the target will be to small and migration will fail.

Just a fix for newly created EFIDISKS, for others we need to rescan
the size after we've got the migrate lock and write the updated info
out, so that the target node has the correct one (protected from
migrate lock).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-04 18:42:27 +01:00
Thomas Lamprecht
dad06e2068 refactor storage whitelist in sync_disks to regex
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-04 18:40:03 +01:00
Thomas Lamprecht
4c2f3755c7 bump version to 6.1-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-30 18:38:50 +01:00
Thomas Lamprecht
546644e23d api: allow to clear vmstate actively
Sometimes, a user wants to remove the 'suspended' state without
resuming the vm from that state. Since the vm is locked with
'suspended', this was not possible without help from root@pam

This patch allows to delete the vmstate and the suspended lock and
related config entries with it. The user still has to have the right
priviliges and the vm cannot be 'protected' for this to work

Inspired-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-30 18:22:38 +01:00
Dominik Csapak
6afb679477 implement removal of vmstate via api
we did not actually delete the state if we deleted the 'vmstate' config,
leaving stray vmstates on the disks

actually implement the removal, requiring 'VM.Config.Disk' and
'VM.PowerMgmt' privs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-11-30 17:28:23 +01:00
Dominik Csapak
ad1d49f45c delete suspended lock when we have no vmstate
if a user removed the vmstate from the config for whatever reason,
a vmstart did not remove the 'suspended' lock
so always delete it and delete the vmstate only if it really was there

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-11-30 17:28:23 +01:00
Dominik Csapak
b85666cf7f logging vmstate into Resume/Start Task
so that the user knows what got loaded as vmstate

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-11-30 17:28:23 +01:00
Thomas Lamprecht
40a572f7e8 migrate phase 3 cleanup: add error into error propagation message
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-30 17:27:14 +01:00
Thomas Lamprecht
ae1f94e158 mon_cmd: add explicit return
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-30 17:24:55 +01:00
Thomas Lamprecht
82b25dbc0c vzdump: log QGA FS freeze/thaw try in task log
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-27 20:20:30 +01:00
Oguz Bektas
7a4bdb3662 skip efidisk0 in hotplug
while it's a disk from our storage POV, in QEMU it's a pflash, and
those cannot be hot-plugged

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-26 17:11:49 +01:00
Thomas Lamprecht
5eb1e5943f cleanup build artificats before doc clean
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-26 13:53:18 +01:00
Thomas Lamprecht
a78d5fb9a2 bump version to 6.1-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-26 13:07:11 +01:00
Thomas Lamprecht
c5151cb8bb Revert "fix #2469: fix qemu-img convert src_format detection"
This reverts commit e2414e73ce.
2019-11-26 13:06:57 +01:00
Thomas Lamprecht
951b1783cd fix #2478: record python3-minimal as build dependency
Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-26 11:37:21 +01:00
Thomas Lamprecht
9471e48bf9 implement PVE Version addition for QEMU machine
With our QEMU 4.1.1 package we can pass a additional internal version
to QEMU's machine, it will be split out there and ignored, but
returned on a QMP 'query-machines' call.

This allows us to use it for increasing the granularity with which we
can roll-out HW layout changes/additions for VMs. Until now we
required a machine version bump, happening normally every major
release of QEMU, with seldom, for us irrelevant, exceptions.
This often delays rolling out a feature, which would break
live-migration, by several months. That can now be avoided, the new
"pve-version" component of the machine can be bumped at will, and
thus we are much more flexible.

That versions orders after the ($major, $minor) version components
from an stable release - it can thus also be reset on the next
release.

The implementation extends the qemu-machine REGEX, remembers
"pve-version" when doing a "query-machines" and integrates support
into the min_version and extract_version helpers.

We start out with a version of 1.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
2019-11-25 16:43:38 +01:00
Fabian Grünbichler
e2414e73ce fix #2469: fix qemu-img convert src_format detection
if we don't know which format the source volume/file has, let qemu-img
decide.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-25 13:45:46 +01:00
Thomas Lamprecht
cbfff937ae version_cmp: give info about caller on error
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-25 11:16:38 +01:00
Thomas Lamprecht
de64f10114 api: use get_vm_arch instead of depreacted basic_machine_info
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-25 10:51:44 +01:00
Fabian Grünbichler
d184401e9f remove wrong comment
the change to encode pending changes differently is not yet included in
qemu-server.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-25 10:38:15 +01:00
Fabian Grünbichler
a85c6be13e api: catch 'pending' as snapshot name early
instead of only at write_config time.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-25 10:02:48 +01:00
Oguz Bektas
15c6e277a4 fix #2367: do not allow snapshot with name PENDING
or any other variant of the word 'pending'.

note that we can actually allow this snapshot after PVE 7.0, since
pending section and snapshots will be properly namespaced.
([pve:pending] and [snap:$snapname] or similar).

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-11-25 10:01:41 +01:00
Thomas Lamprecht
045749f2fc split get_basic_machine_info into get_vm_arch and get_vm_machine
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-25 08:56:58 +01:00
Thomas Lamprecht
d58b93a8bf vm start use new pve-qemu-machine standard option
'pve-qm-machine' is auto-registered, but for re-use for a new
runningmachine we added the newer pve-qemu-machine standard option.
Use that one to avoid confusion.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-25 08:54:14 +01:00
Thomas Lamprecht
050fcfdd98 cfg2cmd test: fix spice enhancement test
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-25 07:45:44 +01:00
Thomas Lamprecht
443054f68f bump version to 6.0-17
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-23 09:52:17 +01:00
Thomas Lamprecht
eec4f394f9 really fallback to PCI standard domain "0000" again
fixes commit 70740c1a4d

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-23 09:50:54 +01:00
Thomas Lamprecht
32b2bc62fc bump version to 6.0-16
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-22 14:19:01 +01:00
Thomas Lamprecht
825ae5bc3f fixup: use correct version_cmp
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-22 14:18:02 +01:00
Mira Limbeck
8f2c9019f5 fix #2473: use of unitialized value
With the noerr flag set in parse_volume_id we have to check if
$volname is defined before comparing it to 'cloudinit'.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-11-21 12:53:40 +01:00
Thomas Lamprecht
b3233604d1 bump version to 6.0-15
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-20 20:24:49 +01:00
Dominik Csapak
b8e7068a11 add 'tags' option
this is useful as meta information for e.g., provisioning or config
management systems

adding the info also to the 'status' api call to make it easier to show
it in the gui

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-11-20 20:24:49 +01:00
Thomas Lamprecht
c7ef117f4e d/control: bump versioned dependency on pve-common
to ensure the sysfs PCI tools can cope with our new more flexible PCI
addr (domain != 0000) fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-20 20:24:49 +01:00
Dominik Csapak
70740c1a4d fix #2436: pci: do not hardcode pci domain to 0000
relax the regex for hostpci to allow different pci domains than 0000

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-11-20 19:07:46 +01:00
Thomas Lamprecht
1773bb6b8b d/control: break old ha-manager, pve-manager
due to the refactoring file/module movements we made

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-20 19:07:12 +01:00
Thomas Lamprecht
6c9f59c122 cleanup: improve locallity of variable declaration/use
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-20 19:06:15 +01:00
Thomas Lamprecht
bf116bdfea followup snapshot-test: pass class to cfs_config_path
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-20 19:05:14 +01:00
Stefan Reiter
2ea5fb7ecf refactor: split qemu_machine_feature_enabled
...into:

* PVE::QemuServer::Helpers::min_version: check a major.minor version
  string with a given major/minor version (this is equivalent to calling
  the old qemu_machine_feature_enabled with only $kvmver)
* PVE::QemuServer::Machine::extract_version: get major.minor version
  string from arbitrary machine type (e.g. pc-q35-4.0, ...)
* PVE::QemuServer::Machine::machine_version: helper to call
  extract_version automatically before min_version

Includes a cfg2cmd test case with pinned machine version.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-20 18:32:35 +01:00
Stefan Reiter
3392d6cacf refactor: extract QEMU machine related helpers to package
...PVE::QemuServer::Machine.

qemu_machine_feature_enabled is exported since it has a *lot* of users
in PVE::QemuServer and a long enough name as it is.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-11-20 16:29:23 +01:00
Stefan Reiter
0a13e08ec2 refactor: create QemuServer::Monitor for high-level QMP access
QMP and monitor helpers are moved from QemuServer.pm.

By using only vm_running_locally instead of check_running, a cyclic
dependency to QemuConfig is avoided. This also means that the $nocheck
parameter serves no more purpose, and has thus been removed along with
vm_mon_cmd_nocheck.

Care has been taken to avoid errors resulting from this, and
occasionally a manual check for a VM's existance inserted on the
callsite.

Methods have been renamed to avoid redundant naming:
* vm_qmp_command -> qmp_cmd
* vm_mon_cmd -> mon_cmd
* vm_human_monitor_command -> hmp_cmd

mon_cmd is exported since it has many users. This patch also changes all
non-package users of vm_qmp_command to use the mon_cmd helper. Includes
mocking for tests.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-11-20 16:29:23 +01:00
Stefan Reiter
babf613a08 refactor: split check_running into _exists_ and _running_
vm_exists_on_node in PVE::QemuConfig checks if a config file for a vmid
exists

vm_running_locally in PVE::QemuServer::Helpers checks if a VM is running
on the local machine by probing its pidfile and checking /proc/.../cmdline

check_running is left in QemuServer for compatibility, but changed to
simply call the two new helper functions.

Both methods are also correctly mocked for testing snapshots.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-11-20 16:29:23 +01:00
Stefan Reiter
24622ebed4 Change check_cmdline to parse_cmdline
parse_cmdline is required for upcoming changes related to custom CPU
types and live migration, and this way we can re-use existing code.

Provides the necessary infrastructure to parse QEMU /proc/.../cmdline.
Changing the single user (check_running) is trivial too.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-11-20 16:29:23 +01:00
Stefan Reiter
d036e418a8 refactor: create QemuServer::Helpers and move file/dir code
Also remove unused $confdir variable in QemuConfig, but leave it and
$lock_dir there, since those paths should only be used with
cfs_config_path anyway.

nodename() is still called in multiple places, but since it's cached by
INotify it doesn't really matter.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-11-20 16:29:23 +01:00