]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
4 years agosplit get_basic_machine_info into get_vm_arch and get_vm_machine
Thomas Lamprecht [Mon, 25 Nov 2019 07:56:58 +0000 (08:56 +0100)]
split get_basic_machine_info into get_vm_arch and get_vm_machine

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agovm start use new pve-qemu-machine standard option
Thomas Lamprecht [Mon, 25 Nov 2019 07:54:07 +0000 (08:54 +0100)]
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>
4 years agocfg2cmd test: fix spice enhancement test
Thomas Lamprecht [Mon, 25 Nov 2019 06:45:44 +0000 (07:45 +0100)]
cfg2cmd test: fix spice enhancement test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-17
Thomas Lamprecht [Sat, 23 Nov 2019 08:52:17 +0000 (09:52 +0100)]
bump version to 6.0-17

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoreally fallback to PCI standard domain "0000" again
Thomas Lamprecht [Sat, 23 Nov 2019 08:47:56 +0000 (09:47 +0100)]
really fallback to PCI standard domain "0000" again

fixes commit 70740c1a4d60b002249a648cc6588ecddb44ec70

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-16
Thomas Lamprecht [Fri, 22 Nov 2019 13:19:01 +0000 (14:19 +0100)]
bump version to 6.0-16

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofixup: use correct version_cmp
Thomas Lamprecht [Fri, 22 Nov 2019 13:18:02 +0000 (14:18 +0100)]
fixup: use correct version_cmp

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2473: use of unitialized value
Mira Limbeck [Thu, 21 Nov 2019 10:04:25 +0000 (11:04 +0100)]
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>
4 years agobump version to 6.0-15
Thomas Lamprecht [Wed, 20 Nov 2019 18:41:05 +0000 (19:41 +0100)]
bump version to 6.0-15

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd 'tags' option
Dominik Csapak [Thu, 31 Oct 2019 12:36:25 +0000 (13:36 +0100)]
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>
4 years agod/control: bump versioned dependency on pve-common
Thomas Lamprecht [Wed, 20 Nov 2019 18:08:33 +0000 (19:08 +0100)]
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>
4 years agofix #2436: pci: do not hardcode pci domain to 0000
Dominik Csapak [Tue, 12 Nov 2019 13:23:03 +0000 (14:23 +0100)]
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>
4 years agod/control: break old ha-manager, pve-manager
Thomas Lamprecht [Wed, 20 Nov 2019 18:06:57 +0000 (19:06 +0100)]
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>
4 years agocleanup: improve locallity of variable declaration/use
Thomas Lamprecht [Wed, 20 Nov 2019 18:06:15 +0000 (19:06 +0100)]
cleanup: improve locallity of variable declaration/use

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofollowup snapshot-test: pass class to cfs_config_path
Thomas Lamprecht [Wed, 20 Nov 2019 18:05:14 +0000 (19:05 +0100)]
followup snapshot-test: pass class to cfs_config_path

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agorefactor: split qemu_machine_feature_enabled
Stefan Reiter [Tue, 19 Nov 2019 11:23:49 +0000 (12:23 +0100)]
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>
4 years agorefactor: extract QEMU machine related helpers to package
Stefan Reiter [Tue, 19 Nov 2019 11:23:48 +0000 (12:23 +0100)]
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>
4 years agorefactor: create QemuServer::Monitor for high-level QMP access
Stefan Reiter [Tue, 19 Nov 2019 11:23:47 +0000 (12:23 +0100)]
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>
4 years agorefactor: split check_running into _exists_ and _running_
Stefan Reiter [Tue, 19 Nov 2019 11:23:46 +0000 (12:23 +0100)]
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>
4 years agoChange check_cmdline to parse_cmdline
Stefan Reiter [Tue, 19 Nov 2019 11:23:45 +0000 (12:23 +0100)]
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>
4 years agorefactor: create QemuServer::Helpers and move file/dir code
Stefan Reiter [Tue, 19 Nov 2019 11:23:44 +0000 (12:23 +0100)]
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>
4 years agoFix 'uninitialized value' warning about guest agent type
Stefan Reiter [Wed, 20 Nov 2019 12:24:57 +0000 (13:24 +0100)]
Fix 'uninitialized value' warning about guest agent type

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agoAdd 'runningmachine' support to vm_commandline
Stefan Reiter [Wed, 20 Nov 2019 12:24:56 +0000 (13:24 +0100)]
Add 'runningmachine' support to vm_commandline

to allow 'qm showcmd --snapshot ...' to show the correct machine type.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agomigration: fix false-positive log for copying local images
Thomas Lamprecht [Wed, 20 Nov 2019 15:01:33 +0000 (16:01 +0100)]
migration: fix false-positive log for copying local images

Only log that if we actually have local disks.
Add also an explicit log for replication.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoqemu: remove unused methods
Thomas Lamprecht [Wed, 20 Nov 2019 14:35:18 +0000 (15:35 +0100)]
qemu: remove unused methods

found no use with tree-wide search, so remove:
* nic_models
* os_list_description

Both were introduced before the import to SVN happened.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofollowup: adding qxl max_outputs breaks live-migration/restore
Thomas Lamprecht [Wed, 20 Nov 2019 14:31:16 +0000 (15:31 +0100)]
followup: adding qxl max_outputs breaks live-migration/restore

enforce QEMU 4.1.x for that change

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoqxl max_outputs: ostype can be undefined, assume linux
Thomas Lamprecht [Wed, 20 Nov 2019 14:10:16 +0000 (15:10 +0100)]
qxl max_outputs: ostype can be undefined, assume linux

Out code behaves like either l26 or other when the ostype is
undefined, both are not common as our webinterface _always_ sets the
ostype.

If one configured QXL with a VM as output device but does not has an
ostype set, and that works without "max_outputs=4" it really should
work with none too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoprint_vga_device: fix qxl displays on Linux guests
Aaron Lauterer [Tue, 19 Nov 2019 15:18:19 +0000 (16:18 +0100)]
print_vga_device: fix qxl displays on Linux guests

with pve-qemu-4.0.1-3 or higher it was not possible in a spice remote
session to enable more displays on the fly in linux guests.

Adding the `max_outputs` parameter to the qxl device manually restores
the functionality.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agoget_cpu_options: reuse ostype variable
Thomas Lamprecht [Wed, 20 Nov 2019 14:05:20 +0000 (15:05 +0100)]
get_cpu_options: reuse ostype variable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoostype: update verbose description
Thomas Lamprecht [Wed, 20 Nov 2019 14:03:10 +0000 (15:03 +0100)]
ostype: update verbose description

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocfg2cmd: add win10 spice test
Thomas Lamprecht [Tue, 19 Nov 2019 15:10:29 +0000 (16:10 +0100)]
cfg2cmd: add win10 spice test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoclone: pre-create cloud-init disk for destination
Thomas Lamprecht [Tue, 19 Nov 2019 08:25:54 +0000 (09:25 +0100)]
clone: pre-create cloud-init disk for destination

While we may not want to copy the cloudinit disk/drive, we still need
to create+allocate the volume, else the next start complains about a
missing CI drive..

fixes commit 7d6c99f0a0026ce07fa0eb858db7b6b7756ae021.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoavoid cyclic reference
Wolfgang Bumiller [Tue, 19 Nov 2019 08:26:44 +0000 (09:26 +0100)]
avoid cyclic reference

this otherwise leaks memory

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoAdd 'type' to agent_fmt
Matt Dunwoodie [Mon, 18 Nov 2019 06:46:12 +0000 (17:46 +1100)]
Add 'type' to agent_fmt

This adds an extra field to agent_fmt that specifes the type of guest
agent connection to use. Currently there is no choice, and defaults to
virtio-serial. Since qemu-ga also runs over isa-serial, this allows OSes
such as NetBSD and OpenBSD, which do not have support for virtio-serial,
to run a qemu-ga.

This is an optional field, which leaves the default as virtio-serial. As
it doesn't change the default, it will require no change to older
configuration files.

Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
4 years agoapi/migration: fix autocomplete for targetstorage
Aaron Lauterer [Mon, 18 Nov 2019 14:23:18 +0000 (15:23 +0100)]
api/migration: fix autocomplete for targetstorage

Show storages configured for the target node and not for the current one
because they can be different.

Duplicated the `complete_storage` sub and extended it to extract the
targetnode from the parameters to pass it into the storage_check_enabled
function.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agobump version to 6.0-14
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:32 +0000 (11:28 +0100)]
bump version to 6.0-14

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agod/control: add (build-)depends on libpve-cluster-perl
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:31 +0000 (11:28 +0100)]
d/control: add (build-)depends on libpve-cluster-perl

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agorefactor migration IP retrieval
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:30 +0000 (11:28 +0100)]
refactor migration IP retrieval

since PVE::Cluster::get_local_migration_ip does not exist anymore. this
is basically an inlined version, since this is the only remaining caller
that we actually want to keep.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agouse PVE::RRD for RRD data
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:29 +0000 (11:28 +0100)]
use PVE::RRD for RRD data

refactored from PVE::Cluster. same code, same semantics, different file.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agouse PVE::SSHInfo
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:28 +0000 (11:28 +0100)]
use PVE::SSHInfo

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agouse PVE::DataCenterConfig
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:27 +0000 (11:28 +0100)]
use PVE::DataCenterConfig

to make sure that the corresponding cfs_read_file works() works.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: bump version dependency to ha-manager
Thomas Lamprecht [Thu, 14 Nov 2019 13:44:11 +0000 (14:44 +0100)]
d/control: bump version dependency to ha-manager

so that we have the new "ha-manager crm-command" available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoUse crm-command stop to allow shutdown with timeout and hard stop for HA
Fabian Ebner [Thu, 14 Nov 2019 11:23:56 +0000 (12:23 +0100)]
Use crm-command stop to allow shutdown with timeout and hard stop for HA

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agofix destroy_vm by using correct Config package
Dominik Csapak [Thu, 14 Nov 2019 08:49:26 +0000 (09:49 +0100)]
fix destroy_vm by using correct Config package

We are in the QemuServer package not in LXC, so use the correct
package for the Config, namely QemuConfig

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agofollowup: what vs. why comment
Thomas Lamprecht [Mon, 11 Nov 2019 17:05:20 +0000 (18:05 +0100)]
followup: what vs. why comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoqmreboot: clear reboot request if reboot fails
Oguz Bektas [Mon, 11 Nov 2019 16:29:23 +0000 (17:29 +0100)]
qmreboot: clear reboot request if reboot fails

the reboot request is only cleaned in the vm_start path, so if reboot
fails for some reason, the request still exists. this causes an
unintentional reboot when a shutdown/stop/hibernate is called.

to mitigate, we can just clear the reboot request in case of an error.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agofix #2457: ga: set-user-password: increase maxLength of password
Dominik Csapak [Mon, 11 Nov 2019 15:18:45 +0000 (16:18 +0100)]
fix #2457: ga: set-user-password: increase maxLength of password

SHA-512 crypted passwords are longer than 64 byte, and it also does
not make sense to limit passwords to such a short length.  Increase
to 1024, that should be enough for a while, but still limits maximal
password payload to avoid DOS or the like.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoapi/create: remove some empty lines and sort
Thomas Lamprecht [Fri, 8 Nov 2019 16:05:53 +0000 (17:05 +0100)]
api/create: remove some empty lines and sort

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodestroy_vm: allow to pass new config and lock instead
Thomas Lamprecht [Fri, 8 Nov 2019 16:03:28 +0000 (17:03 +0100)]
destroy_vm: allow to pass new config and lock instead

This brings qemu more in line with containers, and it's nicer to
allow passing the replacement config if we want to keep it, instead
of setting a "memory: 128" config.

Use that to lock it on removal before final deletion, and on legacy
tar archive restore, in between old VM destruction and new
restoration.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agorestore_tar_archive: cleanup
Thomas Lamprecht [Fri, 8 Nov 2019 14:43:14 +0000 (15:43 +0100)]
restore_tar_archive: cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodestroy_vm: refactor+cleanup and continue on unused disk removal errors
Thomas Lamprecht [Fri, 8 Nov 2019 14:35:32 +0000 (15:35 +0100)]
destroy_vm: refactor+cleanup and continue on unused disk removal errors

it has some potential semantic change too, i.e., the Storage
vdisk_list call is not wrapped by eval anymore, put as
we did some (unguarded) storage things before that call I'd say that
that does not matters much..

We try to clean all unused disks too, even if one deletion fails

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofollowup: make comment a bit shorter/more concise
Thomas Lamprecht [Fri, 8 Nov 2019 14:02:50 +0000 (15:02 +0100)]
followup: make comment a bit shorter/more concise

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agorestore_tar_archive: Add skiplock to destroy_vm
Dominic Jäger [Thu, 7 Nov 2019 12:00:57 +0000 (13:00 +0100)]
restore_tar_archive: Add skiplock to destroy_vm

When calling qmrestore a config file is created and locked with a lock
property. The following destroy_vm has been impossible as skiplock has not
been set.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
4 years agod/control: add build-dependency on pkg-config
Fabian Grünbichler [Wed, 6 Nov 2019 12:36:58 +0000 (13:36 +0100)]
d/control: add build-dependency on pkg-config

needed to find libjson-c-dev headers for qmeventd

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: add build-dependency on pve-edk2-firmware
Fabian Grünbichler [Wed, 6 Nov 2019 12:36:57 +0000 (13:36 +0100)]
d/control: add build-dependency on pve-edk2-firmware

needed for config2command tests

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: add build-dependency on pve-qemu-kvm
Fabian Grünbichler [Wed, 6 Nov 2019 12:36:56 +0000 (13:36 +0100)]
d/control: add build-dependency on pve-qemu-kvm

instead of qemu-utils, since we actually depend on files from our qemu
package for some tests.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agotest: mock PVE::Storage for all tests
Fabian Grünbichler [Wed, 6 Nov 2019 12:36:55 +0000 (13:36 +0100)]
test: mock PVE::Storage for all tests

since the prepare step also attempts to read /etc/pve/storage.cfg

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agotest: mock PVE::ReplicationConfig->new
Fabian Grünbichler [Wed, 6 Nov 2019 12:36:54 +0000 (13:36 +0100)]
test: mock PVE::ReplicationConfig->new

to allow tests to finish without running, functional pmxcfs instance.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomove 'use UUID' statement to correct file
Fabian Grünbichler [Wed, 6 Nov 2019 12:36:53 +0000 (13:36 +0100)]
move 'use UUID' statement to correct file

and add the libuuid-perl package to build-depends as well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agobump version to 6.0-13
Thomas Lamprecht [Wed, 30 Oct 2019 06:40:44 +0000 (07:40 +0100)]
bump version to 6.0-13

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoQMPClient: add destructor
Wolfgang Bumiller [Wed, 30 Oct 2019 09:28:24 +0000 (10:28 +0100)]
QMPClient: add destructor

Explicitly close leftover connections in the destructor,
otherwise the IO::Multiplex instance can be leaked causing
the qmp connection to never be closed.

This could occur for instance when cancelling vzdump with
ctrl+c with extremely unlucky timing...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agofollowup: nit-pick code cleanup
Thomas Lamprecht [Tue, 29 Oct 2019 18:10:20 +0000 (19:10 +0100)]
followup: nit-pick code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoqm importdisk: tell user to what VM disk we actually imported
Thomas Lamprecht [Tue, 29 Oct 2019 18:09:07 +0000 (19:09 +0100)]
qm importdisk: tell user to what VM disk we actually imported

as else one has no idea what the imported disk is, especially if
multiple unused disks are already present..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocleanup do_import, s/optional/params/ and move skiplock into params
Thomas Lamprecht [Tue, 29 Oct 2019 18:04:01 +0000 (19:04 +0100)]
cleanup do_import, s/optional/params/ and move skiplock into params

mixed with indentation changes a whole lot of other changes which
should normally not mixed to much together, but this is all a bit
tangled and I'm not sure if splitting it into two or three parts
would help anybody.. just use "-w" (ignore whitespace changes) when
looking at the diff..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoImport OVF: Lock config with "lock" property
Dominic Jäger [Mon, 28 Oct 2019 11:47:34 +0000 (12:47 +0100)]
Import OVF: Lock config with "lock" property

Previously a VMID conflict was possible when creating a VM on another node
between locking the config with lock_config_full and writing to it for the
first time with write_config.

Using create_and_lock_config eliminates this possibility. This means that now
the "lock" property is set in the config instead of using flock only.

$param was empty when it was assigned the three values "name", "memory" and
"cores" before being assigned to $conf later on. Assigning those values
directly to $conf avoids confusion about what the two variables contain.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
4 years agoAdd skiplock to do_import
Dominic Jäger [Mon, 28 Oct 2019 11:47:33 +0000 (12:47 +0100)]
Add skiplock to do_import

Functions like qm importovf can now set the "lock" property in a config file
before calling do_import.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
4 years agoreplace remaining vm_destroy call-sites with destroy_vm
Dominic Jäger [Mon, 28 Oct 2019 11:47:32 +0000 (12:47 +0100)]
replace remaining vm_destroy call-sites with destroy_vm

This function has been used in one place only into which we inlined its
functionality. Removing it avoids confusion between vm_destroy and vm_destroy.

The whole $importfn is executed in a lock_config_full.
As a consequence, for the inlined code:
1. lock_config is redundant
2. it is not possible that the VM has been started (check_running) in the
    meanwhile
Additionally, it is not possible that the "lock" property has been written into
the VM's config file (check_lock) in the meanwhile

Add warning after eval so that it does not go unnoticed if it ever comes into
action.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
4 years agorefactor hugepages_size conf
Thomas Lamprecht [Tue, 29 Oct 2019 16:58:53 +0000 (17:58 +0100)]
refactor hugepages_size conf

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agorefactor hugepages_size
Thomas Lamprecht [Tue, 29 Oct 2019 16:49:37 +0000 (17:49 +0100)]
refactor hugepages_size

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agohugepages: fix memory size checking
Stefan Reiter [Mon, 28 Oct 2019 13:30:41 +0000 (14:30 +0100)]
hugepages: fix memory size checking

The codepath for "any" hugepages did not check if memory size was even,
leading to the code below trying to allocate half a hugepage (e.g. VM
with 2049MiB RAM would lead to 1024.5 2kB hugepages).

Also improve error message for systems with only 1GB hugepages enabled.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agod/control: bump version dependency to pve-common
Thomas Lamprecht [Tue, 29 Oct 2019 15:06:52 +0000 (16:06 +0100)]
d/control: bump version dependency to pve-common

ensures we have the new get_host_arch method replacement in common
available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoUse get_host_arch from PVE::Tools
Stefan Reiter [Mon, 28 Oct 2019 11:59:15 +0000 (12:59 +0100)]
Use get_host_arch from PVE::Tools

...now that it no longer does LXC-specific stuff. Removes a FIXME.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years ago[no-change] sort and group module use
Thomas Lamprecht [Tue, 29 Oct 2019 14:59:10 +0000 (15:59 +0100)]
[no-change] sort and group module use

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoruns_at_least_qemu_version: propagate QMP errors
Thomas Lamprecht [Tue, 29 Oct 2019 14:58:42 +0000 (15:58 +0100)]
runs_at_least_qemu_version: propagate QMP errors

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix typo in migration cleanup error message
Fabian Ebner [Mon, 28 Oct 2019 09:57:39 +0000 (10:57 +0100)]
fix typo in migration cleanup error message

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2434: extend machine regex
Dominik Csapak [Fri, 25 Oct 2019 12:36:06 +0000 (14:36 +0200)]
fix #2434: extend machine regex

with qemu 4.0.1, there is now a machine type pc-q35-4.0.1 which does not fit
into our regex

this broke live migration of q35, as we give the machine type (incl version
info) to 'qm start' on the target node, which checks it against the
JSONSchema

to fix this, extend the regex to allow any number of version levels,
for q35, i440fx and virt (to be more future proof)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agodestroy_vm: remove VM config *after* unused disk removal
Dominic Jäger [Fri, 25 Oct 2019 09:24:01 +0000 (11:24 +0200)]
destroy_vm: remove VM config *after* unused disk removal

As mentioned on the mailing list [0] disks owned by the VM and unused
disks should be removed before the config file is removed.

[0] https://pve.proxmox.com/pipermail/pve-devel/2019-October/039593.html

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocleanup: no need to prefix module for call to module-local method
Thomas Lamprecht [Thu, 24 Oct 2019 08:49:19 +0000 (10:49 +0200)]
cleanup: no need to prefix module for call to module-local method

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoqmp_socket: remove unused "name" parameter
Thomas Lamprecht [Wed, 23 Oct 2019 14:10:04 +0000 (16:10 +0200)]
qmp_socket: remove unused "name" parameter

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agovmstatus: code cleanup: directly use load_config helper
Thomas Lamprecht [Wed, 23 Oct 2019 14:09:36 +0000 (16:09 +0200)]
vmstatus: code cleanup: directly use load_config helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoremove unused method "touch_config"
Thomas Lamprecht [Wed, 23 Oct 2019 13:41:59 +0000 (15:41 +0200)]
remove unused method "touch_config"

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoQMPClient is no executable
Thomas Lamprecht [Wed, 23 Oct 2019 13:41:36 +0000 (15:41 +0200)]
QMPClient is no executable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix reverting for non-existing configs
Dominik Csapak [Wed, 23 Oct 2019 09:39:53 +0000 (11:39 +0200)]
fix reverting for non-existing configs

reverting a nonexisting option did not work with the latest changes
in pve-guest-common, because we do not delete the pending option
in 'add_to_pending_delete' anymore

this had the effect that we had following in the config:
[pending]
option: pendingvalue
delete: option

which would do the deletion code and the pending add code
(e.g. delete the pending cloud init drive and creating it again)

to avoid that situation, we need to remove the option from the pending hash
in the 'delete loop'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agofollowup: code cleanup and some comments
Thomas Lamprecht [Wed, 23 Oct 2019 09:39:03 +0000 (11:39 +0200)]
followup: code cleanup and some comments

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2408, #2355, #2380: use scsi-hd backend for iSCSI as well
Stefan Reiter [Tue, 22 Oct 2019 15:25:48 +0000 (17:25 +0200)]
fix #2408, #2355, #2380: use scsi-hd backend for iSCSI as well

As mentioned in #2408, live-migrating a VM between storages that use
different scsi backends (scsi-hd, scsi-generic, scsi-block) breaks.

To fix, from QEMU 4.1 machine types onward (to not break current
behaviour any more), only use scsi-hd, as in recent versions, there is
almost no difference between the two anyway.

scsi-block (which potentially also breaks) requires a flag to be
manually set on the disk, so we can assume the user knows what they're
doing.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Suggested-by: Daniel Berteaud <daniel@firewall-services.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobackup: is IOThread comaptible: only check running VMs
Thomas Lamprecht [Wed, 23 Oct 2019 09:28:47 +0000 (11:28 +0200)]
backup: is IOThread comaptible: only check running VMs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd runs_at_least_qemu_version to check if we can backup IOThread disks
Thomas Lamprecht [Wed, 23 Oct 2019 08:39:16 +0000 (10:39 +0200)]
add runs_at_least_qemu_version to check if we can backup IOThread disks

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agointroduce version_cmp helper for qemu_machine_feature_enabled
Thomas Lamprecht [Wed, 23 Oct 2019 08:38:12 +0000 (10:38 +0200)]
introduce version_cmp helper for qemu_machine_feature_enabled

will be reused for a "running KVM/QEMU version is at least" helper in
a next patch

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years ago[no-change] sort and group module use
Thomas Lamprecht [Wed, 23 Oct 2019 08:36:46 +0000 (10:36 +0200)]
[no-change] sort and group module use

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoRevert "fix #1071: VMs with IOThread enabled disks can now be backed up"
Thomas Lamprecht [Wed, 23 Oct 2019 07:31:51 +0000 (09:31 +0200)]
Revert "fix #1071: VMs with IOThread enabled disks can now be backed up"

This reverts commit 6b4b369fe35eb43ac08cf5609b488088c537926d.

4 years agobump version to 6.0-12
Thomas Lamprecht [Tue, 22 Oct 2019 14:31:53 +0000 (16:31 +0200)]
bump version to 6.0-12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofixup: vmstate: pass volid not resolved path to vollist
Thomas Lamprecht [Tue, 22 Oct 2019 14:31:16 +0000 (16:31 +0200)]
fixup: vmstate: pass volid not resolved path to vollist

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-11
Thomas Lamprecht [Tue, 22 Oct 2019 10:50:23 +0000 (12:50 +0200)]
bump version to 6.0-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofollowup: iterate over pending changes sorted
Thomas Lamprecht [Tue, 22 Oct 2019 10:47:16 +0000 (12:47 +0200)]
followup: iterate over pending changes sorted

for a more deterministic behavior, should not change things in
practice

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopending apply/hotplug: don't hard code force to true
Oguz Bektas [Tue, 22 Oct 2019 10:34:27 +0000 (12:34 +0200)]
pending apply/hotplug: don't hard code force to true

Each pending options has a hash value which has the 'force'
information encoded as entry. But, this can be { force => 1 } or
{ force => 0 }, so we actually need to check the value and not just
set force to the hash directly, as else we have force always truthy..

fixes a bug where 'detach' caused disks to be destroyed immediately,
because $force parameter was always true since hash is true.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #1071: VMs with IOThread enabled disks can now be backed up
Thomas Lamprecht [Mon, 21 Oct 2019 15:28:42 +0000 (17:28 +0200)]
fix #1071: VMs with IOThread enabled disks can now be backed up

Thanks to Dietmars patch[0] those VMs can now be backed up
successfully, so remove this aborting check.

[0]: https://git.proxmox.com/?p=pve-qemu.git;a=commit;h=69cb18950a705b54f438f4659b603b3f52901c2f

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-By: Dominik Csapak <d.csapak@proxmox.com>
4 years agofixup: VM statefile: pass volid not resolved path to vollist
Thomas Lamprecht [Tue, 22 Oct 2019 09:52:28 +0000 (11:52 +0200)]
fixup: VM statefile: pass volid not resolved path to vollist

We cannot activate a path, only volume IDs with activate_volumes
(duh)

fixes commit 5c1d42b7f825fa124ff3701b32f9ecc011bece95

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoactually bump version to 6.0-10
Thomas Lamprecht [Fri, 18 Oct 2019 20:04:57 +0000 (22:04 +0200)]
actually bump version to 6.0-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-10
Thomas Lamprecht [Fri, 18 Oct 2019 19:58:19 +0000 (21:58 +0200)]
bump version to 6.0-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocloudinit: fix vm start hanging with disk on ZFS
Mira Limbeck [Fri, 27 Sep 2019 13:13:30 +0000 (15:13 +0200)]
cloudinit: fix vm start hanging with disk on ZFS

With the changes to pve-storage in commit 56362cf the startup hangs for
5 minutes on ZFS if the cloudinit disk does not exist. Instead of
calling activate_volume followed by file_size_info we now call
volume_size_info. This should work reliably on all storages that support
cloudinit disks.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>