5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-03-10 12:58:25 +03:00

2161 Commits

Author SHA1 Message Date
Thomas Lamprecht
5172770df7 followup: use new base config provided destroy_config method
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-18 11:20:52 +02:00
Dominic Jäger
3e8e214d73 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>
2019-10-17 19:23:49 +02:00
Thomas Lamprecht
5c1d42b7f8 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>
2019-10-17 19:20:32 +02:00
Thomas Lamprecht
8f899d734e 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>
2019-10-17 19:10:52 +02:00
Dominik Csapak
af1f1ec038 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>
2019-10-17 13:57:21 +02:00
Dominik Csapak
458a2b2640 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>
2019-10-17 13:57:21 +02:00
Thomas Lamprecht
a447e92c09 vm_start: don't reuse migrate_port variable for storage migration
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-14 13:49:30 +02:00
Thomas Lamprecht
9066fd2635 config_to_command: remove unused variable
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-14 13:49:30 +02:00
Stefan Reiter
3d8d2e8dad 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>
2019-10-10 15:32:46 +02:00
Thomas Lamprecht
503be1f71e test cfg2cmd: add spice enhancement test
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-09 16:51:03 +02:00
Thomas Lamprecht
69f4bd3434 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>
2019-10-09 08:08:24 +02:00
Thomas Lamprecht
311e92935a 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>
2019-10-09 07:51:13 +02:00
Aaron Lauterer
4d316a63c7 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>
2019-10-08 18:15:00 +02:00
Stefan Reiter
03b8d4a72d cfg2cmd: fix descriptions of cfg2cmd test cases
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-10-02 08:35:27 +02:00
Alexandre Derumier
faf80f2566 qemu 4.0 : add Cascadelake-Server && KnightsMill cpu models
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2019-09-30 16:44:51 +02:00
Mira Limbeck
7d6c99f0a0 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>
2019-09-26 18:13:26 +02:00
Thomas Lamprecht
f1619a3b42 bump version to 6.0-9
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-26 12:02:14 +02:00
Thomas Lamprecht
733234be04 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>
2019-09-26 11:54:53 +02:00
Thomas Lamprecht
fce8336a00 bump version to 6.0-8
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-25 17:07:08 +02:00
Aaron Lauterer
a022e3fdab tree-wide trailing whitespace cleanup
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-09-25 16:55:53 +02:00
Mira Limbeck
a82348eb34 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>
2019-09-25 16:53:29 +02:00
Thomas Lamprecht
2135fcdb36 make clean: also cleanup source tarball
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-25 14:59:03 +02:00
Thomas Lamprecht
7e7ec468a0 d/control: update dh version dependency and standard version
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-25 14:58:05 +02:00
Thomas Lamprecht
efd152d787 buildsys: add dsc target
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-25 14:51:50 +02:00
Thomas Lamprecht
7263229629 buildsys: use BUILDDIR variable
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-25 14:47:26 +02:00
Thomas Lamprecht
4478c2ae2f buildsys: remove unused or duplicate directories
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-24 19:06:07 +02:00
Thomas Lamprecht
60f4356732 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>
2019-09-24 18:59:35 +02:00
Thomas Lamprecht
b53173fca5 move VM network (hook) scripts to own directory
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-24 18:59:35 +02:00
Thomas Lamprecht
30680751dc move qemu-configs to own directory
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-24 18:59:35 +02:00
Thomas Lamprecht
8752e5a3ec 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>
2019-09-24 18:57:54 +02:00
Thomas Lamprecht
64e7017e44 buildsys: use $(MAKE) instead of make
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-24 18:06:16 +02:00
Thomas Lamprecht
89e50385a8 buildsys: omit manual manpage gzip, done by debhelpers
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-24 18:03:46 +02:00
Thomas Lamprecht
ed94b2adaa 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>
2019-09-23 18:26:27 +02:00
Tim Marx
f8b829aaba 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.
2019-09-23 18:25:01 +02:00
Thomas Lamprecht
fda7291362 followup: add newline in warn to avoid extra perl-internal info
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 13:15:30 +02:00
Fabian Ebner
1373938627 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>
2019-09-23 13:12:08 +02:00
Thomas Lamprecht
f70a6ea97d api: config deletion: avoid regex on undefined values
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 12:53:04 +02:00
Dominik Csapak
4c1f3929ea 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>
2019-09-23 11:24:57 +02:00
Thomas Lamprecht
97ef535658 followup: fix usb3 description, SPICE is OK now
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-23 10:25:01 +02:00
Aaron Lauterer
a9ce7583cf 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>
2019-09-21 13:42:47 +02:00
Thomas Lamprecht
ff9e7dc1bb 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>
2019-09-21 13:41:09 +02:00
Thomas Lamprecht
bae64b0ec6 cfg2cmd: add config test for SPICE with USB3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-21 13:40:40 +02:00
Aaron Lauterer
ae36393d5a 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>
2019-09-21 13:22:17 +02:00
Aaron Lauterer
47717a90cf usb: Cleanup redundant if condition
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-09-21 13:17:40 +02:00
Dominik Csapak
165411f0c2 api: add reboot api call
this creates a reboot request file (inspired by pve-container)
and relies on the 'qm cleanup' call by the qmeventd to detect
and restart the vm afterwards

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-09-11 14:13:35 +02:00
Dominik Csapak
575d19dab5 refactor vm_stop locked code
we want to reuse most of the code in the locked context of vm_stop
for vm_reboot (since it really is just a vm_stop with a
create_reboot_request in there) so we factor that out into
_do_vm_stop
and note that it has to be called in a locked context

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-09-11 14:13:35 +02:00
Dominik Csapak
64457ed4aa qm: cleanup: detect and handle reboot trigger
if the reboot trigger file was set, start the vm again
also cleanup the reboot trigger on vm startup, to prevent
leftover files to trigger a reboot at the next shutdown

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-09-11 14:13:35 +02:00
Dominik Csapak
dae98db96e add create and remove reboot trigger subs
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-09-11 14:13:35 +02:00
Dominik Csapak
58f9db6ada api: add missing index child links
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-09-10 14:55:28 +02:00
Thomas Lamprecht
6cb7b041ce test: compare also with our qemu cfgs for pci addr conflicts
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-10 10:32:52 +02:00