Commit Graph

20128 Commits

Author SHA1 Message Date
Peter Krempa
42c9c6fcfc virsh: blockjob: Split out vshBlockJobSetSpeed from blockJobImpl 2015-07-21 15:32:58 +02:00
Peter Krempa
2f12cb9355 virsh: cmdBlockJob: Switch to declarative flag interlocking
Use the VSH_EXCLUSIVE_OPTIONS_VAR to interlock incompatible options.
Since a variable named 'abort' would conflict with older compilers use
VSH_EXCLUSIVE_OPTIONS for the --abort option.
2015-07-21 15:32:58 +02:00
Peter Krempa
dda95b531f virsh: blockjob: Extract block job info code into a separate function
cmdBlockJob will be converted to a hub that will call into the
individual executor functions.
2015-07-21 15:32:58 +02:00
Moshe Levi
ac3ed2085f nodedev: add RDMA and tx-udp_tnl-segmentation NIC capabilities
Adding functionality to libvirt that will allow
it query the interface for the availability of RDMA and
tx-udp_tnl-segmentation Offloading NIC capabilities

Here is an example of the feature XML definition:

<device>
<name>net_eth4_90_e2_ba_5e_a5_45</name>
  <path>/sys/devices/pci0000:00/0000:00:03.0/0000:08:00.1/net/eth4</path>
  <parent>pci_0000_08_00_1</parent>
  <capability type='net'>
    <interface>eth4</interface>
    <address>90:e2:ba:5e:a5:45</address>
    <link speed='10000' state='up'/>
    <feature name='rx'/>
    <feature name='tx'/>
    <feature name='sg'/>
    <feature name='tso'/>
    <feature name='gso'/>
    <feature name='gro'/>
    <feature name='rxvlan'/>
    <feature name='txvlan'/>
    <feature name='rxhash'/>
    <feature name='rdma'/>
    <feature name='txudptnl'/>
    <capability type='80203'/>
  </capability>
</device>
2015-07-21 07:08:35 -04:00
Roman Bogorodskiy
e46791e003 nodeinfo: fix build on FreeBSD
Currently, build fails on FreeBSD with:

  CC       libvirt_driver_la-nodeinfo.lo
nodeinfo.c:1941:56: error: use of undeclared identifier 'SYSFS_SYSTEM_PATH'
    const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SYSTEM_PATH;
                                                       ^
1 error generated.

This is caused by commit b97b3048 that added sysfs_prefix to
nodeCapsInitNUMA and used SYSFS_CPU_PATH.

Fix it by unconditionally defining SYSFS_CPU_PATH instead of defining it
under #ifdef __linux__.
2015-07-20 14:01:49 +03:00
Martin Kletzander
717c99f360 qemu: Reject updating unsupported disk information
If one calls update-device with information that is not updatable,
libvirt reports success even though no data were updated.  The example
used in the bug linked below uses updating device with <boot order='2'/>
which, in my opinion, is a valid thing to request from user's
perspective.  Mainly since we properly error out if user wants to update
such data on a network device for example.

And since there are many things that might happen (update-device on disk
basically knows just how to change removable media), check for what's
changing and moreover, since the function might be usable in other
drivers (updating only disk path is a valid possibility) let's abstract
it for any two disks.

We can't possibly check for everything since for many fields our code
does not properly differentiate between default and unspecified values.
Even though this could be changed, I don't feel like it's worth the
complexity so it's not the aim of this patch.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1007228
2015-07-20 11:35:54 +02:00
Martin Kletzander
0aa81bbdc3 Escape left brace as new perl suggests
After upgrade to perl-5.22.0, it started complaining about one of our
scripts.  The thing is that even though it works, it wants all curly
brackets escaped properly.  The change is not functional, it merely gets
rid of the following error:

  Unescaped left brace in regex is deprecated, passed through in regex;
  marked by <-- HERE in m/^enum { <-- HERE / at -e line 3.

There is one more error like this that I'm getting, but it is because of
GNU automake bug #21001:

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21001

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-07-20 10:35:18 +02:00
Frediano Ziglio
7b401c3bda qemu: Use heads parameter for QXL driver
Allows to specify maximum number of head to QXL driver.

Actually can be a compatiblity problem as heads in the XML configuration
was set by default to '1'.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-20 10:35:18 +02:00
Christophe Fergeau
60d5ed8c52 storage: Fix pool building when directory already exists
Currently, when trying to virsh pool-define/virsh pool-build a new
'dir' pool, if the target directory already exists, virsh
pool-build/virStoragePoolBuild will error out. This is a change of
behaviour compared to eg libvirt 1.2.13

This is caused by the wrong type being used for the dir_create_flags
variable in virStorageBackendFileSystemBuild , it's defined as a bool
but is used as a flag bit field so should be unsigned int (this matches
the type virDirCreate expects for this variable).

This should fix https://bugzilla.gnome.org/show_bug.cgi?id=752417 (GNOME
Boxes) and https://bugzilla.redhat.com/show_bug.cgi?id=1244080
(downstream virt-manager).
2015-07-17 15:24:18 +02:00
Daniel P. Berrange
406ee8c226 rpc: ensure daemon is spawn even if dead socket exists
The auto-spawn code would originally attempt to spawn the
daemon for both ENOENT and ECONNREFUSED errors from connect().
The various refactorings eventually lost this so we only
spawn the daemon on ENOENT. The result is if the daemon exits
uncleanly, so that the socket is left in the filesystem, we
will never be able to auto-spawn the daemon again.
2015-07-17 12:46:43 +01:00
Michal Privoznik
54012746ae viraccessperm.h: Fix some typos
Like s/authoriation/authorization/ and s/requries/requires/

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-07-17 09:41:31 +02:00
Martin Kletzander
b84a2cd87d docs: Document how libvirt handles companion controllers
The information on companion controllers we give in our documentation is
rather sparse.  For example, it looks like any controller can be used as
a companion one.  Also, when using ich9-uhci2, for example, we are able
to set some sensible defaults, but it might get confusing for the user
as we don't do that for all controller models.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-07-17 09:17:36 +02:00
John Ferlan
279238fea3 rbd: Return error from rbd_create for message processing
Resolving an error reporting bug introduced by commit id '761491e' which
just took the return of virStorageBackendRBDCreateImage and used it as
the basis for the message generated. This would generate EPERM regardless
of error seen.
2015-07-16 12:31:25 -04:00
Wido den Hollander
045cac32fd rbd: Use RBD format 2 by default when creating images.
We used to look at the librbd code version and depending on that
we would invoke rbd_create3() or rbd_create().

Since librbd version 0.67.9 we can however tell RBD that it should
create rbd format 2 images even if we invoke rbd_create().

The less options we pass to librbd, the more we can lean on the sane
defaults it uses.

For rbd_create3() we had things like the stripe count and unit hardcoded
in libvirt and that might cause problems down the road.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
2015-07-16 12:31:20 -04:00
Martin Kletzander
0f49f1dc6f virsh: Don't output node frequency if unknown
Commit ed8155eafb documented that
mhz field in virNodeInfo might be 0 if the frequency is unknown.  Modify
virsh to know about that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-07-16 11:56:15 +02:00
Boris Fiuczynski
35e3fb50ee qemu: Test for virtio-9p-ccw support
This patch adds a test for the qemu command line generation.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@us.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
2015-07-15 14:37:30 +02:00
Boris Fiuczynski
d01b7c7854 qemu: Make virtio-9p-ccw the default for s390-ccw-virtio machines
For s390-ccw-virtio machines the default bus type is set to ccw.
Specifing an address element allows to override the default.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@us.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
2015-07-15 14:37:30 +02:00
Boris Fiuczynski
56f6de93b5 qemu: Support for virtio-9p-ccw
Adding the recently in qemu added 9pfs support for virtio-ccw.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@us.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
2015-07-15 14:37:30 +02:00
Michal Privoznik
54997a4d0a daemonRunStateInit: Fix a typo on a comment
s/priviledged/privileged/

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-07-15 14:25:30 +02:00
Michal Privoznik
f69ece073e virsh: Teach cmdFreepages to work with lxc driver
Some drivers don't expose available huge page sizes in the
capabilities XML. For instance, LXC driver is one of those.
This has a downside that when virsh is trying to get
aggregated info on free pages per all NUMA nodes, it fails.
The problem is that the virNodeGetFreePages() API expects
caller to pass an array of page sizes he is interested in.
In virsh, this array is filled from the capabilities from
'/capabilities/host/cpu/pages' XPath. As said, in LXC
there's no such XPath and therefore virsh fails currently.
But hey, we can fallback: the page sizes are exposed under
'/capabilities/host/topology/cells/cell/pages'. The page
size can be collected from there, and voilà the command
works again. But now we must make sure that there are no
duplicates in the array passed to the public API. Otherwise
we won't get as beautiful output as we are getting now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-07-15 11:48:14 +02:00
Michal Privoznik
416d0e9418 cmdVcpuPin: Remove dead code
There's this condition:

flags & VIR_DOMAIN_AFFECT_CURRENT && virDomainIsActive(dom)

which can never be true since VIR_DOMAIN_AFFECT_CURRENT has hardcoded
value of zero. Therefore virDomainIsActive() is a dead code. However,
the condition could make sense if it is rewritten as the following:

!(flags & VIR_DOMAIN_AFFECT_CONFIG) && virDomainIsActive(dom)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-07-15 11:40:41 +02:00
Michal Privoznik
cd043390ff qemuMigrationRun: Don't leak @fd
If we are migrating to an UNIX socket, we accept() a connection
from qemu and use that FD to set up a tunnel. However, the FD is
not closed as often as it should be.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-07-15 11:40:41 +02:00
Cédric Bosdonnat
4749fec10d lxc: wait for nbd device to be up to get its PIDs
The nbd device pid file doesn't appear immediately after starting
qemu-nbd: adding a small loop to wait for it before getting it's
processes PIDs.
2015-07-15 10:16:15 +02:00
Cédric Bosdonnat
8dd8df6f7c Fix qemu-nbd cleanup crashes
The virLXCControllerAppendNBDPids function didn't properly initialize
pids and npids. In case of failure it was crashing when freeing those.
2015-07-15 10:16:14 +02:00
Andrea Bolognani
aa6c3fee86 nodeinfo: Formatting changes 2015-07-14 17:11:36 -04:00
Andrea Bolognani
75f6f54546 nodeinfo: Make sysfs_prefix usage more consistent
Make sure sysfs_prefix, when present, is always the first argument
to a function; don't use a different name to refer to it; check
whether it is NULL, and hence SYSFS_SYSTEM_PATH should be used, only
when using it directly and not just passing it down to another
function; always pass down the same value we've been passed when
calling another function.
2015-07-14 17:11:36 -04:00
Peter Krempa
c212e0c779 qemu: process: Improve update of maximum balloon state at startup
In commit 641a145d73 I've added code that
resets the balloon memory value to full size prior to resuming the vCPUs
since the size certainly was not reduced at that point.

Since qemuProcessStart is used also in code paths with already booted
up guests (migration, save/restore) the assumption is not entirely true
since the guest might already been running before.

This patch adds a function that queries the monitor rather than using
the full size since a balloon event would not be reissued in case we are
recovering a saved migration state.

Additionally the new function is used also when reconnecting to a VM
after libvirtd restart since we might have missed a few balloon events
while libvirtd was not running.
2015-07-14 14:47:57 +02:00
Michal Privoznik
1cf25f6334 qemuDomainSetNumaParamsLive: Check for NUMA mode more wisely
https://bugzilla.redhat.com/show_bug.cgi?id=1232663

In one of my previous ptaches (bcd9a564) I've tried to fix the problem
that we blindly assumed strict NUMA mode for guests. This led to
several problems like us pinning a domain onto a nodeset via libnuma
among with CGroups. Once the nodeset was changed by user, well, it did
not result in desired effect. See the original commit for more info.
But, the commit I wrote had a bug: when NUMA parameters are changed on
a running domain we require domain to be strictly pinned onto a
nodeset. Due to a typo a condition was mis-evaluated.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-07-14 10:29:19 +02:00
Martin Kletzander
0e3ad241f3 network: Add another collision check into networkCheckRouteCollision
The comment above that function says: "This function can be a lot more
exhaustive, ...", so let's be.

Check for collisions between routes in the system and static routes
being added explicitly from the <route/> element of the network XML.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-07-14 09:56:44 +02:00
Martin Kletzander
0f10eb6a28 conf: Add getter for network routes
Add virNetworkDefGetRouteByIndex() similarly to
virNetworkDefGetIpByIndex(), but for routes.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-07-14 08:04:49 +02:00
Andrea Bolognani
f8b784a8ef tests: Add nodeinfo test for non-present CPUs
Some of the possible CPUs in a system might not be present, eg. they
might be defective or might have been deconfigured from the ASM console
in a Power system. Due to this fact, Linux keeps track of what CPUs are
possible and what are present separately.

This test uses the data from a system where not all the possible CPUs
are present to make sure libvirt handles this situation correctly.
2015-07-13 16:07:44 -04:00
Kothapally Madhu Pavan
bb31f4532b nodeinfo: fix to parse present cpus rather than possible cpus
This patch resolves a situation where a core is defective and is not
in the present mask during boot. Optionally a host can have empty sockets
could be brought online if the socket is added. In this case the present
mask contains the cpu's that are actually there in the sockets even though
they might be offline for some reason. This patch excludes the cpu's that
are offline because the socket is defective/empty by checking the present
mask before reading the cpu directory. Otherwise, the nodeinfo on such
hosts always displays wrong output which includes the defective/empty
sockets as set of offline cpu's.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
2015-07-13 16:07:44 -04:00
John Ferlan
c71f0654fc nodeinfo: Add sysfs_prefix to nodeGetMemoryStats
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_SYSTEM_PATH.
2015-07-13 15:59:32 -04:00
John Ferlan
b97b30480d nodeinfo: Add sysfs_prefix to nodeCapsInitNUMA
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_CPU_PATH which is a
derivative of SYSFS_SYSTEM_PATH

Use cpupath for nodeCapsInitNUMAFake and remove SYSFS_CPU_PATH
2015-07-13 15:59:32 -04:00
John Ferlan
29e4f2243f nodeinfo: Add sysfs_prefix to nodeGetInfo
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_SYSTEM_PATH.
2015-07-13 15:59:32 -04:00
John Ferlan
f1c6179f0d nodeinfo: Add sysfs_prefix to nodeGetCPUMap
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_SYSTEM_PATH.
2015-07-13 15:59:32 -04:00
John Ferlan
f220a3e5a8 nodeinfo: Add sysfs_prefix to nodeGetCPUBitmap
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_SYSTEM_PATH.
2015-07-13 15:59:32 -04:00
John Ferlan
51281dcb90 nodeinfo: Add sysfs_prefix to nodeGetPresentCPUBitmap
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_SYSTEM_PATH.
2015-07-13 15:59:32 -04:00
John Ferlan
f1a43a0f91 nodeinfo: Add sysfs_prefix to nodeGetCPUCount
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_SYSTEM_PATH.
2015-07-13 15:59:32 -04:00
John Ferlan
3119e05e26 nodeinfo: Introduce local linuxGetCPUPresentPath
The API will print the path to the /cpu/present file using the sysfs_prefix.

NB: This is setup for future patches which will allow local/test sysfs paths.
2015-07-13 15:59:32 -04:00
Michal Privoznik
541a99cc8a virt-driver-vz: Require parallels-7.0.22 at least
With the latest patch to the vz driver (7d73ca06ce) I was
getting some compilation errors. It turned out, my installation
of the parallels SDK was not as fresh as it could be. Parallels
installed in my system were missing the
PRL_USE_VNET_NAME_FOR_BRIDGE_NAME symbol which simply was not
introduced at the time I was installing the SDK. The symbol was
introduced in 86e62a5d which was then part of the 7.0.22 release.
Require that version at least therefore.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-07-13 19:46:10 +03:00
Michal Privoznik
09040915c5 configure: Move Virtuozzo checks to a specific module
Eventually, every driver will be moved to a special module.
But for today the winner is Virtuozzo driver.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-07-13 19:46:10 +03:00
Michal Privoznik
45cc2fca5c qemuProcessHandleMigrationStatus: Update migration status more frequently
After Jirka's migration patches libvirt is listening on migration
events from qemu instead of actively polling on the monitor. There is,
however, a little regression (introduced in 6d2edb6a42). The
problem is, the current status of migration job is updated in
qemuProcessHandleMigrationStatus if and only if migration job was
started. But eventually every asynchronous job may result in
migration. Therefore, since this job is not strictly a
migration job, internal state was not updated and later checks failed:

  virsh # save fedora22 /tmp/fedora22_ble.save
  error: Failed to save domain fedora22 to /tmp/fedora22_ble.save
  error: operation failed: domain save job: is not active

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-07-13 15:07:12 +02:00
Jim Fehlig
4ffb21c89a libxl: set dom0 state to running
Commit 45697fe5 added dom0 to driver->domains, but missed
setting its state to 'running'

$ virsh list
 Id    Name                           State
----------------------------------------------------
 0     Domain-0                       shut off
2015-07-10 11:36:57 -06:00
Dmitry Guryanov
f6d908a2f3 vz: fix cleanup of nets of bridged type
We create a virtual network of special type, which
has the same name as bridge name to create bridged
network adapter in vz. So when we delete such an
adapter we have to remove corresponding virtual
network.

So let's rename prlsdkDelNet to prlsdkCleanupBridgedNet
and don't check for return value.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2015-07-10 16:37:57 +03:00
Jiri Denemark
2e7cea2435 qemu: Use error from Finish instead of "unexpectedly failed"
When QEMU exits on destination during migration, the source reports
either success (if the failure happened at the very end) or unhelpful
"unexpectedly failed" error message. However, the Finish API called on
the destination may report a real error so let's use it instead of the
generic one.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-07-10 11:47:13 +02:00
Jiri Denemark
44c42b564d qemu: Don't report false error from MigrateFinish
virDomainMigrateFinish* APIs were unfortunately designed to return the
pointer to the domain on destination and NULL on error. This looks OK in
normal cases but the same API is also called when we know migration
failed and thus we expect Finish to return NULL even if it actually did
all it was supposed to do without any error. The call is defined to
return nonnull domain pointer over RPC, which means returning NULL will
always result in an error being send. If this was not in fact an error,
the API itself wouldn't set anything to the thread local virError, which
makes the RPC layer come up with it's own "Library function returned
error but did not set virError" error.

This is quite confusing and also hard to detect by the caller. This
patch adds a special error code which can be used to check that Finish
successfully aborted migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-07-10 11:47:13 +02:00
Jiri Denemark
e68f395fcb qemu: Remember incoming migration errors
If QEMU fails during incoming migration, the domain disappears including
a possibly useful error message read from QEMU log file. Let's remember
the error in virQEMUDriver so that Finish can report more than just "no
such domain".

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-07-10 11:47:13 +02:00
Jiri Denemark
9d0a2af6c2 Introduce virErrorCopyNew
A helper function for copying error objects.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-07-10 11:47:13 +02:00
Jiri Denemark
a7c22a1f29 Introduce virHashAtomic
This is a self-locking wrapper around virHashTable. Only a limited set
of APIs are implemented now (the ones which are used in the following
patch) as more can be added on demand.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-07-10 11:47:13 +02:00