5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-02-03 13:47:15 +03:00

837 Commits

Author SHA1 Message Date
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
Thomas Lamprecht
fc5c194b5d followup: HV ID description
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-01-25 17:10:49 +01:00
Dominik Csapak
2894c24745 allow explicit hv-vendor-id
with this, a user can set the hv_vendor_id independently of
any 'x-vga=on' setting he may or may not have configured.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-01-25 17:06:43 +01:00
Thomas Lamprecht
db70021bcf config2command test: mock kernel_has_vhost_net
just return true for now, the use is guarded by an 'is_native($arch)'
check anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-12-20 10:44:15 +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
Dominik Csapak
86c9fafefc fix #2032: check that type is set before using
When not setting 'vga' we would get a warning:

Use of uninitialized value $type in string eq at
/usr/share/perl5/PVE/QemuServer.pm line 2026.

This patch changes the order of the conditions and checks if $type is set
before using it, so that we do not get the warning anymore.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-17 09:23:00 +01:00
Wolfgang Bumiller
89caf77b87 add the rest of themissing lock types
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-12-11 10:09:21 +01:00
Stoiko Ivanov
9759415454 add 'clone' to lock schema definition/confdesc.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-12-11 10:03:00 +01:00
Dominik Csapak
7c954c426d vga: allow 'none'
so that one can explicitly disable the vga without having to specify
a serial port as display, this is mostly useful for very special
and custom gpu passthrough setups which have to be specified with
'args' and for setups which do not care about any display (not even serial)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-11 09:56:50 +01:00
Dominik Csapak
7635067063 fix #1267: move args to the end of qemu commandline
there is nothing that should be really affected by this, but
even then, this option is only for experts and people using this
should know what they are doing

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-11 09:56:50 +01:00
Alexandre Derumier
8fa6a851ee clone_disk : cloudinit drive: don't clone snapname
we don't snapshot cloudinit drive,

this fix "qm clone <vmid> <targetvmid> --snapname mysnap" when a cloudinit drive exist
2018-12-11 09:43:04 +01:00
Dominik Csapak
2fd247882d use improved lspci
since lspci does not split between id and function anymore,
there is no need to plug id + function together

also we can remove the capture groups from PCIRE
since parse_property_string does this check for us

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-22 07:02:19 +01:00
Dominik Csapak
6ab45bd7ff add mediated devices support
with this, we are able to create and use mediated devices,
which include Intel GVT-g (aka KVMGT) and Nvidia vGPUs, and probably more
types of devices in the future

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-22 07:02:19 +01:00
Thomas Lamprecht
81b2db7d28 QemuServer: remove now unused $pcisysfs
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-19 14:07:54 +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
Dominik Csapak
b4496b9ed5 use qmeventd to execute qm cleanup
we reverse the direction of the event socket (this does not
prevent live migration) and point it to wher qmeventd listens

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-14 15:29:59 +01:00
Wolfgang Bumiller
869ad4a78d arm: use virtio gpu by default
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +01:00
Wolfgang Bumiller
1ea63c15bf don't use amd64-specific cpu options on arm
FIXME: This function needs proper reorganisation...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +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
Wolfgang Bumiller
91b01bbbaa arm: use UART for serial0 instead of a separate device
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +01:00
Wolfgang Bumiller
6f0cb67588 only use vhost-net for native kvm machines
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +01:00
Wolfgang Bumiller
0f27a91d3d use cortex-a57 as cpu for arm emulation for now...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +01:00
Wolfgang Bumiller
4fc262bd50 move cpu option creation into separate sub
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +01:00
Wolfgang Bumiller
6908fd9bf4 use qemu-system-aarch64 for arm machines
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +01:00
Wolfgang Bumiller
96ed3574d4 use AAVMF for arm
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +01:00
Wolfgang Bumiller
d731ecbefe add 'arch' vm configuration
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +01:00
Wolfgang Bumiller
646f2df43c fix and simplify kvm_version()
This was never actually used, but we want to use it as
alternative to checking /proc/cpuinfo for 'hvm' on ARM.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-13 14:44:28 +01:00
Dominik Csapak
8490283721 check for $vga->{type} instead of $vga
with commit 55655ebc32ce4eb3fe52f233ec4ac5926b15603f
we changed $vga to a parsed hash instead of a string
and forgot to check the property type in one place

this fixes an issue where a vm with a gpu passed through
with x-vga=on could not start

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-12 09:27:21 +01:00
David Limbeck
c9db224015 fix #1969: increase max unused disks
increase to 256, same as containers

Signed-off-by: David Limbeck <d.limbeck@proxmox.com>
2018-11-09 16:23:07 +01:00
Thomas Lamprecht
9c152e87f5 move nbd_stop up, it's not a completion helper
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-09 16:11:18 +01:00
Thomas Lamprecht
daadd5a4e7 followup for VGA memory: improve q35 comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-09 14:01:45 +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