5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-25 06:03:52 +03:00

968 Commits

Author SHA1 Message Date
Thomas Lamprecht
0b05530b56 followup: move hv_tlbflush under 3.1 machine feature guard
while it really should not pose an issue for live migrations lets be
on the safe side and also add this only with 3.1 or later machines

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-24 17:23:44 +02:00
Stefan Reiter
392dfbf51e fix #2083: Add hv_tlbflush, hv_ipi, hv_evmcs enlightenments
Kernels 4.18+ (4.17+ for evmcs) support new Hyper-V enlightenments for
Windows KVM guests. QEMU supports these since 3.0 and 3.1 respectively.
tlbflush and ipi improve performance on overcommitted systems, evmcs
improves nested virtualization.

It's not entirely clear to me if Win7 already supports these, but since
it doesn't cause any performance penalties (and it works fine without
crashing, which makes sense either way, because Hyper-V enlightenments
are opt-in by the guest OS), enabling it regardless should be fine.
(As opposed to adding a new if branch for win8+)

Feature explanations to the best of my understanding:

hv_tlbflush allows the guest OS to trigger tlb shootdowns via a
hypercall. This allows CPUs to be identified via their vpindex (which
makes hv_vpindex a prerequisite to hv_tlbflush, but that is already
handled in our code). In overcommited configurations, where multiple
vCPUs reside on one pCPU, this increases performance of guest tlb
flushes, by only flushing each pCPU once. It also allows multiple tlb
flushes with only one vmexit.

hv_ipi allows sending inter-processor interrupts via vpindex, once again
making it a prerequisite. Benefits are pretty much as with tlbflush.

hv_evmcs is a VM control structure in L1 guest memory, allowing an L1 guest
to modify L2 VMCS and entering L2 without having the L0 host perform an
expensive VMCS update on trapping the nested vmenter.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-06-24 17:22:35 +02:00
Stefan Reiter
0eb2169136 fix #2244: Allow timeout for guest-agent shutdown
The "guest-shutdown" guest agent call is blocking for some reason, so if
it fails (e.g. agent not installed on guest) only the default timeout of
10 minutes (see QMPClient.pm, sub cmd) would apply.

With this change, if (and only if) a timeout is specified via CLI/API,
it is used instead. In case it is not specified, behaviour stays the
same (default 10 min timeout).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-06-24 17:20:30 +02:00
Wolfgang Bumiller
4f8cfa190a wait for vm scopes to be gone
This should help with the rare case where stop mode backups
fail to restart due to the $vmid.scope not being completely
gone when we want to restart. This queries systemd via dbus,
and if the scope is still there, awaits a UnitRemoved signal
for the scope from dbus.

For now with a 5 second timeout... (given that the processes
are already gone and it's really just waiting for systemd to
wake up, this should be plenty...)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-19 10:11:38 +02:00
Thomas Lamprecht
5d004b0038 SMBIOS: followup: allow now 512 characters for full format string
to acutally allow to set the values requested by #2190 we need to
alter the limit a bit, as else the requested values cannot be save.

Just double it to 512, which should be really enough for this, else
go complain to your software vendor for needing such _hacks_ in the
first place..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-11 17:39:22 +02:00
Christian Ebner
1f30ac3a9f fix #2190: Base64 encode SMBIOS value strings in order to allow more characters
On some occasions e.g. license checking, the manufacturer string in the
SMBIOS settings edit has to allow characters such as whitespaces.
https://forum.proxmox.com/threads/proxmox-and-windows-rok-license-for-dell.53236/
In principle SMBIOS allows to pass any zero terminated string to the
corresponding fields in the structure type 1 (System Information).

By base64 encoding the values clashing of the config is avoided.

Relies on the corresponding patch to pve-manager to obtain base64 encoded values.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-06-11 13:04:34 +02:00
Thomas Lamprecht
5dcee818d2 followup: mention new md-clear flag also in description
that should really be autogenerated!

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-07 17:55:34 +02:00
Oguz Bektas
df503832ff add md-clear cpu flag
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-06-07 17:55:24 +02:00
Thomas Lamprecht
dc62a7fafc drop vnc x509 param, deprecated in 2.5 removed in 4.0
while we have 3.0.1 for now, 4.x will come sooner or later so do this
now already..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-06 09:52:44 +02:00
Thomas Lamprecht
90041ba890 drop references to un-maintained sheepdog plugin
we remove it from pve-storage as it's abandoned

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-04 17:43:11 +02:00
Thomas Lamprecht
8aa2ed7c85 refactor do_snapshots_with_qemu a bit cleaner
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-04 17:41:23 +02:00
Fabian Grünbichler
3e24733bdf vm_resume: correctly honor $nocheck
for both vm_mon_cmd calls. under certain circumstances, the following
sequence of events can otherwise fail when live-migrating under load:

S...source node
T...target node

0: migration is complete, handover from S to T starts
1: S: logically move VM config file from S to T via rename()
2: S: rename returns, config file is (visibly) moved on S
3: S: trigger resume on T via mtunnel
4a: T: call vm_resume while config file move is not yet visible on T
4b: T: call vm_resume while config file move is already visible on T

4a instead of 4b means vm_mon_cmd will die in check_running unless
vm_mon_cmd_nocheck is used.

under heavy pmxcfs load and a slow cluster/corosync network, there can
be a few seconds of delay between 1 and 2, with a subsequent race ending in 4a
instead of 4b.

this issue was reported to occur on bulk migrations.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-05-25 11:28:26 +02:00
Thomas Lamprecht
bf4a933e52 fixup: delete cloudinit disk before restoring
cloudinit is just completely broken...
Until we rewrite this to a sane designe (i.e., never backup, mirror,
... any CI disk anywhere - the state is in the config and gets
created on start and deleted on stop anyway) do this..

Co-developed-by: Mira Limbek <m.limbek@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-17 12:09:56 +02:00
Thomas Lamprecht
2b2923aefd QemuServer: code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-17 10:53:50 +02:00
Thomas Lamprecht
87056e1821 follouwp: set is_cloudinit in drive to avoid always rechecking
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-17 10:53:30 +02:00
Mira Limbeck
c4ab3c5584 map cloudinit disk to new vmid on restore
Resolves the issue of restoring a VM that has a cloudinit drive
configured to a new VMID. The VMID of the disk name gets now remapped
correctly and in the process the cloudinit disk is created with the same size
as in PVE/API2/Qemu.pm create_disks and in PVE/QemuServer/Cloudinit
commit_cloudinit_disk as the same constant is used.

This is done by matching any line starting with either 'ide', 'sata' or
'scsi' and then check if it is a cloudinit drive. As cloudinit drives
are attached as cdrom, only those 3 are possible. For the cloudinit
check we use 'parse_drive' followed by 'drive_is_cloudinit' so no custom
regex is necessary.

'--targetstorage' is also taken into account on restore now for
cloudinit disks. If a target storage is specified the format is either
kept if possible, or changed to the default of that storage.

This should fix #1807 completely. The restore error was already resolved
with commit 7e8ab2a, but the vmid of the disk might not have matched the new
one.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-05-16 16:29:02 +02:00
Thomas Lamprecht
a357092190 fixup: shorter/conciser comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-16 16:29:02 +02:00
Mira Limbeck
e1afab6e28 fix clone_disk with formats other than raw/qcow2
with commit 64d1a6a it's now possible to specify a format other than raw
or qcow2 when creating VMs. This can lead to an error when cloning the
VMs and a cloudinit disk with a different format is attached (e.g.
vmdk).

We use QEMU_FORMAT_RE in drive_is_cloudinit and according to the
QEMU_FORMAT_RE we support 7 different formats.

With this change we add any format other than 'raw' as '.<format>' to the
name and no longer die on any other format. Cloudinit disks with invalid
format are not cloned as the drive is recognized as cdrom, not cloudinit.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-05-16 16:27:07 +02:00
Tim Marx
ca6abacf6b migrate: log which local resource causes error
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-05-07 10:22:12 +00:00
Tim Marx
370b05e719 whitespace cleanup
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-05-07 10:22:12 +00:00
Christian Ebner
5294c110bb fix: #1075: Restore VM template to VM and try to convert to template.
The restore of a backup from a VM template will first restore the VM and then
convert the restored VM back into a template.
This automatically performes the steps of the current behaviour, where the user
has to manually convert the restored VM back to a template.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-04-24 17:35:32 +00:00
Thomas Lamprecht
f6409f6169 followup: remove unused variable and add spave between value and unit
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-02 14:33:10 +02:00
Stoiko Ivanov
7e303ef3e4 bwlimit: add parameter to QemuServer::clone_disk
and pass it to qemu_drive_mirror (used for online disks).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 11:01:35 +02:00
Stoiko Ivanov
d189e5901b bwlimit: add parameter for QemuMigrate::phase2
used for online local disks via qemu_drive_mirror

Add TODO comment for offline disks, as clone_disk calls `qemu-img
convert`, which does not have a bandwidth limit parameter.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 11:00:28 +02:00
Stoiko Ivanov
9fa05d31de bwlimit: add parameter to qemu_drive_mirror
used for online drive migrations, move_disk and clone calls.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 10:34:40 +02:00
Thomas Lamprecht
6dde5ea273 drive mirror: cleanup exception handling code a bit
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-03-30 09:36:30 +01:00
Thomas Lamprecht
3ff84d6fe6 remove registering 'pve-snapshot-name', now in common
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-03-21 12:56:39 +01:00
Thomas Lamprecht
11efdfa5a9 followup: which lock
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-03-21 12:53:17 +01:00
Dominik Csapak
e6ed61b4bd add lock to vm status
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-20 11:50:09 +01:00
Dominik Csapak
ccb2e2eaeb increase timeout when resuming suspended VM
when the state is on a slow storage, it can take a while to load it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-19 09:26:56 +01:00
Dominik Csapak
b0a9a38568 suspend: output some information about progress
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-19 09:26:56 +01:00
Dominik Csapak
48b4cdc210 add statestorage parameter to suspend API
this makes it possible to give a storage for state saving, if one
wants to use a different storage than for snapshots or does not
want to save this info into the config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-19 08:53:14 +01:00
Dominik Csapak
7ceade4cb3 resume suspended vm on start
if a vm has the 'suspended' lock, we resume with the saved state
and remove the lock, the saved vmstate and the saved runningmachine
after the vm started

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-19 08:53:14 +01:00
Dominik Csapak
159719e55b implement suspend to disk for running vms
the idea is to have the same logic as with snapshots, but without
the snapshotting of the disks, and after saving the vm state (incl memory),
we hard shut off the guest.

this way the disks will not be touched anymore by the guest

to prevent any alteration of the vm (incl migration, hw changes, etc) we
add a config lock 'suspend'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-19 08:53:14 +01:00
Stoiko Ivanov
399d96dbee config: NIC macaddr: enforce unicast MAC addresses
creating a VM with a NIC with multicast mac (see [1]) is possible, but setting
the interface's link up inside the guest fails (tested on Debian stable).
The issue was noted with LXC first (see [0,2]) and then tested with Qemu.

This patch uses the 'mac-addr' standard_option defined in PVE::JSONSchema to
ensure only unicast MAC addresses are used for netconfig.

[0] https://lists.linuxcontainers.org/pipermail/lxc-users/2010-August/000783.html
[1] https://en.wikipedia.org/wiki/MAC_address
[2] https://pve.proxmox.com/pipermail/pve-devel/2019-March/035996.html

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-03-14 09:21:24 +01:00
Dominik Csapak
7820eae438 fix #2131: get correct device when deleting iothreads
we map scsiX to virtioscsiX/scsihwX when we use virtio-scsi-single to add
and iothread so we have to map it back when we delete an iothread, else the
parsing fails with

'invalid drive key: virtioscsi0'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-14 08:25:48 +01:00
Dominik Csapak
92bdc3f0e3 fix #2120: use hosts initiator name with qemu-img
qemu-img uses the qemu default initiator name 'iqn.2008-11.org.linux-kvm'
since we use the one of the host (/etc/iscsi/initiatorname.iscsi) when
using it with a running vm, we want to using it also when moving a disk
with qemu-img

to do that we have give qemu-img the image in as a full option string

this fixes the issue that we could not move an zfs-over-iscsi disk
without allowing the default qemu initiator

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-07 15:59:56 +01:00
David Limbeck
cb702ebe0f cloud-init: allow custom network/user data files via snippets
Adds the 'cicustom' option to specify either or both network and user
options as property strings. Their parameters are files in a snippets
storage (e.g. local:snippets/network.yaml). If one or both are specified
they are used instead of their respective generated configuration.
This allows the use of completely custom configurations and is also a
possible solution for bug #2068 by specifying a custom user file that
contains package_upgrade: false.

Tested with Ubuntu 18.10 and cloud-init 18.4.7

Signed-off-by: David Limbeck <d.limbeck@proxmox.com>
2019-03-07 09:02:33 +01:00
Dominik Csapak
95d3be5879 fix indentation and trailing whitespace
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-28 10:02:23 +01:00
Dominik Csapak
79046fd12e fix #2114: set correct link status on hotplug
we also need to set the link status if the whole device changed,
otherwise a change of macaddress allows a network connection even
if link_down is set to 1

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-28 10:02:23 +01:00
Thomas Lamprecht
bd772c2e87 code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-26 08:30:13 +01:00
Thomas Lamprecht
4c5a6a2419 ivmshmem: comment deletion of shm on VM stop in code
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-26 08:30:13 +01:00
Thomas Lamprecht
e3c27a6afe ivmshmem: follouwp code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-26 08:30:10 +01:00
Dominik Csapak
6dbcb07367 add ivshmem device to config
with such a shared memory device, a vm can share data with other
vms or with the host via memory

one of the use cases is looking-glass[1] with pci-passthrough, which copies
the guest fb to the host and you get a high-speed, low-latency
display client for the vm

on vm stop we delete the file again

1: https://looking-glass.hostfission.com/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-26 08:01:12 +01:00
Christian Ebner
e741c51696 Fix 2097 allow to set and pass wwn parameter for ide, sata and scsi disks
This allows to set the wwn parameter for ide, sata and scsi disks in the VM
config and passes it to the qemu command on execution.

VirtIO Block does not supports this property, so exclude it from
there.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-26 07:55:04 +01:00
Thomas Lamprecht
f5c673cba7 fix #2043: vm start: always stop existing systemd scopes
commit 3c23aa808ccc946bad92d9bc63b6f833c61d0f52 tried to fix a issue
where after a stop mode backup a scope could still linger around, but
it actually removed the wrong check. If we want to remove a
lingering, not yet cleaned up, scope we need to check if said scope
exists not if a VM process is still running. While they are corelated
the scope will always get cleaned up _after_ it's processes are gone.

Should fix #2043, but as this is seemingly not that easy to fix one
for all I'll put the should as disclaimer here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-02-11 08:12:32 +01:00
Dominik Csapak
9e784b1154 add pre- start/stop hookscripts to VMs
this adds a new config option for it, and executes it on four
points in time:

'pre-start'
'post-start'
'pre-stop'
'post-stop'

on pre-start we abort if the script fails
and pre-stop will not be called if the vm crashes or if
the vm gets powered off from inside the guest

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-01 12:58:37 +01:00
Thomas Lamprecht
87d92707b6 followup code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-01-30 15:08:15 +01:00
Rhonda D'Vine
b14477e718 Fix #1924: add snapshot parameter
The qm CLI command offer the config and showcmd functions. Both of those
outputs may vary with respect to a given snapshot. This adds a switch
that shows the corresponding snapshot's config and command line.

The code needs a newer libpve-guest-common-perl, thus bumping the
dependency.

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
2019-01-30 14:56:43 +01:00
Dominik Csapak
bfc0bb8179 allow explicit set vga with gpu passthrough
this patch allows the user to explicitely set a virtual vga,
even when using the 'x-vga' flag, this is sometimes necessary,
as some users need the 'x-vga' flag on the pci device,
but still want to use a virtual vga

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-01-28 17:38:55 +01:00