5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-27 14:03:54 +03:00

77 Commits

Author SHA1 Message Date
Thomas Lamprecht
c75bf16117 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>
2019-10-29 19:11:21 +01:00
Thomas Lamprecht
5600c5b22f 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>
2019-10-29 19:11:21 +01:00
Dominic Jäger
7f384190de 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>
2019-10-29 19:11:21 +01:00
Thomas Lamprecht
93981fa799 refactor hugepages_size conf
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-29 17:58:53 +01:00
Thomas Lamprecht
71aba4eac3 refactor hugepages_size
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-29 17:49:37 +01:00
Stefan Reiter
062a7ea714 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>
2019-10-29 16:52:54 +01:00
Mira Limbeck
9a13f0fed3 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>
2019-10-18 21:40:34 +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
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
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
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
Thomas Lamprecht
e2b0d85dda PCIe passthrough: fixup: avoid addr conflict and cleanup a bit
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-06 19:27:30 +02:00
Thomas Lamprecht
d7d698f60c pci: add conflict tests
best viewed with: git show -w

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-06 19:27:30 +02:00
Aaron Lauterer
c4e1638148 Add support for up to 16 PCI(e) devices
For non pci express passthrough additional addresses are reserved.
For pcie passthrough pcie root ports are needed (unless guest is like
windows 7).

The first 4 pcie root ports are defined by default in the pve-q35*.cfg
files. If more than 4 pcie devices are passed through the needed root
ports are created on demand. This helps to keep live migration possible
without adding a new pve-q35*.cfg file.

For the windows 7 like guests additional addresses are reserved as well.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-09-06 19:27:30 +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
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
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
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
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
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
92fcaab73a cloudinit: use detected format in volname parsing
keep the ?, as format is raw if no file ending is there, which we
want to handle too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-30 13:24:56 +00:00
Thomas Lamprecht
84821d1515 followup: do not query size of image we just created
we know the size, and even if a storage plugin pads this up (it
mustn't alloc something smaller, but something bigger can be OK) we
know that our 4MB is OK, and can only be used anyway to make this
compatible between storage plugins.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-30 13:09:23 +00:00
Thomas Lamprecht
6aaf593cfd followup: make ISO exists check a bit stricter
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-30 13:07:55 +00:00
Mira Limbeck
b56d56cf3a fix #2173: use qemu-img to check cloudinit disk existence
use file_size_info to check for existence of cloudinit disk instead of
'-e'. It uses `qemu-img info` to get some file info, which can handle
rbd, and various other paths for volumes not exposed as normal file
or not mapped, yet.

this addresses a problem with rbd where the path returned available
is not checkable with '-e'.

Any size > 0 is interpreted as the image existing.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-30 12:53:28 +00:00
Mira Limbeck
7e8ab2a9ab cloudinit: create disk if it does not exist on start
create a fixed size cloudinit disk if it is referenced in config and
does not exist. the size of the disk created when first added to the
config is reduced to 4MiB to match the one created in
commit_cloudinit_disk.
maximum file size per snippet file (network, user, meta) is increased to 1MiB.
preparation for offline migration without the cloudinit disk (that is
always regenerated on start).

also fixes #1807, although a further patch is required to change the
vmid on restore

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-29 18:11:33 +01:00
Mira Limbeck
6f3999e0f5 partially revert 4efb58a - unquote configdrive2 ips
configdrive2 uses /etc/network/interfaces style config instead of the
official yaml one. this does not allow quoting of the ip addresses.

Tested with Windows Server 2016.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-03-27 17:12:48 +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
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
David Limbeck
4efb58a96e fix #2101: ipv6 ending in ':' not parsed as a string
Space or newline after ':' is recognized as a mapping and as a result an
ipv6 ending in ':' is not parsed as a string. The solution is to quote
the address. For consistency all other addresses (including mac) are
quoted.

Signed-off-by: David Limbeck <d.limbeck@proxmox.com>
2019-02-22 10:21:10 +01:00
Wolfgang Bumiller
1d68295172 memory: fix automatic num amapping
when no numaX config options were present we returned the
hash as a list instead of a hash reference...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-02-18 10:45:17 +01:00
Kamil Trzciński
ca0ef6b148 Use nr_hugepages from /proc/cmdline
Currently Proxmox VE always deallocates HugePagesTLB
when starting a new machine and it makes it impossible
to preconfigure kernel /proc/cmdline with persistent allocation.

This change makes deallocation to prefer defaults set by /proc/cmdline,
by parsing the cmdline and respecting hugepages= and hugepagesz=.

Signed-off-by: Kamil Trzciński <ayufan@ayufan.eu>
2019-02-18 10:39:18 +01:00
Dominik Csapak
739ba34024 add win7 pcie quirk
Win7 is very picky about pcie assignments and fails with
'error 12' the way we add hospci devices.

To combat that, we simply give the hostpci device a normal port
instead.

Start with address 0x10, so that we have space before those devices,
and between them and the ones configured in pve-q35.cfg should we
need it in the future.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-17 14:00:23 +01:00
Thomas Lamprecht
88a7da8309 followup: add FIXME comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-27 13:45:23 +01:00
Dominik Csapak
ad5f4f3837 fix check if machine type is q35
When live migrating, with a q35 machine will get the qemu version
encoded in the machine type, for example,'pc-q35-2.12', so we need to
allow this too and cannot expect that all q35 machine have
q35' in verbatim as their type.

So, when migrating such a machine live, we missed to include the q35
cfg because we didn't allowed versioned q35 machine types, which then
failed the migration.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-27 13:35:52 +01:00
Dominik Csapak
b71351a7ed QemuServer: remove PCI sysfs helpers
and use them from PVE::SysFSTools, where they got moved to

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-19 14:06:11 +01:00
Wolfgang Bumiller
d559309fcf arm: pci addressing, keyboard and ehci controller
On arm we start off with a pcie bridge pcie.0. We need a
keyboard in addition to the tablet device, and we need to
connect both to an 'ehci' controller.

To do all this, we also pass the $arch variable through a
whole lot of function calls to ultimately also adapt the
hotplug code to take care of the new keyboard device.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +01:00
David Limbeck
c701be3243 fix #1959: add fallback for 'auto' previously set by SLAAC
SLAAC previously set 'auto' which is not supported by nocloud network
config. On an up-to-date Ubuntu this should work as it uses 'dhcp' for
both dhcp and SLAAC. For others it was invalid anyway.

Signed-off-by: David Limbeck <d.limbeck@proxmox.com>
2018-11-13 10:10:29 +01:00
Dominik Csapak
55655ebc32 fix #1952: make vga memory configurable
we change 'vga' to a property string and add a 'memory' property
with this, the user can better control the memory given to the virtual
gpu, this is especially useful for spice/qxl since high resolutions need
more memory

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-09 13:45:07 +01:00
David Limbeck
8d54522b90 fix #1865: CloudInit doesn't add IPv6
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-08-22 12:40:26 +02:00
Thomas Lamprecht
804fffdfc3 qemu agent: fixup error message letter-case
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-07-11 11:26:00 +02:00
Dominik Csapak
8efdf41820 implement agent exec api call
this imitates the qemu-guest-agent interface
with an 'exec' api call which returns a pid
and an 'exec-status' api call which takes a pid

the command for the exec call is given as an 'alist'
which means that when using we have to give the 'command'
parameter multiple times e.g.

pvesh create <...>/exec --command ls --command '-lha' --command '/home/user'

so that we avoid having to deal with shell escaping etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-07-11 10:29:45 +02:00
Dominik Csapak
3824765e64 add Agent helper package
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-07-11 10:29:45 +02:00
Dominik Csapak
e1c88a4ee2 refactor Makefile for PVE/QemuServer/ directory
this makes it easier to add new files there

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-06-11 10:18:51 +02:00
Wolfgang Bumiller
c3cedb3d9c cloud-init: nocloud v1: use lower case mac address
because cloud-init...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-06-07 12:03:52 +02:00
Wolfgang Bumiller
862807898c cloud-init: nocloud v1: set ip and netmask instead of cidr
because of centos7's broken cloud-init version

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-06-07 12:03:52 +02:00
Dominik Csapak
9be87f4eea activate volume for cloudinit disk
because it does not have to be activated (e.g. in case of lvm)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-05-22 10:11:39 +02:00
Alexandre Derumier
f0a762f7ba commit_cloudinit_disk : add -n option to qemu-img dd 2018-03-21 15:35:05 +01:00
Dominik Csapak
4a85391549 cloud-init: make parameter order consistent
we have '$conf, $vmid' elsewhere for cloudinit, this was the only
function which had them in reverse

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-03-14 11:13:27 +01:00