Commit Graph

20909 Commits

Author SHA1 Message Date
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
Guido Günther
ba08d16d6c libvirt-guests: Disable shutdown timeout
Since we can't know at service start how many VMs will be running we
can't calculate an apropriate shutdown timeout. So instead of killing
off the service just let it use it's own internal timeout mechanism.

References:
    http://bugs.debian.org/803714
    https://bugzilla.redhat.com/show_bug.cgi?id=1195544
2015-11-18 08:15:12 +01:00
Stefan Berger
5ed7afa9de tpm: adapt sysfs cancel path for new TPM driver
This patch addresses BZ 1244895.

Adapt the sysfs TPM command cancel path for the TPM driver that
does not use a miscdevice anymore since Linux 4.0. Support old
and new paths and check their availability.

Add a mockup for the test cases to avoid the testing for
availability of the cancel path.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-17 20:52:13 -05:00
Joao Martins
b6e19cf4cb libxl: implement virDomainGetCPUStats
Introduce support for domainGetCPUStats API call and consequently
allow us to use `virsh cpu-stats`. The latter returns a more brief
output than the one provided by`virsh vcpuinfo`.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-11-17 14:41:31 -07:00
Roman Bogorodskiy
89316b2caa bhyve: monitor: do not override domain's privateData
Current monitor code overrides domain object's privateData, e.g.
in virBhyveProcessStart():

  vm->privateData = bhyveMonitorOpen(vm, driver);

where bhyveMonitorPtr() returns bhyveMonitorPtr.

This is not right thing to do, so make bhyveMonitorPtr
a part of the bhyveDomainObjPrivate struct and change related code
accordingly.
2015-11-17 12:44:26 +03:00
Andrea Bolognani
c9014a0df6 syntax-check: Add prohibit_space_in_label rule
This guards against code such as

 cleanup :

which is happily accepted by the compiler but does not conform
to our style guidelines.
2015-11-16 17:49:36 +01:00
Chen Hanxiao
e340013ea8 util: remove unnecessary needSize
Use toadd->use directly.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2015-11-16 11:03:04 +01:00
John Ferlan
d3fa510a75 storage: Don't assume storage pool exists for FC/SCSI refresh thread
https://bugzilla.redhat.com/show_bug.cgi?id=1277781

The virStoragePoolFCRefreshThread had passed a pointer to the pool obj
in the virStoragePoolFCRefreshInfoPtr; however, we cannot assume that
the pool exists still since we don't keep the pool lock throughout
the duration of the thread.

Therefore, instead of passing the pool obj pointer, pass the UUID of
the pool and perform a lookup.  If found, then we can perform the
refresh using the locked pool obj pointer; otherwise, we just exit
the thread since the pool is now gone.
2015-11-12 06:30:33 -05:00
John Ferlan
c3afa6a9a3 storage: Introduce virStoragePoolObjFindPoolByUUID
Add a new API to search the currently defined pool list for a pool with
a matching UUID and return the locked pool object pointer.
2015-11-12 06:30:32 -05:00
John Ferlan
27432ba70c storage: Change cbdata scsi refresh thread field name
Change the field name from 'name' to 'fchost_name' to better id it.
2015-11-12 06:30:32 -05:00
John Ferlan
0c7a9b994c storage: Make active boolean
Since we treat it like a boolean, let's store it that way. At least one
path had already treated as true/false anyway.
2015-11-12 06:30:32 -05: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
826ce0e77d tests: Add QEMU 2.4.0 capabilities
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-11 17:02:53 +01:00
Jiri Denemark
3c7059528d tests: Remove qemuxmlnstest
It's just a copy&paste of qemuxml2argv test anyway. We can test most of
them (except for qemuxmlns-qemu-ns-domain.xml which fails to validate
against our schema) by qemuxml2argv test.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-11 17:02:53 +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
Jiri Denemark
c6172260a5 security: Cleanup DAC driver
Fixes several style issues and removes "DEF" (what is it supposed to
mean anyway?) from debug messages.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-11-11 17:02:53 +01:00
Pavel Hrdina
fc03eb53c0 domain-conf: reorder usb controllers so the master is first
USB controllers can share the same 'index' which indicates, that there
is some sort of master-companion relationship.  Reorder the controllers
in XML in to place the master controller before its companions.  This is
required by QEMU to not fail with error message:

error: internal error: process exited while connecting to monitor:
2015-10-26T16:25:17.630265Z qemu-system-x86_64:
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x6:
USB bus 'usb.0' not found

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1166452

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-11-11 15:30:49 +01:00
Pavel Hrdina
6fdbdafcd7 domain-conf: cleanup controller insert function
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-11-11 15:18:07 +01:00
Pavel Hrdina
a9a583d6df virsh-domain: update attach-interface to support type=hostdev
Adding this feature will allow users to easily attach a hostdev network
interface using PCI passthrough.

The interface can be attached using --type=hostdev and PCI address or
as --source.  This command also allows you to tell, whether the interface
should be managed.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=997561

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-11-11 15:03:42 +01:00
Pavel Hrdina
18657e9919 virsh.pod: improve attach-interface section
Rewrite the attach-interface section in man page to be more readable and
extendable.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-11-11 15:01:37 +01:00
Nikolay Shirokovskiy
db92aee2b4 vz: support cpu time in driver's domainGetInfo
Just straight-forward patch.
Use reference counting for privdom as stats internally could drop domain lock.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2015-11-10 16:24:47 +03: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
feaba3e179 conf: Make @def const in virDomainDefGetMemoryInitial
Keep const correctness and allow to use this function in cases where
@def is const in the caller.
2015-11-10 08:42:52 +01:00
Daniel P. Berrange
8afd34f2d8 tests: redo test argv file line wrapping
Back in

  commit bd6c46fa0c
  Author: Juerg Haefliger <juerg.haefliger@hp.com>
  Date:   Mon Jan 31 06:42:57 2011 -0500

    tests: handle backspace-newline pairs in test input files

all the test argv files were line wrapped so that the args
were less than 80 characters.

The way the line wrapping was done turns out to be quite
undesirable, because it often leaves multiple parameters
on the same line. If we later need to add or remove
individual parameters, then it leaves us having to redo
line wrapping.

This commit changes the line wrapping so that every
single "-param value" is one its own new line. If the
"value" is still too long, then we break on ',' or ':'
or ' ' as needed.

This means that when we come to add / remove parameters
from the test files line, the patch diffs will only
ever show a single line added/removed which will greatly
simplify review work.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-09 15:50:39 +00:00
John Ferlan
edc88e2084 virnetdev: Use virNetDevSetupControl in virNetDevSendEthtoolIoctl
Use virNetDevSetupControl instead of open coding using socket(AF_LOCAL...)
and clearing virIfreq.

By using virNetDevSetupControl, the socket is then opened using
AF_PACKET which requires being privileged (effectively root) in
order to complete successfully.  Since that's now a requirement,
then the ioctl(SIOCETHTOOL) should not fail with EPERM, thus it
is removed from the filtered listed of failure codes.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2015-11-06 11:20:17 -05:00