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

1556 Commits

Author SHA1 Message Date
Stefan Reiter
3a040a0ead Make hv-tlbflush and hv-evmcs optional and merge flag list
Both flags were causing issues and have been made into optional flags to
be manually selected by the user if needed.

The supported flags have been merged into a single list for convenience.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-07-23 18:15:05 +02:00
Thomas Lamprecht
d5535a00c4 audio follouwp: pull out parsing into a conf_has_audio
now that we finally now what the ID from the audiodev is for let's
factor some format string parsing out making a eventual future multi
audio device support with differen backends quite easy to support
here - once QEMU itself supports that fully.[0][1]

[0]: https://pve.proxmox.com/pipermail/pve-devel/2019-July/038400.html
[1]: https://lists.nongnu.org/archive/html/qemu-devel/2019-07/msg03583.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 18:14:09 +02:00
Aaron Lauterer
1448547f44 audio dev: specify qemu audio backend
QEMU 4 adds the `-audiodev` parameter to explicitly specify the audio
backend. Setting it avoids occasional error messages when starting a
virtual machine with an audio device and qemu wants to connect it to the
physical audio device.

For now only SPICE is supported as it's also the biggest use case.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-07-22 09:51:03 +02:00
Dominik Csapak
c30e80aba9 remove unused variable
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-18 18:48:30 +02:00
Dominik Csapak
d30820d6c3 fix #2275: die on invalid sendkey
sendkey does not return anything if it is succesful and the error otherwise

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-18 18:48:30 +02:00
Thomas Lamprecht
b3703d39bd audio dev: follouwp code cleanup and error handling
die if we get some unknown value, which is either a bug (new dev type
added to enum but not here) or a user manual edit error, good to
ccatch both

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-18 09:09:01 +02:00
Thomas Lamprecht
194b65f188 audio dev: add note that this is useful for SPICE
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-18 09:08:40 +02:00
Aaron Lauterer
b2dd61a045 Add audio device to HW permissions
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-07-18 08:24:39 +02:00
Aaron Lauterer
d438e06028 Add PCI address for audio device
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-07-18 08:24:39 +02:00
Aaron Lauterer
2e7b59252c Add audio device support
Until now audio devices had to be added manually with the `args` option
in the VMs config file. This adds a new config option to define an audio
device. It is called `audio0` with the extra `0` to be prepared should
we ever implement support for more than one audio device.

Supported devices are:

* ich9-intel-hda: Intel HD Audio Controller, emulates ICH9
* intel-hda: Intel HD Audio Controller, emulates ICH6
* AC97: useful for older OSs like Win XP

If any of the `intel-hda`s is selected two additional devices will be
created: hda-micro and hda-duplex. The `*intel-hda` controllers need at
least one of them as they emulate microphones and speakers (hda-micro)
or line in and out devices (hda-duplex).

Having both is deemed best practice to avoid problems if some software
needs one of the other kind of output/input ports.

I also cleaned up some old, commented out, code regarding audio devices.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-07-18 08:24:39 +02:00
Dominik Csapak
7583d156fd use new pcie port hardware
with qemu 4.0 we can make use of the new pcie-root-ports with settings
for the width/speed which can resolve issues with some hardware combinations
when negioating link speed

so we add a new q35 cfg that we include with machine types >= 4.0
to preserve live migration of machines without passthrough but q35

for details about the link speeds see:

pcie: Enhanced link speed and width support
https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg02827.html

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-08 13:31:55 +02:00
Alwin Antreich
85f0511db3 Fix: rtcflags: ignore startdate 'now'
If 'now' is passed to the startdate option, the kvm start fails with
below failure.
 kvm: invalid datetime format
 valid formats: '2006-06-17T16:01:21' or '2006-06-17'

With this patch, 'now' is ignored and not passed to the rtcflags (-rtc).

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2019-07-04 11:29:26 +02:00
Thomas Lamprecht
32075a2cb8 check_local_storage_availability: only count each unavailable storage once
and some general cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-28 17:39:16 +02:00
Tim Marx
c272ba8db3 migrate: add size to volume attributes
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-06-28 15:22:33 +02:00
Tim Marx
f25852c27e migrate: handle storage not selected manually in storage config
e.g. local storage was considered not allowed for offline migration
even if it is available on all nodes, this should now be fixed as it
is now considered available on all nodes if a local storage isn't
restricted to a specific subset of the available nodes. The user is
responseable to make sure that the datacenter storage config reflects
the actual setup, so there is no additional check for local storages
which aren't available on all nodes if they are not explicitly marked
at datacenter level.

Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-06-28 15:22:33 +02:00
Mira Limbeck
8ebf1734e9 cloudinit: set iso-level in genisoimage call
This is required for Windows to recognize the ISO and as a result the cloudinit
config. This is the minimum to get any config working at all for windows.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-06-28 14:27:08 +02:00
Stefan Reiter
1688362d4e Fix guest agent shutdown without timeout
Regression from change allowing timeouts to be set, now shutting down
also works without timeouts again (previously qmp failed because of
the unknown "timeout" parameter passed to it).

We always delete the timeout value from the arguments, regardless of
truthiness. "delete" returns the deleted element, deleting a
non-existant hash entry returns undef, which is fine after this point:

"deleting non-existent elements returns the undefined value in their
corresponding positions."
- https://perldoc.perl.org/functions/delete.html

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-06-25 16:52:24 +02:00
Thomas Lamprecht
71a1e5680b add_hyperv_enlightenments: do not add hv_evmcs for now at all
as Windows VMs on hosts with AMD CPUs do not start at all with
that...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-25 14:32:06 +02:00
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
Tim Marx
71fc647ff9 add migration precondition api endpoint
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-06-15 11:13:14 +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
Mira Limbeck
1e1763e9c8 add qm command for cloudinit config dump
Adds the command 'qm cloudinit dump <vmid> <type>' where type is either
'user', 'network' or 'meta' as specified in the API.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-06-06 14:34:11 +02:00
Mira Limbeck
7370974930 add new API for dumping cloudinit config
Adds the path '{vmid}/cloudinit/dump' and requires the parameter 'type'
that's either 'user', 'network' or 'meta'. Returns the generated config as
string.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-06-06 14:34:11 +02:00
Mira Limbeck
e73ca4d0ce add function to dump cloudinit config
This adds a function to dump the generated cloudinit config. Only one
can be dumped at a time, either 'user', 'network' or 'meta'.

The logic to get user, network and metadata is copied from the other
path that also creates the ISO image to keep it simple and not
complicate the other code path further.

The hash generation for the metadata config is unified between nocloud
and configdrive2 formats. We need it a 3rd time with the new dump
functions so it makes sense to combine it and the metadata config
generation in a single function. The <format>_gen_metadata functions are
each used twice now.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-06-06 14:34:11 +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
736c92f6d1 api/qemu: start: add helper for root-only param extraction
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-06 09:43:49 +02:00
Thomas Lamprecht
a4262553de api/qemu: extra line cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-06 09:41:52 +02:00
Rhonda D'Vine
3e494a3ca7 Fix #1999: cli: listsnapshot: handle multiple roots and mark orphaned as root
This commit addresses the following things:

* There can be multiple independent snapshot tree roots, display them
  all
* If a snapshot defines a parent that doesn't exist, it is now
  considered a snapshot root

There is a potential issue (which was also before and also affects the
GUI): circular snapshot trees.  That plays into the second mentioned
issue above.  If you manage to have a snapshot that defines a
non-existing root in the config, and then create a snapshot with that
exact name as a child of that snapshot, it would create a circular
dependency.  This would have to get addressed in the GUI too.

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-05 19:22:30 +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
Tim Marx
c2ed338eff whitespace cleanup
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-05-27 13:59:08 +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
Mira Limbeck
7d761a016d introduce one global CLOUDINIT_DISK_SIZE constant
The variable is used instead of the literal value so we have one single
place to change the actual value of every use.

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
Thomas Lamprecht
5cda6c69e3 followup: fixup comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 16:33:46 +02:00
Mira Limbeck
9680b09d64 fix existing cloudinit volume not available for file_size_info
file_size_info can't find the file if it is not available, e.g.,
RBD storage with KRBD or LVM where the volume was not yet activated,
returns then 0, which we interpret as the disk not existing, thus
call vdisk_alloc which errors as the disk, in fact, really already exists.

With this patch we call activate_volume before trying
file_size_info, so if the volume exists we get it available and else
we can really create it.
If the disk does not exist and is created with vdisk_alloc we still
require an additional call to activate_volume for the new disk.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 16:31:52 +02:00
Thomas Lamprecht
96f00fd866 fix #503: print correct offline time for stop mode backups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 16:28:15 +02:00
Thomas Lamprecht
9e05909534 fixup: correct initial prefix
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-13 06:05:51 +00:00
Thomas Lamprecht
e85263a20e minor followup cleanups
remove now out of date commen about 'our', left over from previous
revision

Pass firs $prefix directly to function and some other small stuff

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-13 05:50:37 +00:00