Commit Graph

4551 Commits

Author SHA1 Message Date
Jiri Denemark
04c721f22d qemu: Always set async job when starting a domain
We only started an async job for incoming migration from another host.
When we were starting a domain from scratch or restoring from a saved
state (migration from file) we didn't set any async job. Let's introduce
a new QEMU_ASYNC_JOB_START for these cases.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-19 09:41:23 +01:00
Jiri Denemark
2bf5333f45 qemu: Introduce qemuProcessIncomingDef
Incoming migration may require quite a few parameters (URI, fd, path) to
be considered while starting QEMU and we will soon add another one.
Let's group all of them in a single struct.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-19 09:41:23 +01:00
Jiri Denemark
34b9fe6101 qemu: Move incoming URI code to qemu_migration
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-19 09:41:23 +01:00
Jiri Denemark
08600de376 qemu: Don't generate migration URI in qemuBuildCommandLine
Make callers of qemuBuildCommandLine responsible for providing the URI
which should be passed as a parameter for -incoming.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-19 09:41:23 +01:00
Jiri Denemark
7148364102 qemu: Refactor the code to build -incoming command line
Move the code from qemuBuildCommandLine into dedicated functions.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-19 09:41:23 +01:00
Jiri Denemark
6d1f8899a6 qemu: Refactor waiting for completed migration on destination
Move the code from qemuMigrationFinish into a dedicated function.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-19 09:41:23 +01:00
Peter Krempa
4ad31f8f65 qemu: ppc64: Support memory hotplug without NUMA enabled
ppc64 guests don't require adding a NUMA node for hotplug memory to
work. Lift the requirement and add test cases.
2015-11-18 10:32:18 +01:00
Peter Krempa
542fcbc07d qemu: command: Prepare memory device def formatter for missing target node
Prepare the command line generator for the possibility that in some
configurations the target NUMA node info will be missing.
2015-11-18 10:32:18 +01:00
Peter Krempa
83707dc87e conf: Prepare making memory device target node optional
Adjust the config code so that it does not enforce that target memory
node is specified. To avoid breakage, adjust the qemu memory hotplug
config checker to disallow such config for now.
2015-11-18 10:32:18 +01:00
Peter Krempa
6f95618ed3 qemu: command: Move dimm device checks from formatter to checker
Aggregate the checks of the dimm device into the verification function
rather than having them in the formatter.
2015-11-18 10:32:18 +01:00
Peter Krempa
118c91b0d5 qemu: domain: Add common function to perform memory hotplug checks
Add a function that will aggregate various checks related to memory
hotplug so that they aren't scattered accross various parts of the
code.
2015-11-18 10:32:18 +01:00
Peter Krempa
a4b10a60ad qemu: command: Always execute memory device formatter
Since we already make sure before that the domain configuration is
valid we may execute it always at the cost of doing 0 iterations of the
for loop.

This patch will simplify later refactor as it will avoid whitespace
changes.
2015-11-18 10:32:18 +01:00
Peter Krempa
0621f15ac7 qemu: command: Make qemuBuildMemoryBackendStr usable without NUMA
Make the function usable so that -1 can be passed to it as cell ID so
that we can later enable memory hotplug on non-NUMA guests for certain
architectures.
2015-11-18 10:32:18 +01:00
Peter Krempa
63ed05d241 qemu: Explain mlock limit size more in detail
Based on Alex's explanation [1] in the recent discussion let's update
the comment explaining the memory lock limit calculation.

[1]
http://www.redhat.com/archives/libvir-list/2015-November/msg00329.html
2015-11-12 08:05:35 +01:00
Peter Krempa
e7b91c510e qemu: domain: Restructurate control flow in qemuDomainGetMlockLimitBytes
Break early when hard limit is set so that it's not intermixed by other
logic for determining the limit.
2015-11-12 08:03:37 +01:00
Jiri Denemark
53ec39ea63 qemu: Fix job entry debug message
Logging current async job while in BeginJob is useful, but the async job
we want to start is even more interesting.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-11 17:06:12 +01:00
Jiri Denemark
256fff39e4 qemu: Fix style in qemuProcessStart
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-11 17:02:53 +01:00
Daniel P. Berrange
f8ea21c95d qemu: fix parsing of -sdl arg
The previous commit

  commit 4e8993a250
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Mon Nov 9 16:20:08 2015 +0000

    qemu: assume various QEMU 0.10 features are always available

Added broken handling of -sdl. Instead of duplicating existing
SDL handling code, just ensure it is invoked in the right
scenarios.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 12:19:57 +00:00
Daniel P. Berrange
4e8993a250 qemu: assume various QEMU 0.10 features are always available
The -sdl and -net ...name=XXX arguments were both introduced
in QEMU 0.10, so the QEMU driver can assume they are always
available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:18 +00:00
Daniel P. Berrange
72edc90a65 qemu: assume -vga is always available
As of QEMU 0.10.0 the -vga argument was introduced, so the
QEMU driver can assume it is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:17 +00:00
Daniel P. Berrange
f81e0d480e qemu: assume -drive format is always available
As of QEMU 0.10.0 the -drive format= parameter was added,
so the QEMU driver can assume it is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:17 +00:00
Daniel P. Berrange
468273a69c qemu: assume -drive cache always uses v2 option names
As of QEMU 0.10.0, the -drive cache option stopped using
the on/off value names, so the QEMU driver can assume
use of the new value names.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:17 +00:00
Daniel P. Berrange
2e90c9daf9 qemu: assume support for all migration protocols except rdma
Since we require QEMU 0.12.0, we can assume that QEMU supports
all of the fd, tcp, unix and exec migration protocols.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:17 +00:00
Daniel P. Berrange
8e5a21ee05 qemu: assume vnet-hdr feature is always available 2015-11-10 10:38:17 +00:00
Daniel P. Berrange
257e2056e7 qemu: really remove last traces of Xenner support
We have twice previously attempted to remove Xenner
support

  commit de9be0ab4d
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Wed Aug 22 17:29:01 2012 +0100

    Remove xenner support

  commit 92572c3d71
  Author: Ján Tomko <jtomko@redhat.com>
  Date:   Wed Feb 18 16:33:50 2015 +0100

    Remove code handling the QEMU_CAPS_DOMID capability

This change really does remove the last traces of it
in the capabilities handling code

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:15 +00:00
Daniel P. Berrange
dc7f6c3d30 qemu: assume -uuid is always available
The -uuid arg was added in QEMU 0.10.0, so the QEMU driver can
assume it is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:02 +00:00
Daniel P. Berrange
4588c2ce97 qemu: assume -name is always available
The -name arg was added in QEMU 0.9.1, so the QEMU driver can
assume it is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:02 +00:00
Daniel P. Berrange
f78610038d qemu: assume -drive argument is always available
As of QEMU 0.9.1 the -drive argument can be used to configure
all disks, so the QEMU driver can assume it is always available
and drop support for -hda/-cdrom/etc.

Many of the tests need updating because a great many were
running without CAPS_DRIVE set, so using the -hda legacy
syntax.

Fixing the tests uncovered a bug in the argv -> xml
convertor which failed to handle disk with if=floppy.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:01 +00:00
Daniel P. Berrange
1888057839 qemu: handle floppy disk bus when parsing command line argv
The QEMU argv -> virDomainDef conversion code was not handling
-drive arguments using the floppy bus. This caused them to be
added as hard disks instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:01 +00:00
Daniel P. Berrange
f5e8ca65fb qemu: handle USB bus in qemuAssignDeviceDiskAliasFixed()
The qemuAssignDeviceDiskAliasFixed() method was missing handling
for the USB disk bus type.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:01 +00:00
Daniel P. Berrange
f7ee34114d qemu: assume -no-reboot is always available
The -no-reboot arg was added in QEMU 0.9.0, so the QEMU driver
can now assume it is always present.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:01 +00:00
Daniel P. Berrange
932534e85f qemu: assume 'info chardev' is always available
As of QEMU 0.11.0 the 'info chardev' monitor command can be
used to report on allocated chardev paths, so we can drop
support for parsing QEMU stderr to locate the PTY paths.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:01 +00:00
Daniel P. Berrange
9cd0fe69cd qemu: assume -vnc arg always takes a ':'
As of QEMU 0.9.0 the -vnc option accepts a ':' to separate port
from listen address, so the QEMU driver can assume that support
for listen addresses is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:01 +00:00
Daniel P. Berrange
8e91a400cf qemu: remove all support for kQEMU
The kQEMU accelerator was deleted in QEMU 0.12, so we no
longer need to support it in the QEMU driver.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:01 +00:00
Daniel P. Berrange
fc604c12d5 qemu: mandate QEMU version 0.12.0 or newer
Check the QEMU version and refuse to work with QEMU versions
older than 0.12.0. This is approximately the vintage of QEMU
that is available in RHEL-6 era distros.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-10 10:38:00 +00:00
Peter Krempa
baf55e1fa4 qemu: hotplug: Reject VFIO hotplug if setting RLIMIT_MEMLOCK fails
Check the return value of virCommandSetMaxMemLock when hotplugging VFIO
PCI hostdevs and reject the hotplug if the memory limit can't be set.
2015-11-10 09:34:36 +01:00
Peter Krempa
ec90b34acf qemu: hotplug: Fix mlock limit handling on memory hotplug
If mlock is required either due to use of VFIO hostdevs or due to the
fact that it's enabled it needs to be tweaked prior to adding new memory
or after removing a module. Add a helper to determine when it's
necessary and reuse it both on hotplug and hotunplug.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1273491
2015-11-10 09:30:21 +01:00
Peter Krempa
fbc58cfcae qemu: Extract logic to determine the mlock limit size for VFIO
New function qemuDomainGetMlockLimitBytes will now handle the
calculation so that it unifies the logic to one place and allows later
reuse.
2015-11-10 09:26:38 +01:00
Peter Krempa
afb792bd38 qemu: migration: Actually error out on unsupported migration flag
The code reported that a migration flag is unsupported but didn't jump
to the error label. Probably an oversight in commit f88af9dc that
introduced the flag checking.
2015-11-05 15:23:37 +01:00
Peter Krempa
f59808b724 qemu: migration: Properly parse memory hotplug migration flag
Since the flag was not enabled when 'eating' the migration cookie,
libvirt reported a bogus error when memory hotplug was enabled:

 unsupported migration cookie feature memory-hotplug

The error was ignored though due to a bug in the code so it slipped
through testing.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1278404
2015-11-05 15:20:21 +01:00
Jiri Denemark
630341a215 qemu: Fix memory leak in qemuProcessStart
nodeset should be freed in both success and failure paths.

While tmppath is freed immediately after it's consumed, moving it from
error to cleanup label is a bit more consistent and robust.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-04 13:09:35 +01:00
Jiri Denemark
d65ab51d74 qemu: Introduce cleanup label in qemuProcessStart
Remove code duplication by moving common cleanup code in a dedicated
label.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-04 13:09:35 +01:00
Jiri Denemark
93df3a9748 qemu: Rename ret variable in qemuProcessStart
Generally, we use "ret" variable for storing the value we are going to
return at the and of a function, but this is not the case in
qemuProcessStart. Let's rename "ret" as "rv".

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-04 13:09:34 +01:00
Jiri Denemark
7404c40597 qemu: Rename cleanup label in qemuProcessStart
Current "cleanup" label is only used in error path, thus it should
rather be called "error".

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-04 13:09:34 +01:00
Jiri Denemark
b33c33b7d5 qemu: Use correct type when calling qemuPrepareNVRAM
qemuProcessStart was passing char * migrateFrom as the third argument to
qemuPrepareNVRAM. We should explicitly convert the pointer to bool which
is what the function expects.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-04 13:09:34 +01:00
Luyao Huang
4eac55238f qemu: Use live autoNodeset when numatune placement is auto
https://bugzilla.redhat.com/show_bug.cgi?id=1270715

Commit id '9deb96f' removed the code to fetch the nodeset from the
CpusetMems cgroup for a running vm in favor of using the return from
virDomainNumatuneFormatNodeset introduced by commit id '43b67f2e7'.
However, that API will return the value of the passed 'auto_nodeset'
when placement is VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO, which happens
to be NULL.

Since commit id 'c74d58ad' started using priv->autoNodeset in order
to manage the auto placement value during qemuProcessStart, it should
be passed along in order to return the correct value if the domain
requests the auto placement.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-10-28 16:25:37 -04:00
Luyao Huang
926a98de21 qemu: fix migration flags undefinesource cannot work
In commit f41be296, we moved vm->persistent check into
qemuDomainRemoveInactive, but we didn't change the vm->persistent
before call qemuDomainRemoveInactive in some place before and just
call it to remove the inactive vm.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-10-27 10:43:52 +01:00
Andrea Bolognani
66f319aec0 qemu: hostdev: Introduce qemuHostdevUpdateActiveDomainDevices()
This calls the PCI-, USB- and SCSI-specific functions just
like qemuHostdev{Prepare,ReAttach}DomainDevices() already do,
and was the missing piece for the qemuHostdev API to nicely
mirror the virHostdev API.

Update qemuProcessReconnect() to use the new function.
2015-10-26 13:50:35 +01:00
Andrea Bolognani
8da5cbfc78 qemu: hostdev: Unify naming for qemuHostdevUpdateActive*Devices()
Adopt the same names used for virHostdevUpdateActive*Devices() for
consistency's sake and to make it easier to jump between the two.

No functional changes.
2015-10-26 13:50:35 +01:00
Andrea Bolognani
5ab29e369f qemu: hostdev: Unify naming for qemuHostdevReAttach*Devices()
Adopt the same names used for virHostdevReAttach*Devices() for
consistency's sake and to make it easier to jump between the two.

No functional changes.
2015-10-26 13:50:35 +01:00