Commit Graph

19030 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
ed4db85a55 conf: add virDomainHasNet
virDomainNetFindIdx no longer returns info whether device was not found,
or there was multiple matches. Additionally it already handle error
reporting. Introduce virDomainHasNet which does a simple task, without
implicit error reporting.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2015-03-13 12:00:50 -06:00
Marek Marczykowski-Górecki
e1bfa03a83 tests: xenconfig: test for multiple USB devices and other HVM options
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2015-03-13 12:00:50 -06:00
Marek Marczykowski-Górecki
cd5dc3031f xenconfig: add support for multiple USB devices syntax
In Xen>=4.3, libxl supports new syntax for USB devices:
usbdevice=[ "DEVICE", "DEVICE", ... ]
Add support for that in xenconfig driver. When only one device is
defined, keep using old syntax for backward compatibility.

Adjust tests for changed options order.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2015-03-13 12:00:49 -06:00
Marek Marczykowski
4ab8cd77ad libxl: add tablet/mouse input device support
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2015-03-13 12:00:49 -06:00
Michal Privoznik
eb7b635582 bridge_driver: Use more of networkObjFromNetwork
Now that the network driver lock is ash heap of history,
we can use more of networkObjFromNetwork().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-13 15:55:56 +01:00
Michal Privoznik
baf8cf9c80 parallels_network: Drop parallelsDriverLock() from everywhere.
While in previous commits there were some places that relied on
the big lock, in this file there's no such place and the big
driver lock can be dropped completely. Yay!

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-13 15:55:56 +01:00
Michal Privoznik
b464fd7ed9 test_driver: Drop testDriverLock() from almost everywhere
Well, if 'everywhere' is defined as that part of the driver code
that serves virNetwork* APIs. Again, we lower layers already have
their locks, so there's no point doing big lock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-13 15:55:56 +01:00
Michal Privoznik
af338d5f51 bridge_driver: Drop networkDriverLock() from almost everywhere
Now that we have fine grained locks, there's no need to
lock the whole driver. We can rely on self-locking APIs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-13 15:55:56 +01:00
Michal Privoznik
376b97799e struct _virNetworkDriverState: Annotate items
In order to drop network driver lock, lets annotate which
structure items are immutable, which have self-locking
APIs and so on.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-13 15:55:56 +01:00
Michal Privoznik
172acef486 network_driver: Use accessor for dnsmasqCaps
This is not an immutable pointer and can change during lifetime.
Therefore, in order to drop network driver lock, we must use an
internal accessor which does not lock the network driver yet, but
it will soon. Now it merely returns an referenced object.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-13 15:55:56 +01:00
Michal Privoznik
1009a61ecb bridge_driver: Don't access global driver randomly
Well, network driver code has the driver accessible as a global
variable. This makes any rework hard, as it's unclear where the
variable is accessed and/or modified. Lets just pass the driver
as a parameter to all functions where needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-13 15:55:56 +01:00
Ján Tomko
22fd3ac38f Introduce virBitmapIsBitSet
A helper that never returns an error and treats bits out of bitmap range
as false.

Use it everywhere we use ignore_value on virBitmapGetBit, or loop over
the bitmap size.
2015-03-13 15:31:33 +01:00
Ján Tomko
76a2a5ce8b Clarify the meaning of version in redirdev filters
The version attribute in redirdev filters refers to the revision
of the device, not the version of the USB protocol.

Explicitly state that this is not the USB protocol and remove references
to those round version numbers that resemble USB protocol versions.

https://bugzilla.redhat.com/show_bug.cgi?id=1177237
2015-03-13 14:05:02 +01:00
Maxim Nestratov
79265b9834 parallels: fix prlsdkCheckUnsupportedParams checks
for memory limits since unset ones are no longer zero

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-03-13 09:03:37 +01:00
Dawid Zamirski
1988a96e3a vmx: add e1000e to supported NIC models.
This NIC model is supported on hardware version 8 and newer and libvirt
ESX driver does support those.
2015-03-12 17:58:19 +01:00
Dawid Zamirski
36a8eb8001 vbox: use user cache dir when screenshotting.
For VBOX it's most likely that the connection is vbox:///session and it
runs with local non-root account. This caused permission denied when
LOCALSTATEDIR was used to create temp file. This patch makes use of the
virGetUserCacheDirectory to address this problem for non-root users.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-12 17:53:12 +01:00
Pavel Hrdina
48461b169e virnetdev: fix build with old kernel
Commit c9027d8f added a detection of NIC HW features, but some of them
are not available in old kernel.  Very old kernels lack enum
ethtool_flags and even if this enum is present, not all values are
available for all kernels.  To be sure that we have everything in kernel
that we need, we must check for existence of most of that flags, because
only few of them were defined at first.

Also to successfully build libvirt with older kernel we need to include
<linux/types.h> before <linux/ethtool.h> to have __u32 and friends
defined.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-03-12 17:48:02 +01:00
Maxim Nestratov
eaf1539d2a parallels: add VIR_ARCH_I686 capability to parallels driver
as soon as x32 architecture is also supported
2015-03-12 16:55:35 +01:00
Ján Tomko
a00e5c662b Error out on an address for isa-serial in QEMU driver.
We've never formatted them on the qemu command line.

https://bugzilla.redhat.com/show_bug.cgi?id=1164053
2015-03-12 09:13:31 +01:00
John Ferlan
eab968c7d7 xenapi: Resolve Coverity REVERSE_INULL
Coverity notes in xenapiDomainGetXMLDesc that 'vms' is dereferenced
a few times before a "if (vms) xen_vm_set_free(vms);" call is made.
Since we'd exit out much sooner if the fetch of the vms failed, just
remove the unnecessary "if (vms)" check.
2015-03-11 14:38:59 -04:00
John Ferlan
6da29e0faa xenapi: Resolve Coverity REVERSE_INULL
Coverity complains that "net_set" is compared to NULL before calling
xen_network_set_free, but used rather liberally before that.  While
I was looking at the code I also noted that if the virAsprintfQuiet
fails, then we leak our structures - so I added those too.
2015-03-11 14:38:45 -04:00
John Ferlan
b193a1d617 xenapi: Resolve Coverity NULL_RETURNS
Coverity points out that the return from virDomainDefParseString is
not checked in xenapiDomainCreateXML like it should be which could
end up in a NULL pointer dereference
2015-03-11 13:02:36 -04:00
John Ferlan
467c905909 xenapi: Resolve Coverity NO_EFFECT
Coverity points out that check (def->uuid) has no effect since it's not
a pointer, rather an array of characters.   Just remove the extranous check.
2015-03-11 13:02:10 -04:00
John Ferlan
500d77f181 xenapi: Resolve Coverity FORWARD_NULL
Since inception.  Coverity complains that the code checks "(record ==
NULL && !session->ok)", but doesn't check (record != NULL) before
dereferencing at "record->is_a_template"
2015-03-11 13:02:10 -04:00
John Ferlan
d9beeb68e4 conf: Resolve Coverity RESOURCE_LEAK
Commit id 'c9027d8f' added parsing of the CapNet for offload SRIOV NIC
discovery, but forgot to free the nodes
2015-03-11 13:02:07 -04:00
John Ferlan
1cfc0a9990 virsh: Add iothreadpin command
https://bugzilla.redhat.com/show_bug.cgi?id=1135491

$ virsh iothread --help

  NAME
    iothreadpin - control domain IOThread affinity

  SYNOPSIS
    iothreadpin <domain> <iothread> <cpulist> [--config] [--live] [--current]

  DESCRIPTION
    Pin domain IOThreads to host physical CPUs.

  OPTIONS
    [--domain] <string>  domain name, id or uuid
    [--iothread] <number>  IOThread ID number
    [--cpulist] <string>  host cpu number(s) to set
    --config         affect next boot
    --live           affect running domain
    --current        affect current domain

Using the output from iothreadsinfo, allow changing the pinned CPUs for
a single IOThread.

$ virsh iothreadsinfo $dom
 IOThread ID    CPU Affinity
---------------------------------------------------
 1               2
 2               3
 3               0-1

$ virsh iothreadpin $dom 3 0-2

Then view the change

$ virsh iothreadsinfo $dom
 IOThread ID    CPU Affinity
---------------------------------------------------
 1               2
 2               3
 3               0-2

If an invalid value is supplied or require option missing,
then an error will be displayed:

$ virsh iothreadpin $dom 4 3
error: invalid argument: iothread value out of range 4 > 3

$ virsh iothreadpin $dom 3
error: command 'iothreadpin' requires <cpulist> option
2015-03-11 12:24:00 -04:00
John Ferlan
fb562614e3 qemu: Add support to pin IOThreads to specific CPU
Add qemuDomainPinIOThread to handle setting the CPU affinity
for a specific IOThread
2015-03-11 12:23:55 -04:00
John Ferlan
e878719117 domain: Introduce virDomainIOThreadsPin{Add|Del}
https://bugzilla.redhat.com/show_bug.cgi?id=1135491

More or less a virtual copy of the existing virDomainVcpuPin{Add|Del} API's.

NB: The IOThreads implementation "reused" the virDomainVcpuPinDefPtr
since it provided everything necessary - an "id" and a "map" for each
thread id configured.
2015-03-11 12:23:33 -04:00
John Ferlan
d8977b8ea3 remote: Implement the plumbing for virDomainPinIOThread
Implement the remote plumbing.
2015-03-11 12:23:33 -04:00
John Ferlan
71b234ce68 Implement public API for virDomainPinIOThread
Add virDomainPinIOThread to allow setting the CPU affinity for a specific
IOThread based on the output generated from virDomainGetIOThreadsInfo

The API supports updating both the --live domain and the --config data
2015-03-11 12:23:33 -04:00
Michal Privoznik
68818dcdd5 virNetworkObjFindBy*: Return an reference to found object
This patch turns both virNetworkObjFindByUUID() and
virNetworkObjFindByName() to return an referenced object so that
even if caller unlocks it, it's for sure that object won't
disappear meanwhile. Especially if the object (in general) is
locked and unlocked during the caller run.
Moreover, this commit is nicely small, since the object unrefing
can be done in virNetworkObjEndAPI().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-11 16:58:49 +01:00
Michal Privoznik
53881c70bc virNetworkObjListPtr: Make APIs self-locking
Every API that touches internal structure of the object must lock
the object first. Not every API that has the object as an
argument needs to do that though. Some APIs just pass the object
to lower layers which, however, must lock the object then. Look
at the code, you'll get my meaning soon.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-11 16:58:49 +01:00
Michal Privoznik
3aa3e072bd network_conf: Introduce locked versions of lookup functions
This is going to be needed later, when some functions already
have the virNetworkObjList object already locked and need to
lookup a object to work on. As an example of such function is
virNetworkAssignDef(). The other use case might be in
virNetworkObjListForEach() callback.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-11 16:58:48 +01:00
Michal Privoznik
52430928d1 virNetworkObjList: Derive from virObjectLockableClass
Later we can turn APIs to lock the object if needed instead of
relying on caller to mutually exclude itself (probably done by
locking a big lock anyway).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-11 16:58:48 +01:00
Michal Privoznik
5a84a07857 parallels_network: Use virNetworkObjEndAPI
So far, this is pure code replacement. But once we introduce
reference counting to virNetworkObj this will be more handy as
there'll be only one function to change: virNetworkObjEndAPI().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-11 16:58:48 +01:00
Michal Privoznik
107c9a561b test_driver: Use virNetworkObjEndAPI
So far, this is pure code replacement. But once we introduce
reference counting to virNetworkObj this will be more handy as
there'll be only one function to change: virNetworkObjEndAPI().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-11 16:58:48 +01:00
Michal Privoznik
37c2bad77d bridge_driver: Use virNetworkObjEndAPI
So far, this is pure code replacement. But once we introduce
reference counting to virNetworkObj this will be more handy as
there'll be only one function to change: virNetworkObjEndAPI().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-11 16:58:48 +01:00
Michal Privoznik
aa7c7f880e network_conf: Introduce virNetworkObjEndAPI
This is practically copy of qemuDomObjEndAPI. The reason why is
it so widely available is to avoid code duplication, since the
function is going to be called from our bridge driver, test
driver and parallels driver too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-11 16:58:48 +01:00
Michal Privoznik
ea57049156 network_conf: Make virNetworkObj actually virObject
So far it's just a structure which happens to have 'Obj' in its
name, but otherwise it not related to virObject at all. No
reference counting, not virObjectLock(), nothing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-11 16:58:48 +01:00
Michal Privoznik
8529d5ec6b virNetworkObjListPtr: Turn list into a hash table
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-11 16:58:48 +01:00
Peter Krempa
d3534a43e6 qemu: monitor: Kill qemuMonitorGetBlockStats(Info,ParamsNumber)
The functions and their QMP and HMP implementations are no longer needed
since everything is now done via the *AllStats functions.
2015-03-11 11:28:04 +01:00
Peter Krempa
3a83dcf43e test: qemu: json: Avoid using the now obsolete functions
Use the new single function instead of calling
qemuMonitorJSONGetBlockStatsInfo and
qemuMonitorJSONGetBlockStatsParamsNumber. This will allow to delete the
functions later while still maintaining coverage.
2015-03-11 11:28:04 +01:00
Peter Krempa
e045587dda qemu: blockstats: Refactor qemuDomainBlockStatsFlags
Now that qemuDomainBlocksStatsGather provides functions of both
qemuMonitorGetBlockStatsParamsNumber and qemuMonitorGetBlockStatsInfo we
can reuse it and kill a lot of code.

Additionally as a bonus qemuDomainBlockStatsFlags will now support
summary statistics so add a statement to the virsh man page about that.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1142636
2015-03-11 11:28:04 +01:00
Peter Krempa
cf093414c5 qemu: blockstats: Add support for totalled block statistics
In the LXC driver, if the disk path is not provided the API returns
total statistics for all disks of the domain. With the new text monitor
implementation this can be now done in the qemu driver too.

Add code that wil total the stats for all disks if the path is not
provided.
2015-03-11 11:28:04 +01:00
Peter Krempa
79966411cd qemu: Split out working code qemuDomainBlockStats
Extract the code to look up the disk alias and return the block stats
struct so that it can be reused later in qemuDomainBlockStatsFlags.

The function uses qemuMonitorGetAllBlockStatsInfo instead of
qemuMonitorGetBlockStatsInfo.
2015-03-11 11:28:04 +01:00
Peter Krempa
bdc05128d7 qemu: monitor: Count block stats fields in qemuMonitorGetAllBlockStatsInfo
Our virDomainBlockStatsFlags API uses the old approach where, when it's
called without the typed parameter array, returns the count of parameters
supported by qemu.

The supported parameter count is obtained via separate monitor calls
which is a waste since we can calculate it when gathering the data.

This patch adds code to the qemuMonitorGetAllBlockStatsInfo workers that
allows to track the count of supported fields reported by qemu and will
allow to remove the old duplicate code.
2015-03-11 11:28:04 +01:00
Peter Krempa
4d8ebb7a35 qemu: monitor: Convert common code to a macro
The function that is extracting block stats data from the QMP monitor
reply contains a lot of repeated code. Since I'd be changing each of the
copies in the next patch, lets convert it to a macro right away.
2015-03-11 11:28:04 +01:00
Peter Krempa
f6563bc361 qemu: monitor: Implement HMP version for listing all block device stats
Add a different version of parser for "info blockstats" that basically
parses the same information as the existing copy of the function.

This will allow us to remove the single device version
qemuMonitorGetBlockStatsInfo in the future.

The new implementation uses few new helpers so it should be more
understandable and provides a test case to verify that it works.
2015-03-11 11:28:04 +01:00
Peter Krempa
fc4713454d test: qemu: Fix qemu monitor test utils to allow testing HMP
qemu HMP commands sent by libvirt are terminated just by a '\r'. The
fake monitor used in tests wasn't prepared to handle this and the
communication would hang on an attempt to do a HMP conversation.

Add a special case for handling commands separated by \r in case HMP is
used.
2015-03-11 11:28:03 +01:00
Peter Krempa
4f6b6788c4 qemu: blockstats: Switch to caller allocated hash table
Allocate the hash table in the monitor wrapper function instead of the
worker itself so that the text monitor impl that will be added in the
next patch doesn't have to duplicate it.
2015-03-11 11:28:03 +01:00