Commit Graph

20191 Commits

Author SHA1 Message Date
Andrea Bolognani
28616e8e70 tests: Add subcores2 nodeinfo test
This makes sure CPUs are counted correctly when some of the cores are
completely offline.
2015-08-03 08:38:47 -04:00
Andrea Bolognani
ad43a09cba tests: Add subcores1 nodeinfo test
This makes sure CPUs are counted correctly when using the default
configuration, that is, all primary threads are online and all
secondary threads are offline.
2015-08-03 08:38:47 -04:00
Shivaprasad G Bhat
3020f550ca tests: Prepare for subcore tests
The nodeGetThreadsPerSubcore() function is mocked to return 8 for
ppc64 tests, which corresponds to the default subcore mode.

Update the expected output for the deconfigured-cpus nodeinfo
test to account for this change.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2015-08-03 08:38:46 -04:00
Shivaprasad G Bhat
014208c4d0 nodeinfo: Fix output on PPC64 KVM hosts
The nodeinfo is reporting incorrect number of cpus and incorrect host
topology on PPC64 KVM hosts. The KVM hypervisor on PPC64 needs only
the primary thread in a core to be online, and the secondaries offlined.
While scheduling a guest in, the kvm scheduler wakes up the secondaries to
run in guest context.

The host scheduling of the guests happen at the core level(as only primary
thread is online). The kvm scheduler exploits as many threads of the core
as needed by guest. Further, starting POWER8, the processor allows splitting
a physical core into multiple subcores with 2 or 4 threads each. Again, only
the primary thread in a subcore is online in the host. The KVM-PPC
scheduler allows guests to exploit all the offline threads in the subcore,
by bringing them online when needed.
(Kernel patches on split-core http://www.spinics.net/lists/kvm-ppc/msg09121.html)

Recently with dynamic micro-threading changes in ppc-kvm, makes sure
to utilize all the offline cpus across guests, and across guests with
different cpu topologies.
(https://www.mail-archive.com/kvm@vger.kernel.org/msg115978.html)

Since the offline cpus are brought online in the guest context, it is safe
to count them as online. Nodeinfo today discounts these offline cpus from
cpu count/topology calclulation, and the nodeinfo output is not of any help
and the host appears overcommited when it is actually not.

The patch carefully counts those offline threads whose primary threads are
online. The host topology displayed by the nodeinfo is also fixed when the
host is in valid kvm state.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2015-08-03 08:38:46 -04:00
Ossi Herrala
d9c9e138f2 rpc: Fix slow volume download (virsh vol-download)
Use I/O vector (iovec) instead of one huge memory buffer as suggested
in https://bugzilla.redhat.com/show_bug.cgi?id=1026137#c7. This avoids
doing memmove() to big buffers and performance doesn't degrade if
source (virNetClientStreamQueuePacket()) is faster than sink
(virNetClientStreamRecvPacket()).

Resolves: http://bugzilla.redhat.com/1026137

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-08-03 13:08:00 +02:00
Cao jin
e7fef6d00e There is no virDomainFindBy{ID, Name, UUID} anymore
s/virDomainFindBy/virDomainObjListFindBy/

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
2015-08-03 13:08:00 +02:00
Luyao Huang
1439eb32af qemu: fix some api cannot work when disable cpuset in conf
If cpuset is disabled or not available, it libvirt must not use it.
Mainly for actions that do not need it and can use sched_setaffinity()
or numa_membind() instead, because they will fail without good reason.

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

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-08-03 13:08:00 +02:00
Martin Kletzander
b1632f8f40 Post-release version bump to 1.2.19
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-08-03 13:07:59 +02:00
Daniel Veillard
bd311d3a8a Fix a trailing space in spec file 2015-08-03 17:43:34 +08:00
Daniel Veillard
bcfdd8e836 Release of libvirt-1.2.18
* docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: regenerated
2015-08-03 17:36:39 +08:00
Jiri Denemark
e8d0166e1d qemu: Do not reset labels when migration fails
When stopping a domain on the destination host after a failed migration,
we need to avoid reseting security labels since the domain is still
running on the source host. While we were correctly doing so in some
cases, there were still some paths which did this wrong.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-07-31 15:15:12 +02:00
Jiri Denemark
40a6dd9c16 qemu: Properly check for incoming migration job
In addition to checking the current asynchronous job
qemuMigrationJobIsActive reports an error if the current job does not
match the one we asked for. Let's just check the job directly since we
are not interested in the error in qemuProcessHandleMonitorEOF.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-07-31 15:15:12 +02:00
Peter Krempa
136f3de411 qemu: Reject migration with memory-hotplug if destination doesn't support it
If destination libvirt doesn't support memory hotplug since all the
support was introduced by adding new elements the destination would
attempt to start qemu with an invalid configuration. The worse part is
that qemu might hang in such situation.

Fix this by sending a required migration feature called 'memory-hotplug'
to the destination. If the destination doesn't recognize it it will fail
the migration.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1248350
2015-07-30 16:44:02 +02:00
Cédric Bosdonnat
e5e8406e9c Fix syntax-check: missing "%s" 2015-07-30 11:10:48 +02:00
Cédric Bosdonnat
0aedcbd37c Load nbd module before running qemu-nbd
So far qemu-nbd is run even if the nbd kernel module isn't loaded. This
leads to errors when the user starts his lxc container while libvirt
could easily load the nbd module automatically.
2015-07-30 09:55:37 +02:00
Erik Skultety
b2960501c7 qemu: Adjust VM id allocation
Our atomic increment (virAtomicIntInc) uses (if available) gcc
__sync_add_and_fetch builtin. In qemu driver though, we'd profit more
from __sync_fetch_and_add builtin. To keep it simplistic, this patch
adjusts qemu driver initialization rather than adding a new atomic
increment macro.
2015-07-29 09:15:44 +02:00
Peter Krempa
dbb0baa5a7 lxc: Don't accidentaly reset autostart flag in virLXCProcessCleanup
virDomainDeleteConfig is meant to delete the persistent config and thus
it resets vm->autostart. Copy parts of qemuProcessRemoveDomainStatus to
a new helper to avoid using the incorrect function.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1230071
2015-07-28 18:55:39 +02:00
Daniel P. Berrange
afe69e6582 remote: fix typo in remoteDomainOpenGraphicsFD
The remoteDomainOpenGraphicsFD method was using the wrong RPC
arg struct remote_domain_open_graphics_args instead of
remote_domain_open_graphics_fd_args. Fortunately both structs
had identical contents so there was no functional bug, but to
avoid confusing future maintainers, we should fix it.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-07-27 12:53:36 +01:00
Martin Kletzander
7868f01783 admin: Tiny cleanups
First hunk changes the use of srcdir to top_srcdir so it complies with
other rules in the Makefile.  Second one removes the need of
remote_protocol.h in admin_protocol.h as it was suggested and worked in,
but this one line was missed apparently.  Last one just removes the
'remote' naming from admin protocol specification, just so it's cleaner.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-07-27 09:33:24 +02:00
Martin Kletzander
ba167186cf qemu: Check for iotune_max support properly
Commit d506a51aeb meant to check for
QEMU_CAPS_DRIVE_IOTUNE_MAX, but checked for QEMU_CAPS_DRIVE_IOTUNE
instead.  That's clearly visible from the diff, but it got in.  Because
of that, we were supplying information unknown for QEMU if it wasn't new
enough and we couldn't even properly handle the error, leading to
"Unexpected error".  Also iops_size came at the same time with all the
other "_max" options, so check whether we're not setting that either if
QEMU_CAPS_DRIVE_IOTUNE_MAX is not supported.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-07-27 08:29:37 +02:00
Martin Kletzander
54965743e2 tests: Finish rename of the long nodeinfo test case
Commit 2094d01e2f forgot to rename two
more files.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-07-27 08:22:24 +02:00
Daniel Veillard
2094d01e2f Renamed deconfigured-cpus to allow make dist
Simplest was just to rename that extra long name and move files in git
accordingly
2015-07-27 10:17:05 +08:00
Laine Stump
e143107240 conf: add virDomainControllerDefNew()
There are some non-0 default values in virDomainControllerDef (and
will soon be more) that are easier to not forget if the remembering is
done by a single initializer function (rather than inline code after
allocating the obejct with generic VIR_ALLOC().
2015-07-25 10:10:31 -04:00
Laine Stump
0726878297 qemu: reorganize loop in qemuDomainAssignPCIAddresses
This loop occurs just after we've assured that all devices that
require a PCI device have been assigned and all necessary PCI
controllers have been added. It is the perfect place to add other
potentially auto-generated PCI controller attributes that are
dependent on the controller's PCI address (upcoming patch).

There is a convenient loop through all controllers at the end of the
function, but the patch to add new functionality will be cleaner if we
first rearrange that loop a bit.

Note that the loop originally was accessing info.addr.pci.bus prior to
determining that the pci part of the object was valid. This isn't
dangerous in any way, but seemed a bit ugly, so I fixed it.
2015-07-25 10:10:22 -04:00
Laine Stump
d4cf72af17 conf: pay attention to bus minSlot/maxSlot when autoassigning PCI addresses
The function that auto-assigns PCI addresses was written with the
hardcoded assumptions that any PCI bus would have slots available
starting at 1 and ending at 31. This isn't true for many types of
controllers (some have a single slot/port at 0, some have slots/ports
from 0 to 31). This patch updates that function to remove the
hardcoded assumptions. It will properly find/assign addresses for
devices that can only connect to pcie-(root|downstream)-port (which
have minSlot/maxSlot of 0/0) or a pcie-switch-upstream-port (0/31).

It still will not auto-create a new bus of the proper kind for these
connections when one doesn't exist, that task is for another day.
2015-07-25 10:08:03 -04:00
Chris J Arges
be6c35e4ac tests: add vol-qcow2-zerocapacity test to storagevolxml2argvtest
Add a testcase for the previous change to ensure zero capacity volumes can be
defined without a backing store.

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
2015-07-24 11:23:45 -04:00
Chris J Arges
c6eea54008 storage: allow zero capacity with non-backing file to be created
In commit 155ca616e, a change was introduced that no longer allowed defining
volumes via XML with a capacity of '0'. Because we check for info.size_arg
to be non-zero, this use-case fails. This patch allows info.size_arg to be
zero if no backing store is specified.

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
2015-07-24 11:22:20 -04:00
John Ferlan
136f17efd1 nodeinfo: Check for SYSFS_INFINIBAND_DIR before open
Commit id 'ac3ed2085' causes 'virsh nodedev-list --cap net' to fail
on any system without SYSFS_INFINIBAND_DIR (/sys/class/infiniband).

Rather than assume it's there and fail on the attempt to open the
non-existent directory, check if it's there - if not, return
success and move on. Also fix caller to check < 0 upon return.

As reported by Suren Hajyan <shajyan@redhat.com> from run of unit tests
2015-07-24 09:41:06 -04:00
Cao jin
c1c5eb6fad fix typo in qemu_monitor
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
2015-07-24 14:29:34 +02:00
Martin Kletzander
a5bdb8459a Revert "qemu: Use heads parameter for QXL driver"
This reverts commit 7b401c3bda.

Until libvirt is able to differentiate whether heads='1' is just a
leftover from previous libvirt or whether that's added by user on
purpose and also whether the domain was started with the support for
qxl's max_outputs, we cannot incorporate this patch into the tree
due to compatibility reasons.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-07-24 13:06:47 +02:00
Luyao Huang
b70b5ff41a test: introduce a function in test driver to check get vcpupin info
As there is a regression in use vcpupin get info, introduce a new function
to test the virsh client.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-07-24 06:49:54 -04:00
Laine Stump
03b6bdcab3 conf: reorganize virNetworkDHCPDefParseXML
This makes the range and static host array management in
virNetworkDHCPDefParseXML() more similar to what is done in
virNetworkDefUpdateIPDHCPRange() and virNetworkDefUpdateIPDHCPHost() -
they use VIR_APPEND_ELEMENT rather than a combination of
VIR_REALLOC_N() and separate incrementing of the array size.

The one functional change here is that a memory leak of the contents
of the last (unsuccessful) virNetworkDHCPHostDef was previously leaked
in certain failure conditions, but it is now properly cleaned up.
2015-07-23 16:38:08 -04:00
Andrea Bolognani
f86c45ca0c nodeinfo: Check for errors when reading core_id 2015-07-23 12:01:19 +02:00
Roman Bogorodskiy
5965c4f3e2 docs: bhyve: document clock configuration 2015-07-22 19:30:56 +03:00
Roman Bogorodskiy
6cb9ef1bab bhyve: add UTC clock support
Bhyve as of r279225 (FreeBSD -CURRENT) or r284894 (FreeBSD 10-STABLE)
supports using UTC time offset via the '-u' argument to bhyve(8). By
default it's still using localtime.

Make the bhyve driver use UTC clock if it's requested by specifying
<clock offset='utc'> in domain XML and if the bhyve(8) binary supports
the '-u' flag.
2015-07-22 19:05:09 +03:00
Roman Bogorodskiy
830344d6e7 netdev: fix build on FreeBSD
Commit ac3ed20 breaks build on FreeBSD with:

  CC       util/libvirt_util_la-virnetdev.lo
util/virnetdev.c:2967:1: error: unused function 'virNetDevRDMAFeature' [-Werror,-Wunused-function]
virNetDevRDMAFeature(const char *ifname,
^

So hide virNetDevRDMAFeature function under the #ifdef 'SIOCETHTOOL'
and 'HAVE_STRUCT_IFREQ' section.

Pushed under the build breaker rule.
2015-07-22 18:37:00 +03:00
Daniel P. Berrange
a92bb087b3 configure: clarify rationale for checking pkcheck
We don't need pkcheck binary, but we must detect it in order
to see if we're preferring polkit-1 over polkit-0 when both
are installed. We should also check $with_dbus to see if we
have dbus-devel available, as that's required to talk to
polkit-1.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-07-22 10:50:49 +01:00
Luyao Huang
704cf06a14 qemu: fix the error cover issue in SetMemoryParameters
https://bugzilla.redhat.com/show_bug.cgi?id=1245476

We won't return the errno after commit 0d7f45ae, and
the more clearly error will be set in the code in vircgroup*.
Also We will always report error "Operation not permitted",
because the return is -1.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-07-22 11:02:17 +02:00
Andrea Bolognani
6395ec1cf0 nodeinfo: Calculate present and online CPUs only once
Move the calls to the respective functions from virNodeParseNode(),
which is executed once for every NUMA node, to
linuxNodeInfoCPUPopulate(), which is executed just once per host.
2015-07-22 10:50:53 +02:00
Andrea Bolognani
05be606282 nodeinfo: Use a bitmap to keep track of node CPUs
Keep track of what CPUs belong to the current node while walking
through the sysfs node entry, so we don't need to do it a second
time immediately afterwards.

This also allows us to loop through all CPUs that are part of a
node in guaranteed ascending order, which is something that is
required for some upcoming changes.
2015-07-22 10:37:25 +02:00
Andrea Bolognani
b909e9fb2c nodeinfo: Use nodeGetOnlineCPUBitmap() when parsing node
No need to look up the online status of each CPU separately when we
can get all the information in one go.
2015-07-22 10:37:20 +02:00
Andrea Bolognani
b7b506475c nodeinfo: Phase out cpu_set_t usage
Swap out all instances of cpu_set_t and replace them with virBitmap,
which some of the code was already using anyway.

The changes are pretty mechanical, with one notable exception: an
assumption has been added on the max value we can run into while
reading either socket_it or core_id.

While this specific assumption was not in place before, we were
using cpu_set_t improperly by not making sure not to set any bit
past CPU_SETSIZE or explicitly allocating bigger bitmaps; in fact
the default size of a cpu_set_t, 1024, is way too low to run our
testsuite, which includes core_id values in the 2000s.
2015-07-22 10:14:02 +02:00
Andrea Bolognani
c1df42d734 nodeinfo: Rename nodeGetCPUBitmap() to nodeGetOnlineCPUBitmap()
The new name makes it clear that the returned bitmap contains the
information about which CPUs are online, not eg. which CPUs are
present.

No behavioral change.
2015-07-22 10:14:02 +02:00
Andrea Bolognani
ccd0ea7ef5 nodeinfo: Remove out parameter from nodeGetCPUBitmap()
Not all users of this API will need the size of the returned
bitmap; those who do can simply call virBitmapSize() themselves.
2015-07-22 10:14:01 +02:00
Andrea Bolognani
37f73e4ad5 nodeinfo: Add old kernel compatibility to nodeGetPresentCPUBitmap()
If the cpu/present file is not available, we assume that the kernel
is too old to support non-consecutive CPU ids and return a bitmap
with all the bits set to represent this fact. This assumption is
already exploited in nodeGetCPUCount().

This means users of this API can expect the information to always
be available unless an error has occurred, and no longer need to
treat the NULL return value as a special case.

The error message has been updated as well.
2015-07-22 10:14:01 +02:00
Andrea Bolognani
a2e2add1f1 nodeinfo: Rename linuxParseCPUmax() to linuxParseCPUCount()
The original name was confusing because the function returns the number
of CPUs, not the maximum CPU id. The comment above the function has
been updated to reflect this.

No behavioral changes.
2015-07-22 10:14:01 +02:00
Andrea Bolognani
6fecc4017d nodeinfo: Introduce linuxGetCPUOnlinePath() 2015-07-22 10:14:01 +02:00
Andrea Bolognani
bd87f07c25 nodeinfo: Introduce linuxGetCPUGlobalPath()
This is just a more generic version of linuxGetCPUPresentPath(),
which is now implemented by calling the new function appropriately.
2015-07-22 10:14:01 +02:00
Andrea Bolognani
2a6801892a nodeinfo: Fix nodeGetCPUBitmap()'s fallback code path
During the recent refactoring/cleanups, a bug has been introduced
that caused all CPUs to be reported as online unless the sysfs
cpu/present file was available.

This commit fixes the fallback code path by building the directory
path passed to virNodeGetCpuValue() correctly.
2015-07-22 09:57:57 +02:00
Andrea Bolognani
c30ae1864f nodeinfo: Add nodeGetPresentCPUBitmap() to libvirt_private.syms 2015-07-22 09:57:57 +02:00