]> git.proxmox.com Git - qemu-server.git/log
qemu-server.git
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>
4 years agofix #2344: ignore cloudinit in replication check
Mira Limbeck [Fri, 27 Sep 2019 14:22:01 +0000 (16:22 +0200)]
fix #2344: ignore cloudinit in replication check

When adding a cloudinit disk it does not contain media=cdrom until it is
actually created. This means the check in check_replication fails to
detect cloudinit and it is recognized as normal disk. Then parse_volname
fails because it does not match the vm-$vmid-XYZ format. To fix this we
now check explicitly if the volname matches cloudinit and if so, return
early.

Additionally 2 small cleanups replacing cloudinit regexes with the
same check for volname matches cloudinit.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agofix #1291: add option purge for vm_destroy api call
Christian Ebner [Tue, 15 Oct 2019 11:00:25 +0000 (13:00 +0200)]
fix #1291: add option purge for vm_destroy api call

When destroying a VM, we intentionally did not remove all related
configs such as backup or replication jobs.
The intention of this flag is to allow the removal of references to
the VM being removed from such configs on destroy.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofixup: renamed conf_table_with_pending to config_with_pending_array
Thomas Lamprecht [Fri, 18 Oct 2019 19:00:27 +0000 (21:00 +0200)]
fixup: renamed conf_table_with_pending to config_with_pending_array

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapi: use guesthelper method for vm_pending path
Oguz Bektas [Mon, 14 Oct 2019 08:28:40 +0000 (10:28 +0200)]
api: use guesthelper method for vm_pending path

we can use the shared conf_table_with_pending guesthelper to produce the
config table with the extra delete and pending columns.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agocli: use guesthelper for pending
Oguz Bektas [Mon, 14 Oct 2019 08:28:39 +0000 (10:28 +0200)]
cli: use guesthelper for pending

use the shared format_pending method from guesthelpers

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agouse new config helpers from guest-common for pending changes
Oguz Bektas [Mon, 14 Oct 2019 08:28:38 +0000 (10:28 +0200)]
use new config helpers from guest-common for pending changes

most of the pending changes related code has been moved into
AbstractConfig, so we have to call them as class methods from QemuConfig instead.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoapi: use shared methods in config GET
Oguz Bektas [Mon, 14 Oct 2019 08:28:37 +0000 (10:28 +0200)]
api: use shared methods in config GET

in config GET call, we can now use the new shared methods from
guest-common, namely load_current_config and load_snapshot_config.

the correct method is called depending on the parameters 'current' or
'snapshot'

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agofixup: QemuConfig->write_config doesn't takes the raw config
Thomas Lamprecht [Fri, 18 Oct 2019 09:44:14 +0000 (11:44 +0200)]
fixup: QemuConfig->write_config doesn't takes the raw config

Thanks to Fabian for the quick notice

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agouse print_snapshot_tree guest helper for qm listsnapshot
Oguz Bektas [Wed, 2 Oct 2019 09:40:02 +0000 (11:40 +0200)]
use print_snapshot_tree guest helper for qm listsnapshot

moved code to GuestHelpers for feature parity with pct

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agod/control: bump version dependency to libpve-guest-common-perl
Thomas Lamprecht [Fri, 18 Oct 2019 09:29:50 +0000 (11:29 +0200)]
d/control: bump version dependency to libpve-guest-common-perl

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoQemuServer: sort and group used perl modules
Thomas Lamprecht [Fri, 18 Oct 2019 09:24:21 +0000 (11:24 +0200)]
QemuServer: sort and group used perl modules

group by:
* external
* pve, other package
* pve, same package

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodestroy_vm: use write_config from our Config module to set an "empty" config
Thomas Lamprecht [Fri, 18 Oct 2019 09:21:58 +0000 (11:21 +0200)]
destroy_vm: use write_config from our Config module to set an "empty" config

brings us more in line with what we do in pve-container, also it's
good to not use file_set_contents directly if we have all those nice
wrapper interface methods to do things in a safe and guaranteed way.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofollowup: use new base config provided destroy_config method
Thomas Lamprecht [Fri, 18 Oct 2019 09:12:39 +0000 (11:12 +0200)]
followup: use new base config provided destroy_config method

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoFix #2412: Missing VMs in pools
Dominic Jäger [Tue, 15 Oct 2019 10:17:41 +0000 (12:17 +0200)]
Fix #2412: Missing VMs in pools

Between calling vm_destroy and removing the ID from user.cfg (remove_vm_access)
creating a new VM with this ID was possible. VMs could go missing from pools as
a consequence.

Adding a lock solves this for clones from the same node. Additionally,
unlinking must happen at the very end of the deletion process to avoid that
other nodes use the ID in the meanwhile.

Co-developed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
4 years agoFix #2171: vm_start: volid based statefiles were not activated
Thomas Lamprecht [Thu, 17 Oct 2019 17:13:01 +0000 (19:13 +0200)]
Fix #2171: vm_start: volid based statefiles were not activated

So, while we could just make this a special case before the
config_to_command call and set the $conf->{vmstate} to the statefile
for the case were it's a valid volumeid, the special case handling
get's much easier when we do this outside of that method.

So it's basically a trade-off, and after looking far to long at all
nice revisions Alwin made for me and Fabians request, and even trying
out different approaches, it was never perfect.

But having slight code duplication over the movement mess I proposed
(as I did not had the full picture then, sorry Alwin) felt like the
slightly nicer trade off, as all worked I just use this one now, it
has very clear semantics, easy to understand and that now three lines
are duplicated is IMO irrelevant.

Co-developed-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocfg2cmd: push vmstate to volid list to ensure it gets also deactivated
Thomas Lamprecht [Thu, 17 Oct 2019 17:10:43 +0000 (19:10 +0200)]
cfg2cmd: push vmstate to volid list to ensure it gets also deactivated

the volume id list is only used to activate before real start and
deactivate later, so use it for the vmstate file too.

This not only makes config_to_command have less side effects, it also
ensures that the vmstate is deactivated again

Co-developed-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2395: refactor qemu_img_convert to accept files as source
Dominik Csapak [Thu, 17 Oct 2019 11:32:34 +0000 (13:32 +0200)]
fix #2395: refactor qemu_img_convert to accept files as source

and use it also for efidisk creation and importdisk
this way we correctly handle zfs-over-iscsi options for those cases

also write tests for it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoadd tests for qemu_img_convert
Dominik Csapak [Thu, 17 Oct 2019 11:32:33 +0000 (13:32 +0200)]
add tests for qemu_img_convert

Add tests for the qemu_img_convert parameters to the resulting
'qemu-img convert' call

we mock the 'run_command' and extract the 'cmd' parameter to
compare with what we expect

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agovm_start: don't reuse migrate_port variable for storage migration
Thomas Lamprecht [Mon, 14 Oct 2019 11:49:06 +0000 (13:49 +0200)]
vm_start: don't reuse migrate_port variable for storage migration

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoconfig_to_command: remove unused variable
Thomas Lamprecht [Mon, 14 Oct 2019 11:47:47 +0000 (13:47 +0200)]
config_to_command: remove unused variable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2402: allow 1GB hugepages if 2MB is unavailable
Stefan Reiter [Thu, 10 Oct 2019 10:18:41 +0000 (12:18 +0200)]
fix #2402: allow 1GB hugepages if 2MB is unavailable

As reported in bug #2402, a system started with "default_hugepagesz=1G
hugepagesz=1G" does not have a /sys/kernel/mm/hugepages/hugepages-2048kB
directory.

To fix, ignore the missing directory in hugepages_mount (since it might
not be needed anyway), and correctly check if the requested hugepage
size is available in hugepages_size instead.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agotest cfg2cmd: add spice enhancement test
Thomas Lamprecht [Wed, 9 Oct 2019 14:50:37 +0000 (16:50 +0200)]
test cfg2cmd: add spice enhancement test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotest: cfg2cmd: do NOT sort expected/actual commands
Thomas Lamprecht [Wed, 9 Oct 2019 06:08:06 +0000 (08:08 +0200)]
test: cfg2cmd: do NOT sort expected/actual commands

In general it matters where a command line options is positioned
inside a QEMU command, so we want to actually also check the order in
the cfg2cmd test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocfg2cmd: sort PCI bridges when adding them for stabillity
Thomas Lamprecht [Wed, 9 Oct 2019 05:51:08 +0000 (07:51 +0200)]
cfg2cmd: sort PCI bridges when adding them for stabillity

In general it matters where a command line options is positioned
inside a QEMU command, so we want to actually also check the order in
the cfg2cmd test, to do so we need to avoid false positives like this
added.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocfg2cmd: fix serial-bus for spice foldersharing
Aaron Lauterer [Tue, 8 Oct 2019 15:56:15 +0000 (17:56 +0200)]
cfg2cmd: fix serial-bus for spice foldersharing

Thanks to Gilberto Nunes for finding a bug where the VM would not start
with foldersharing enabled and the qemu agent option disabled [0].

The cause was that the device org.spice-space.webdav.0 would not find a
virtio-serial-bus in this situation.

Since we always create a virtio-serial-bus for the spice vdagent it
seems sensible to use that also for the foldersharing device by moving
it in front of the other spice devices.

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

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agocfg2cmd: fix descriptions of cfg2cmd test cases
Stefan Reiter [Mon, 30 Sep 2019 10:58:55 +0000 (12:58 +0200)]
cfg2cmd: fix descriptions of cfg2cmd test cases

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agoqemu 4.0 : add Cascadelake-Server && KnightsMill cpu models
Alexandre Derumier [Mon, 30 Sep 2019 09:43:36 +0000 (11:43 +0200)]
qemu 4.0 : add Cascadelake-Server && KnightsMill cpu models

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
4 years agofix #2217: don't copy cloudinit disk on clone
Mira Limbeck [Wed, 25 Sep 2019 16:12:17 +0000 (18:12 +0200)]
fix #2217: don't copy cloudinit disk on clone

This removes the cloudinit disk from the list of drives to clone. As the
cloudinit disk is recreated on every VM start, it's not necessary to
clone it.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agobump version to 6.0-9
Thomas Lamprecht [Thu, 26 Sep 2019 09:28:20 +0000 (11:28 +0200)]
bump version to 6.0-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocfg2cmd: support USB 3 SPICE ports with 4.0 machine feature
Thomas Lamprecht [Thu, 26 Sep 2019 08:54:05 +0000 (10:54 +0200)]
cfg2cmd: support USB 3 SPICE ports with 4.0 machine feature

The reason for why we did not do this in the first place was the fact
that the "usb3" flag could be set in older qemu-server versions, we
just ignored it but not filtered it out of the config..

That means there can be VMs out there which would now become a
different HW layout, and issue for migration and live-snapshot
restore.

But, actually, while the "usb3" property could be set it allowed to
start the VM in only if an additional USB devices was added to the VM
with USB2, or the VM uses "q35" based machine - as else no "ehci" was
available, and thus the "ignored" USB3 - SPICE could not get attached
anywhere -> QEMU chickened out.

And if a user had a configuration where this could started we have
still a bit luck, live-migration was not possible as the "can't
migrate VM which uses local devices:" check still hit, as in
qemu-server older than 6.0-8 we explicitly checked for "spice" when
seeing what usb device were not local, so a "spice,usb3=X" was always
(luckily) wrongly detected as local device -> migration was blocked.

So we only have one case left: restoring a live-snapshot. Here sadly
there seems no way out, it was possible to do with a "spice,usb3=1"
usb device, and thus all Snapshots taken on such VMs after they had a
clean restart on PVE 6 (to have a machine version >= 4.0) are broken
- but can be easily fixed by removing the "usb3=1" from the
problematic snapshot config.
As restoring a snapshot can be repeated more than once even on
failure without rendering the snapshot or VM permanently unusable,
this should be a reasonable compromise.

I strongly believe that the chance is so small that no one is
affected in practice and the property description mentioned that it
was not supported. If anybody is affected on snapshot restore we can
help them on a case-per-case basis.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-8
Thomas Lamprecht [Wed, 25 Sep 2019 15:07:08 +0000 (17:07 +0200)]
bump version to 6.0-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotree-wide trailing whitespace cleanup
Aaron Lauterer [Tue, 17 Sep 2019 14:47:25 +0000 (16:47 +0200)]
tree-wide trailing whitespace cleanup

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agofix #2382: delete cloudinit disk before restoring
Mira Limbeck [Wed, 25 Sep 2019 13:30:12 +0000 (15:30 +0200)]
fix #2382: delete cloudinit disk before restoring

The fix introduced in commit bf4a933 did not work as intended. We're
iterating over the $oldconf, not over $virtdev_hash. This means
$drive->{is_cloudinit} is always undefined. Instead use the $exclude_cloudinit
parameter from drive_is_cdrom().

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agomake clean: also cleanup source tarball
Thomas Lamprecht [Wed, 25 Sep 2019 12:59:03 +0000 (14:59 +0200)]
make clean: also cleanup source tarball

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agod/control: update dh version dependency and standard version
Thomas Lamprecht [Wed, 25 Sep 2019 12:58:05 +0000 (14:58 +0200)]
d/control: update dh version dependency and standard version

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobuildsys: add dsc target
Thomas Lamprecht [Wed, 25 Sep 2019 12:50:45 +0000 (14:50 +0200)]
buildsys: add dsc target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobuildsys: use BUILDDIR variable
Thomas Lamprecht [Wed, 25 Sep 2019 12:47:26 +0000 (14:47 +0200)]
buildsys: use BUILDDIR variable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobuildsys: remove unused or duplicate directories
Thomas Lamprecht [Tue, 24 Sep 2019 17:04:12 +0000 (19:04 +0200)]
buildsys: remove unused or duplicate directories

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoremove pcitest, now irrelevant
Thomas Lamprecht [Tue, 24 Sep 2019 16:14:14 +0000 (18:14 +0200)]
remove pcitest, now irrelevant

PCI pass through was greatly advanced since this got changed and is
all in QemuServer.

If anybody needs it, it's in git history anyway..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agomove VM network (hook) scripts to own directory
Thomas Lamprecht [Tue, 24 Sep 2019 16:12:25 +0000 (18:12 +0200)]
move VM network (hook) scripts to own directory

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agomove qemu-configs to own directory
Thomas Lamprecht [Tue, 24 Sep 2019 16:11:22 +0000 (18:11 +0200)]
move qemu-configs to own directory

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agomove qmeventd to own directory
Thomas Lamprecht [Tue, 24 Sep 2019 16:08:48 +0000 (18:08 +0200)]
move qmeventd to own directory

It's really not nice if such many files, source code, meta-files, …
linger around in the top level directory..

Also, cleanup the build a bit, i.e., use LDFLAGS as dpkg-buildpackage
can set some LDFLAGS so it'd be nice if both CFLAFGS and LDFLAGS have
the same (related) ones.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobuildsys: use $(MAKE) instead of make
Thomas Lamprecht [Tue, 24 Sep 2019 16:06:16 +0000 (18:06 +0200)]
buildsys: use $(MAKE) instead of make

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobuildsys: omit manual manpage gzip, done by debhelpers
Thomas Lamprecht [Tue, 24 Sep 2019 16:03:46 +0000 (18:03 +0200)]
buildsys: omit manual manpage gzip, done by debhelpers

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofollowup: reorder error so that $volid is last (potential long)
Thomas Lamprecht [Mon, 23 Sep 2019 16:26:15 +0000 (18:26 +0200)]
followup: reorder error so that $volid is last (potential long)

and add "current" as keyword, further remove the parenthesis for the
post-if, to adapt to Proxmox general perl code style

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd check to resize disk if current size could not be determined
Tim Marx [Thu, 12 Sep 2019 10:56:18 +0000 (12:56 +0200)]
add check to resize disk if current size could not be determined

This check ensures that disks aren't unintentionally shrunken, if the
size is zero due to an underlying problem.

4 years agofollowup: add newline in warn to avoid extra perl-internal info
Thomas Lamprecht [Mon, 23 Sep 2019 11:15:30 +0000 (13:15 +0200)]
followup: add newline in warn to avoid extra perl-internal info

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoImprove handling and description of migrate with --online
Fabian Ebner [Mon, 23 Sep 2019 07:56:01 +0000 (09:56 +0200)]
Improve handling and description of migrate with --online

Thanks to Stefan and Thomas for the suggestions.

Changes from v1:
* update parameter description
* warn instead of die

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoapi: config deletion: avoid regex on undefined values
Thomas Lamprecht [Mon, 23 Sep 2019 10:53:04 +0000 (12:53 +0200)]
api: config deletion: avoid regex on undefined values

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapi: deletion: check also pending values for serial/usb
Dominik Csapak [Mon, 23 Sep 2019 08:50:21 +0000 (10:50 +0200)]
api: deletion: check also pending values for serial/usb

otherwise a user with only VM.Config.HWType cannot
delete a 'pending' usbX: spice or serial: socket option

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agofollowup: fix usb3 description, SPICE is OK now
Thomas Lamprecht [Mon, 23 Sep 2019 08:25:01 +0000 (10:25 +0200)]
followup: fix usb3 description, SPICE is OK now

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agousb: Fix local resource check of Spice USB devices
Aaron Lauterer [Wed, 11 Sep 2019 12:43:33 +0000 (14:43 +0200)]
usb: Fix local resource check of Spice USB devices

The check relied on the fact that in a regular use case a usb device of
type spice would not have any other settings like `usb3=1`. An exact
match worked fine for this.

This patch changes the behaviour and makes it possible to migrate VMs
with Spice USB devices that have additional usb options set.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agocfg2cmd: mock SPICE/VNC port allocation methods
Thomas Lamprecht [Sat, 21 Sep 2019 11:41:06 +0000 (13:41 +0200)]
cfg2cmd: mock SPICE/VNC port allocation methods

to make them independent of environment, else other running VMs or
quickly sequential test runs may result in false negative test
results, as the port differed.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocfg2cmd: add config test for SPICE with USB3
Thomas Lamprecht [Sat, 21 Sep 2019 11:35:01 +0000 (13:35 +0200)]
cfg2cmd: add config test for SPICE with USB3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agousb: Add USB3 capabilities to Spice USB devices
Aaron Lauterer [Wed, 11 Sep 2019 12:43:32 +0000 (14:43 +0200)]
usb: Add USB3 capabilities to Spice USB devices

To not change current behaviour and thus breaking live migration USB3
for a Spice USB device requires Qemu v4.1.

The old behavior was that even though technically it was possible to
the set `usb3=1` setting, it was ignored. The bus was hardcoded to
ehci. If another USB2 device was added or the machine type was set to
Q35 an ehci controller was present and the VM was able to boot.

With this patch the behaviour is changing and the bus is set to xhci if
USB3 is set for the Spice USB device and the VM is running under Qemu
v4.1.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>