Commit Graph

645 Commits

Author SHA1 Message Date
Dietmar Maurer
d3f3f1b348 fix add_throttle_desc - pass correct units 2016-11-03 12:48:24 +01:00
Wolfgang Bumiller
9196a8ec62 Close #1195: support iops/bps_max_length throttling options 2016-11-03 10:24:12 +01:00
Wolfgang Bumiller
6ecfbb4400 fix a warning: discard is not a number 2016-11-03 09:55:59 +01:00
Thomas Lamprecht
2de2d6f74e allow dedicated migration network, bug #1177
Without this patch we use the network were the cluster traffic runs
for sending migration traffic. This is not ideal as it may hinder
cluster traffic. Further some users have a powerful network which
would be perfect for migrations, with this patch they can run the
migration traffic over such a network without having the corosync
traffic on the same network.

The network is configurable through /etc/pve/datacenter.cfg which
got a new property, namely migration. migration has two
subproperties: type (replaces the old migration_unsecure property)
and network.

For the case of a network failure or that a VM has to be moved over
another network for arbitrary other reasons I added the
migration_type and migration_network parameters to qm migrate (and
respectively vm_start as this gets used on migration).
They allow overwriting the datacenter.cfg settings.

Fixes bug #1177

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2016-11-03 09:51:23 +01:00
Dietmar Maurer
613d76a179 change default value for cpuunits to 1024
Use the same default as containers.
2016-10-27 07:23:32 +02:00
Wolfgang Bumiller
b799312f2f Fix #1174: remove pve-qm-drive
Let 'cdrom' use the pve-qm-ide format, as it's supposed to
be an alias to ide2.
We're not using the 'alias' schema property since the qemu
configs still use a custom parser (due to the
pending-changes system and the filename-to-volume-id
conversion for legacy support) which does not deal with
schema aliases.
2016-10-18 11:45:41 +02:00
Wolfgang Bumiller
961af8a3c5 improve error messages 2016-10-17 14:49:05 +02:00
Alexandre Derumier
2e5416790f enable drive-mirror with iothread for qemu 2.7 v2
changelog : check running qemu binary version

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-10-17 14:34:56 +02:00
Alexandre Derumier
98cfd8b641 add get_running_qemu_version
return current running qemu process version

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-10-17 12:52:56 +02:00
Alexandre Derumier
eba3e64d2e cpu hotplug : add new cpu hotplug method for qemu 2.7
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-10-17 12:51:12 +02:00
Alexandre Derumier
1e881b75d8 cpu hotplug : add cpu hot-unplug support
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-10-17 12:51:12 +02:00
Alexandre Derumier
69c81430e0 cpu hotplug : add coldplugged cpu to qemu command line
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-10-17 12:51:12 +02:00
Alexandre Derumier
0efb537eb7 cpu hotplug : add print_cpu_device
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-10-17 12:51:12 +02:00
Wolfgang Link
5930c1ff6b fix #1111: qm showcmd wrong escape sequence 2016-10-04 08:38:09 +02:00
Wolfgang Link
4a5cf64a80 Avoid to parse empty property string.
Check if string exists before you try to parse it. Remove unnecessary
eval.
2016-10-04 08:35:52 +02:00
Fabian Grünbichler
6b72854b95 restore: better error handling for vdisk deletion
when restoring into an existing VM, we don't want to die
half-way through because we can't delete one of the existing
volumes. instead, warn about the deletion failure, but
continue anyway. the not deleted disk is then added as
unused automatically.
2016-09-15 14:16:12 +02:00
Dominik Csapak
dbea44152e add seabios bootsplash and use it
this adds a bootsplash image in /usr/share/qemu-server
and if this file exists, use it for seabios

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-09-08 12:22:01 +02:00
Dominik Csapak
2ddc0a5c75 use efidisk0 for efivars
if efidisk0 is defined, use it as a efivars disk,
to permanently store efivars (such as boot options)

we check if the files exist, and act accordingly

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-09-08 11:31:28 +02:00
Dominik Csapak
6470743ff9 add efidisk0 to config
just a simple disk (only size, format and volid) for
efivars disk

also do not add it to command line in foreach_drive

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-09-08 11:10:52 +02:00
Wolfgang Bumiller
a3139f90dc hostpci: bring back multifunction pass-through shortcut 2016-08-29 10:08:00 +02:00
Alexandre Derumier
2af848a2da disable drive-mirror when iothread is enabled
drive-mirror is not working with qemu 2.6 when iothread is enabled.

with virtio-blk : mirror is working, but block-job-completed crash the vm
with virtio-scsi : mirror hang at start.

This should be fixed in qemu 2.7

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-08-23 09:28:54 +02:00
Alexandre Derumier
eed2430325 qemu-img convert : use default cache=unsafe instead writeback
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-08-01 10:40:03 +02:00
Wolfgang Bumiller
ec647db4f8 Fix #1057: make protection a fast-plug option
Otherwise you need to shutdown a VM to disable protection,
which is inconvenient for a few tasks such as for instance
deleting an unused disk.
2016-07-26 14:47:30 +02:00
Fabian Grünbichler
3999f370b1 only activate the newly created volume
instead of the whole list.
2016-07-14 12:31:36 +02:00
Wolfgang Bumiller
b5b9979081 pass datacenter.cfg's mac_prefix to random_ether_addr 2016-07-14 09:02:24 +02:00
Dominik Csapak
f745762b2e disable usb hotplug for now
we have a few problems with hotplug at the moment:
qemu may add usb hubs when adding usb devices but fails to remove them
when removing the usb device (this is a qemu bug)

also when starting a guest with a usb device we add ehci and uchi
controllers, which we cannot hot unplug

with those devices, it is impossible to live migrate the guest
to another host, meaning even if you remove all usb devices,
the migrate fails

so we deactivate usb hotplugging for now

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-07-05 09:23:57 +02:00
Dominik Csapak
4eb6860435 implement usb hotplug
this patch introduces working usb hotplugging

you can now add a usb device while a vm is running

this does not work with spice at the moment, only
with usb passthrough

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-06-22 09:13:16 +02:00
Dominik Csapak
16521d6353 add qemu_usb_hotplug
this adds a function for hotplugging usb devices

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-06-22 09:13:16 +02:00
Dominik Csapak
deb091c500 get usbdevices in vm_devices_list
since usb devices do not have their own
"query" command in qmp, we have to use
qom-list /machines/peripheral

which essentially gets a list of peripheral devices of
the vm

there we only get the usb devices

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-06-22 09:13:16 +02:00
Dominik Csapak
d40e5e1852 use the refactored usb functions
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-06-22 09:13:16 +02:00
Dominik Csapak
de9768f002 refactor PCI into own file
to reduce QemuServer.pm size
also move the $device hash out of any function

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-06-22 09:13:16 +02:00
Alexandre Derumier
7023f3ea16 add hugepages option
vm configuration
----------------
hugepages: (any|2|1024)

any: we'll try to allocate 1GB hugepage if possible, if not we use 2MB hugepage
2: we want to use 2MB hugepage
1024: we want to use 1GB hugepage. (memory need to be multiple of 1GB in this case)

optionnal host configuration for 1GB hugepages
----------------------------------------------
1GB hugepages can be allocated at boot if user want it.
hugepages need to be contiguous, so sometime it's not possible to reserve them on the fly

/etc/default/grub : GRUB_CMDLINE_LINUX_DEFAULT="quiet hugepagesz=1G hugepages=x"

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2016-06-22 09:11:11 +02:00
Fabian Grünbichler
b74ff0476e add @param to foreach_drive 2016-06-17 16:20:57 +02:00
Wolfgang Link
b6adff3385 fix perl scope issues
Add parameter array to foreach_volid to use is in the functions.
correct typos.
2016-06-16 11:26:37 +02:00
Wolfgang Bumiller
387ba25792 split old style pipe open call 2016-06-09 18:12:26 +02:00
Alexandre Derumier
7a131888d7 add hyperv enlightments : hv_reset, hv_vpindex, hv_runtime
add them by default for qemu 2.6
(support is already present in qemu 2.5, but we don't want to break live migration for current running vm)

vpindex && runtime need host kernel 4.4

Theses 3 enlightements are needed by windows to use vmbus
http://searchwindowsserver.techtarget.com/definition/Microsoft-Virtual-Machine-Bus-VMBus

details :

- When Hyper-V "vpindex" is on, guest can use MSR HV_X64_MSR_VP_INDEX
to get virtual processor ID.

- Hyper-V "runtime" enlightement feature allows to use MSR
HV_X64_MSR_VP_RUNTIME to get the time the virtual processor consumes
running guest code, as well as the time the hypervisor spends running
code on behalf of that guest.

- Hyper-V "reset" allows guest to reset VM.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-06-07 10:08:25 +02:00
Thomas Lamprecht
54323eed5f migrate: unlink unix socket before starting migration
Just to be sure nobody else has (wrongfully) left that file here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2016-06-03 16:02:25 +02:00
Thomas Lamprecht
1c9d54bfd0 migrate: use ssh forwarded UNIX socket tunnel
We cannot guarantee when the SSH forward Tunnel really becomes
ready. The check with the mtunnel API call did not help for this
prolem as it only checked that the SSH connection itself works and
that the destination node has quorum but the forwarded tunnel itself
was not checked.

The Forward tunnel is a different channel in the SSH connection,
independent of the SSH `qm mtunnel` channel, so only if that works
it does not guarantees that our migration tunnel is up and ready.

When the node(s) where under load, or when we did parallel
migrations (migrateall), the migrate command was often started
before a tunnel was open and ready to receive data. This led to
a direct abortion of the migration and is the main cause in why
parallel migrations often leave two thirds or more VMs on the
source node.
The issue was tracked down to SSH after debugging the QEMU
process and enabling debug logging showed that the tunnel became
often to late available and ready, or not at all.

Fixing the TCP forward tunnel is quirky and not straight ahead, the
only way SSH gives as a possibility is to use -N (no command)
-f (background) and -o "ExitOnForwardFailure=yes", then it would
wait in the foreground until the tunnel is ready and only then
background itself. This is not quite the nicest way for our special
use case and our code base.
Waiting for the local port to become open and ready (through
/proc/net/tcp[6]] as a proof of concept is not enough, even if the
port is in the listening state and should theoretically accept
connections this still failed often as the tunnel was not yet fully
ready.

Further another problem would still be open if we tried to patch the
SSH Forward method we currently use - which we solve for free with
the approach of this patch - namely the problem that the method
to get an available port (next_migration_port) has a serious race
condition which could lead to multiple use of the same port on a
parallel migration (I observed this on my many test, seldom but if
it happens its really bad).

So lets now use UNIX sockets, which ssh supports since version 5.7.
The end points are UNIX socket bound to the VMID - thus no port so
no race and also no limitation of available ports (we reserved 50 for
migration).

The endpoints get created in /run/qemu-server/VMID.migrate and as
KVM/QEMU in current versions is able to use UNIX socket just as well
as TCP we have not to change much on the interaction with QEMU.
QEMU is started with the migrate_incoming url at the local
destination endpoint and creates the socket file, we then create
a listening socket on the source side and connect over SSH to the
destination.
Now the migration can be started by issuing the migrate qmp command
with an updated uri.

This breaks live migration from new to old, but *not* from old to
new, so there is a upgrade path.
If a live migration from new to old must be made (for whatever
reason), use the unsecure_migration setting (man datacenter.conf)
to allow this, although that should only be done in trusted network.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2016-06-03 11:51:46 +02:00
Wolfgang Bumiller
8e59d952be use enter_systemd_scope instead of systemd-run
With systemd-run qemu's --daemonize forks often happen
before systemd finishes setting up the scopes, which means
the limits we apply often don't work.
We now use enter_systemd_scope() to create the scope before
running qemu directly without systemd-run.

Note that vm_start() runs in a forked-worker or qm cli
command, so entering the scope in such a process should not
affect the rest of the pve daemon.
2016-06-03 11:41:31 +02:00
Dominik Csapak
596a0a2056 do not ignore hotplug parse errors
if we got an option which was not valid, we still
wrote it to the config, and subsequently returned
it on every api call

instead, now we die instead of warn and do not accept
invalid options

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-05-31 12:15:32 +02:00
Alexandre Derumier
0567a4d572 move memory config generation to QemuServer::Memory::config
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-05-23 10:04:31 +02:00
Alexandre Derumier
6779f1ac3c move qemu_memory_hotplug && qemu_dimm_list to QemuServer::Memory
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-05-23 10:03:40 +02:00
Alexandre Derumier
3f669af25d move foreach_dimm && foreach_reverse_dimm to QemuServer::Memory
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2016-05-23 10:02:29 +02:00
Dietmar Maurer
faab53066c hostpci docs: move notes into verbose_description 2016-05-20 11:59:30 +02:00
Dietmar Maurer
fad17f04fc add full path reference to datacenter.conf file 2016-05-19 16:27:30 +02:00
Dietmar Maurer
522619458c improve documentation 2016-05-19 13:13:25 +02:00
Dominik Csapak
9f41a659a1 allow VLAN 1 tag in qemu-kvm vms
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-05-18 11:25:29 +02:00
Fabian Grünbichler
19333c9b82 add --description to systemd scope unit
otherwise, long kvm commands lead to systemd unit files with
very long lines, with confuses the systemd unit file parser.

apparently systemd has a length limit for unit file lines and
(line-)breaks the description string at that point. since
the rest of the description is probably not a valid key/value
pair, this leads to warnings. the default semantics of systemd-run
is to use the executed command as description unless a description
is specified explicitly.

note that this behaviour of systemd could allow an attacker
with access to the VM configuration to craft a kvm commandline
that starts or stops arbitrary systemd units.
2016-05-14 09:02:58 +02:00
Dietmar Maurer
30983c3bac remove unneeded keyAlias option 2016-05-11 13:04:59 +02:00
Dietmar Maurer
7f694a7113 fix #975, use new keyAlias feature.
Also remove unneccessary format_descriptions for boolean and enums.
2016-05-11 10:11:49 +02:00