]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agoconfigure: split common header and function checks
Ján Tomko [Tue, 25 Sep 2018 13:49:33 +0000 (15:49 +0200)]
configure: split common header and function checks

Use one line per entry, to work better with line-based git history.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoPost-release version bump to 4.9.0
Ján Tomko [Wed, 26 Sep 2018 13:25:09 +0000 (15:25 +0200)]
Post-release version bump to 4.9.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoRelease of libvirt-4.8.0
Daniel Veillard [Mon, 1 Oct 2018 15:16:02 +0000 (17:16 +0200)]
Release of libvirt-4.8.0

Signed-off-by: Daniel Veillard <veillard@redhat.com>
- docs/news.xml: updated for release

6 years agonews: Update for 4.8.0 release
Fabiano Fidêncio [Mon, 1 Oct 2018 14:40:12 +0000 (16:40 +0200)]
news: Update for 4.8.0 release

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
6 years agotests: reintroduce tests for libxl's legacy nested setting
Jim Fehlig [Wed, 26 Sep 2018 17:31:19 +0000 (11:31 -0600)]
tests: reintroduce tests for libxl's legacy nested setting

The preferred location for setting the nested CPU flag changed in
Xen 4.10 and is advertised via the LIBXL_HAVE_BUILDINFO_NESTED_HVM
define.  Commit 95d19cd0 changed libxl to use the new preferred
location but unconditionally changed the tests, causing 'make check'
failures against Xen < 4.10 that do not contain the new location.

Commit e94415d5 fixed the failures by only running the tests when
LIBXL_HAVE_BUILDINFO_NESTED_HVM is defined. Since libvirt supports
several versions of Xen that use the old nested location, it is
prudent to test the flag is set correctly. This patch reintroduces
the tests for the legacy location of the nested setting.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agouml: umlConnectOpen: Check the driver pointer before accessing it
Julio Faracco [Fri, 28 Sep 2018 04:13:28 +0000 (01:13 -0300)]
uml: umlConnectOpen: Check the driver pointer before accessing it

The pointer related to uml_driver needs to be checked before its usage
inside the function. Some attributes of the driver are being accessed
while the pointer is NULL considering the current logic.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoRevert "vircgroup: cleanup controllers not managed by systemd on error"
Pavel Hrdina [Thu, 27 Sep 2018 14:11:19 +0000 (16:11 +0200)]
Revert "vircgroup: cleanup controllers not managed by systemd on error"

This reverts commit 1602aa28f820ada66f707cef3e536e8572fbda1e.

There is no need to call virCgroupRemove() nor virCgroupFree() if
virCgroupEnableMissingControllers() fails because it will not modify
'group' at all.

The cleanup of directories is done in virCgroupMakeGroup().

Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agospec: Build ceph and gluster support everywhere
Jiri Denemark [Thu, 27 Sep 2018 14:08:53 +0000 (16:08 +0200)]
spec: Build ceph and gluster support everywhere

Both ceph and gluster have been built on RHEL on all architectures for
some time, there's no need to limit them to x86_64.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6 years agospec: Set correct TLS priority
Jiri Denemark [Thu, 27 Sep 2018 14:00:15 +0000 (16:00 +0200)]
spec: Set correct TLS priority

RHEL-7 is the only system where gnutls is too old to support @LIBVIRT
specifier.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoqemu: Temporarily disable metadata locking
Michal Privoznik [Thu, 27 Sep 2018 13:03:03 +0000 (15:03 +0200)]
qemu: Temporarily disable metadata locking

Turns out, there are couple of bugs that prevent this feature
from being operational. Given how close to the release we are
disable the feature temporarily. Hopefully, it can be enabled
back after all the bugs are fixed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agovircgroupv1: fix build on non-linux OSes
Pavel Hrdina [Thu, 27 Sep 2018 10:22:20 +0000 (12:22 +0200)]
vircgroupv1: fix build on non-linux OSes

Cgroups are linux specific and we need to make sure that the code is
compiled only on linux.  On different OSes it fails the compilation:

../../src/util/vircgroupv1.c:65:19: error: variable has incomplete type 'struct mntent'
    struct mntent entry;
                  ^
../../src/util/vircgroupv1.c:65:12: note: forward declaration of 'struct mntent'
    struct mntent entry;
           ^
../../src/util/vircgroupv1.c:74:12: error: implicit declaration of function 'getmntent_r' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    while (getmntent_r(mounts, &entry, buf, sizeof(buf)) != NULL) {
           ^
../../src/util/vircgroupv1.c:814:39: error: use of undeclared identifier 'MS_NOSUID'
    if (mount("tmpfs", root, "tmpfs", MS_NOSUID|MS_NODEV|MS_NOEXEC, opts) < 0) {
                                      ^
../../src/util/vircgroupv1.c:814:49: error: use of undeclared identifier 'MS_NODEV'
    if (mount("tmpfs", root, "tmpfs", MS_NOSUID|MS_NODEV|MS_NOEXEC, opts) < 0) {
                                                ^
../../src/util/vircgroupv1.c:814:58: error: use of undeclared identifier 'MS_NOEXEC'
    if (mount("tmpfs", root, "tmpfs", MS_NOSUID|MS_NODEV|MS_NOEXEC, opts) < 0) {
                                                         ^
../../src/util/vircgroupv1.c:841:65: error: use of undeclared identifier 'MS_BIND'
            if (mount(src, group->legacy[i].mountPoint, "none", MS_BIND,
                                                                ^

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: include system headers only on linux
Pavel Hrdina [Thu, 27 Sep 2018 10:19:17 +0000 (12:19 +0200)]
vircgroup: include system headers only on linux

All the system headers are used only if we are compiling on linux
and they all are present otherwise we would have seen build errors
because in our tests/vircgrouptest.c we use only __linux__ to check
whether to skip the cgroup tests or not.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: remove VIR_CGROUP_SUPPORTED
Pavel Hrdina [Thu, 27 Sep 2018 10:16:57 +0000 (12:16 +0200)]
vircgroup: remove VIR_CGROUP_SUPPORTED

tests/vircgrouptest.c uses #ifdef __linux__ for a long time and no
failure was reported so far so it's safe to assume that __linux__ is
good enough to guard cgroup code.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovirsh: Require explicit --domain for domxml-to-native
Jiri Denemark [Wed, 26 Sep 2018 07:59:08 +0000 (09:59 +0200)]
virsh: Require explicit --domain for domxml-to-native

The domxml-to-native virsh command accepts either --xml or --domain
option followed by a file or domain name respectively. The --domain
option is documented as required, which means an argument with no option
is treated as --xml. Commit v4.3.0-127-gd86531daf2 broke this by making
--domain optional and thus an argument with no option was treated as
--domain.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6 years agotests: libxl: skip tests with nested_hvm
Ján Tomko [Tue, 25 Sep 2018 12:48:35 +0000 (14:48 +0200)]
tests: libxl: skip tests with nested_hvm

Commit 95d19cd unconditionally adjusted the tests to account for
the conditional move of the nested_hvm setting location.

Run the affected tests only for the new setup (witnessed by
LIBXL_HAVE_BUILDINFO_NESTED_HVM).

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: Remove network type limitation for qemuARPGetInterfaces
Lin Ma [Tue, 25 Sep 2018 09:37:24 +0000 (17:37 +0800)]
qemu: Remove network type limitation for qemuARPGetInterfaces

Let's ignore the checking of interface type when we call the function
qemuARPGetInterfaces to get IP from host's arp table.

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Chen Hanxiao <chenhanxiao@gmail.com>
6 years agosecurity: Don't try to lock NULL paths
Michal Privoznik [Mon, 24 Sep 2018 13:22:25 +0000 (15:22 +0200)]
security: Don't try to lock NULL paths

It may happen that in the list of paths/disk sources to relabel
there is a disk source. If that is the case, the path is NULL. In
that case, we shouldn't try to lock the path. It's likely a
network disk anyway and therefore there is nothing to lock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agosecurity: Grab a reference to virSecurityManager for transactions
Michal Privoznik [Thu, 20 Sep 2018 12:22:13 +0000 (14:22 +0200)]
security: Grab a reference to virSecurityManager for transactions

This shouldn't be needed per-se. Security manager shouldn't
disappear during transactions - it's immutable. However, it
doesn't hurt to grab a reference either - transaction code uses
it after all.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirSecuritySELinuxContextListFree: Don't leak list->items
Michal Privoznik [Wed, 26 Sep 2018 07:19:31 +0000 (09:19 +0200)]
virSecuritySELinuxContextListFree: Don't leak list->items

This array is allocated in virSecuritySELinuxContextListAppend()
but never freed. This commit is essentially the same as ca25026.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirdbus: Use the mnemonic macros for dbus_bool_t values
Marc Hartmayer [Fri, 21 Sep 2018 13:02:04 +0000 (15:02 +0200)]
virdbus: Use the mnemonic macros for dbus_bool_t values

Use the mnemonic macros of libdbus for 1 (TRUE) and 0 (FALSE).

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirdbus: Report a debug message that dbus_watch_handle() has failed
Marc Hartmayer [Fri, 21 Sep 2018 13:02:03 +0000 (15:02 +0200)]
virdbus: Report a debug message that dbus_watch_handle() has failed

Report a debug message if dbus_watch_handle() returns FALSE.
dbus_watch_handle() returns FALSE if there wasn't enough memory for
reading or writing.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirdbus: Unref the D-Bus connection when closing
Marc Hartmayer [Fri, 21 Sep 2018 13:02:02 +0000 (15:02 +0200)]
virdbus: Unref the D-Bus connection when closing

As documented at
https://dbus.freedesktop.org/doc/api/html/group__DBusConnection.html#ga2522ac5075dfe0a1535471f6e045e1ee
the creator of a non-shared D-Bus connection has to release the last
reference after closing for freeing.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirdbus: Grab a ref as long as the while loop is executed
Marc Hartmayer [Fri, 21 Sep 2018 13:02:01 +0000 (15:02 +0200)]
virdbus: Grab a ref as long as the while loop is executed

Grab a ref for info->bus (a DBus connection) as long as the while loop
is running. With the grabbed reference it is ensured that info->bus
isn't freed as long as the while loop is executed. This is necessary
as it's allowed to drop the last ref for the bus connection in a
handler.

There was already a bug of this kind in libdbus itself:
https://bugs.freedesktop.org/show_bug.cgi?id=15635.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Avoid duplicate resume events and state changes
Jiri Denemark [Wed, 12 Sep 2018 12:34:33 +0000 (14:34 +0200)]
qemu: Avoid duplicate resume events and state changes

The only place where VIR_DOMAIN_EVENT_RESUMED should be generated is the
RESUME event handler to make sure we don't generate duplicate events or
state changes. In the worse case the duplicity can revert or cover
changes done by other event handlers.

For example, after QEMU sent RESUME, BLOCK_IO_ERROR, and STOP events
we could happily mark the domain as running and report
VIR_DOMAIN_EVENT_RESUMED to registered clients.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Map running reason to resume event detail
Jiri Denemark [Tue, 11 Sep 2018 13:13:08 +0000 (15:13 +0200)]
qemu: Map running reason to resume event detail

Thanks to the previous commit the RESUME event handler knows what reason
should be used when changing the domain state to VIR_DOMAIN_RUNNING, but
the emitted VIR_DOMAIN_EVENT_RESUMED event still uses a generic
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED detail. Luckily, the event detail can
be easily deduced from the running reason, which saves us from having to
pass one more value to the handler.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Pass running reason to RESUME event handler
Jiri Denemark [Mon, 10 Sep 2018 17:41:53 +0000 (19:41 +0200)]
qemu: Pass running reason to RESUME event handler

Whenever we get the RESUME event from QEMU, we change the state of the
affected domain to VIR_DOMAIN_RUNNING with VIR_DOMAIN_RUNNING_UNPAUSED
reason. This is fine if the domain is resumed unexpectedly, but when we
sent "cont" to QEMU we usually have a better reason for the state
change. The better reason is used in qemuProcessStartCPUs which also
sets the domain state to running if qemuMonitorStartCPUs reports
success. Thus we may end up with two state updates in a row, but the
final reason is correct.

This patch is a preparation for dropping the state change done in
qemuMonitorStartCPUs for which we need to pass the actual running reason
to the RESUME event handler and use it there instead of
VIR_DOMAIN_RUNNING_UNPAUSED.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Report more appropriate running reasons
Jiri Denemark [Tue, 11 Sep 2018 17:26:07 +0000 (19:26 +0200)]
qemu: Report more appropriate running reasons

This patch replaces some rather generic VIR_DOMAIN_RUNNING_UNPAUSED
reasons when changing domain state to running with more specific ones.
All of them are done when libvirtd reconnects to an existing domain
after being restarted and sees an unfinished migration or save.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Properly report VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT
Jiri Denemark [Mon, 10 Sep 2018 13:10:54 +0000 (15:10 +0200)]
qemu: Properly report VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT

VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT was defined but not used anywhere
in our event generation code. This fixes qemuDomainRevertToSnapshot to
properly report why the domain was resumed.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agolxc_monitor: Avoid AB / BA lock race
Mark Asselstine [Mon, 24 Sep 2018 15:11:35 +0000 (11:11 -0400)]
lxc_monitor: Avoid AB / BA lock race

A deadlock situation can occur when autostarting a LXC domain 'guest'
due to two threads attempting to take opposing locks while holding
opposing locks (AB BA problem). Thread A takes and holds the 'vm' lock
while attempting to take the 'client' lock, meanwhile, thread B takes
and holds the 'client' lock while attempting to take the 'vm' lock.

The potential for this can be seen as follows:

Thread A:
virLXCProcessAutostartDomain (takes vm lock)
 --> virLXCProcessStart
  --> virLXCProcessConnectMonitor
   --> virLXCMonitorNew
    --> virNetClientSetCloseCallback (wants client lock)

Thread B:
virNetClientIncomingEvent (takes client lock)
 --> virNetClientIOHandleInput
  --> virNetClientCallDispatch
   --> virNetClientCallDispatchMessage
    --> virNetClientProgramDispatch
     --> virLXCMonitorHandleEventInit
      --> virLXCProcessMonitorInitNotify (wants vm lock)

Since these threads are scheduled independently and are preemptible it
is possible for the deadlock scenario to occur where each thread locks
their first lock but both will fail to get their second lock and just
spin forever. You get something like:

virLXCProcessAutostartDomain (takes vm lock)
 --> virLXCProcessStart
  --> virLXCProcessConnectMonitor
   --> virLXCMonitorNew
<...>
virNetClientIncomingEvent (takes client lock)
 --> virNetClientIOHandleInput
  --> virNetClientCallDispatch
   --> virNetClientCallDispatchMessage
    --> virNetClientProgramDispatch
     --> virLXCMonitorHandleEventInit
      --> virLXCProcessMonitorInitNotify (wants vm lock but spins)
<...>
    --> virNetClientSetCloseCallback (wants client lock but spins)

Neither thread ever gets the lock it needs to be able to continue
while holding the lock that the other thread needs.

The actual window for preemption which can cause this deadlock is
rather small, between the calls to virNetClientProgramNew() and
execution of virNetClientSetCloseCallback(), both in
virLXCMonitorNew(). But it can be seen in real world use that this
small window is enough.

By moving the call to virNetClientSetCloseCallback() ahead of
virNetClientProgramNew() we can close any possible chance of the
deadlock taking place. There should be no other implications to the
move since the close callback (in the unlikely event was called) will
spin on the vm lock. The remaining work that takes place between the
old call location of virNetClientSetCloseCallback() and the new
location is unaffected by the move.

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovircgroup: rename controllers to legacy
Pavel Hrdina [Mon, 24 Sep 2018 23:17:02 +0000 (01:17 +0200)]
vircgroup: rename controllers to legacy

With the introduction of cgroup v2 there are new names used with
cgroups based on which version is used:

    - legacy: cgroup v1
    - unified: cgroup v2
    - hybrid: cgroup v1 and cgroup v2

Let's use 'legacy' instead of 'cgroupv1' or 'controllers' in our code.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: rename virCgroupController into virCgroupV1Controller
Pavel Hrdina [Tue, 18 Sep 2018 15:36:06 +0000 (17:36 +0200)]
vircgroup: rename virCgroupController into virCgroupV1Controller

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)CpusetCpus
Pavel Hrdina [Mon, 20 Aug 2018 08:01:10 +0000 (10:01 +0200)]
vircgroup: extract virCgroupV1(Set|Get)CpusetCpus

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)CpusetMemoryMigrate
Pavel Hrdina [Mon, 20 Aug 2018 08:00:57 +0000 (10:00 +0200)]
vircgroup: extract virCgroupV1(Set|Get)CpusetMemoryMigrate

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)CpusetMems
Pavel Hrdina [Mon, 20 Aug 2018 08:00:04 +0000 (10:00 +0200)]
vircgroup: extract virCgroupV1(Set|Get)CpusetMems

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)FreezerState
Pavel Hrdina [Thu, 16 Aug 2018 16:22:08 +0000 (18:22 +0200)]
vircgroup: extract virCgroupV1(Set|Get)FreezerState

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1GetCpuacctStat
Pavel Hrdina [Mon, 20 Aug 2018 07:58:33 +0000 (09:58 +0200)]
vircgroup: extract virCgroupV1GetCpuacctStat

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1GetCpuacct*Usage
Pavel Hrdina [Mon, 20 Aug 2018 07:57:51 +0000 (09:57 +0200)]
vircgroup: extract virCgroupV1GetCpuacct*Usage

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1SupportsCpuBW
Pavel Hrdina [Fri, 17 Aug 2018 14:23:14 +0000 (16:23 +0200)]
vircgroup: extract virCgroupV1SupportsCpuBW

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)CpuCfsQuota
Pavel Hrdina [Fri, 17 Aug 2018 14:22:56 +0000 (16:22 +0200)]
vircgroup: extract virCgroupV1(Set|Get)CpuCfsQuota

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)CpuCfsPeriod
Pavel Hrdina [Fri, 17 Aug 2018 14:22:30 +0000 (16:22 +0200)]
vircgroup: extract virCgroupV1(Set|Get)CpuCfsPeriod

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)CpuShares
Pavel Hrdina [Wed, 5 Sep 2018 18:11:38 +0000 (20:11 +0200)]
vircgroup: extract virCgroupV1(Set|Get)CpuShares

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Allow|Deny)AllDevices
Pavel Hrdina [Wed, 5 Sep 2018 18:10:02 +0000 (20:10 +0200)]
vircgroup: extract virCgroupV1(Allow|Deny)AllDevices

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Allow|Deny)Device
Pavel Hrdina [Wed, 5 Sep 2018 18:08:48 +0000 (20:08 +0200)]
vircgroup: extract virCgroupV1(Allow|Deny)Device

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1GetMemSwapUsage
Pavel Hrdina [Fri, 17 Aug 2018 14:19:08 +0000 (16:19 +0200)]
vircgroup: extract virCgroupV1GetMemSwapUsage

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)Memory*Limit
Pavel Hrdina [Fri, 17 Aug 2018 14:18:38 +0000 (16:18 +0200)]
vircgroup: extract virCgroupV1(Set|Get)Memory*Limit

They all need virCgroupV1GetMemoryUnlimitedKB() so it's easier to
move them in one commit.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1GetMemoryUsage
Pavel Hrdina [Fri, 17 Aug 2018 13:56:33 +0000 (15:56 +0200)]
vircgroup: extract virCgroupV1GetMemoryUsage

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1GetMemoryStat
Pavel Hrdina [Fri, 17 Aug 2018 13:55:47 +0000 (15:55 +0200)]
vircgroup: extract virCgroupV1GetMemoryStat

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1SetMemory
Pavel Hrdina [Fri, 17 Aug 2018 13:53:41 +0000 (15:53 +0200)]
vircgroup: extract virCgroupV1SetMemory

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)BlkioDeviceWriteBps
Pavel Hrdina [Mon, 24 Sep 2018 10:21:21 +0000 (12:21 +0200)]
vircgroup: extract virCgroupV1(Set|Get)BlkioDeviceWriteBps

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)BlkioDeviceReadBps
Pavel Hrdina [Mon, 24 Sep 2018 10:21:07 +0000 (12:21 +0200)]
vircgroup: extract virCgroupV1(Set|Get)BlkioDeviceReadBps

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)BlkioDeviceWriteIops
Pavel Hrdina [Mon, 24 Sep 2018 10:20:50 +0000 (12:20 +0200)]
vircgroup: extract virCgroupV1(Set|Get)BlkioDeviceWriteIops

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)BlkioDeviceReadIops
Pavel Hrdina [Mon, 24 Sep 2018 10:20:31 +0000 (12:20 +0200)]
vircgroup: extract virCgroupV1(Set|Get)BlkioDeviceReadIops

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)BlkioDeviceWeight
Pavel Hrdina [Mon, 24 Sep 2018 10:20:19 +0000 (12:20 +0200)]
vircgroup: extract virCgroupV1(Set|Get)BlkioDeviceWeight

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1GetBlkioIoDeviceServiced
Pavel Hrdina [Fri, 17 Aug 2018 13:30:21 +0000 (15:30 +0200)]
vircgroup: extract virCgroupV1GetBlkioIoDeviceServiced

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1GetBlkioIoServiced
Pavel Hrdina [Fri, 17 Aug 2018 13:29:39 +0000 (15:29 +0200)]
vircgroup: extract virCgroupV1GetBlkioIoServiced

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1(Set|Get)BlkioWeight
Pavel Hrdina [Fri, 17 Aug 2018 13:28:50 +0000 (15:28 +0200)]
vircgroup: extract virCgroupV1(Set|Get)BlkioWeight

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1SetOwner
Pavel Hrdina [Fri, 17 Aug 2018 08:09:49 +0000 (10:09 +0200)]
vircgroup: extract virCgroupV1SetOwner

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1BindMount
Pavel Hrdina [Fri, 17 Aug 2018 08:04:20 +0000 (10:04 +0200)]
vircgroup: extract virCgroupV1BindMount

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1HasEmptyTasks
Pavel Hrdina [Fri, 17 Aug 2018 13:25:48 +0000 (15:25 +0200)]
vircgroup: extract virCgroupV1HasEmptyTasks

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1AddTask
Pavel Hrdina [Mon, 24 Sep 2018 23:14:36 +0000 (01:14 +0200)]
vircgroup: extract virCgroupV1AddTask

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1Remove
Pavel Hrdina [Fri, 17 Aug 2018 08:02:05 +0000 (10:02 +0200)]
vircgroup: extract virCgroupV1Remove

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1MakeGroup
Pavel Hrdina [Tue, 18 Sep 2018 14:11:47 +0000 (16:11 +0200)]
vircgroup: extract virCgroupV1MakeGroup

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1PathOfController
Pavel Hrdina [Sun, 19 Aug 2018 17:24:58 +0000 (19:24 +0200)]
vircgroup: extract virCgroupV1PathOfController

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1GetAnyController
Pavel Hrdina [Sun, 19 Aug 2018 17:20:25 +0000 (19:20 +0200)]
vircgroup: extract virCgroupV1GetAnyController

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1HasController
Pavel Hrdina [Sun, 19 Aug 2018 17:17:27 +0000 (19:17 +0200)]
vircgroup: extract virCgroupV1HasController

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1DetectControllers
Pavel Hrdina [Mon, 24 Sep 2018 23:12:22 +0000 (01:12 +0200)]
vircgroup: extract virCgroupV1DetectControllers

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1StealPlacement
Pavel Hrdina [Fri, 17 Aug 2018 10:00:29 +0000 (12:00 +0200)]
vircgroup: extract virCgroupV1StealPlacement

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1ValidatePlacement
Pavel Hrdina [Fri, 24 Aug 2018 13:15:23 +0000 (15:15 +0200)]
vircgroup: extract virCgroupV1ValidatePlacement

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1CopyPlacement
Pavel Hrdina [Fri, 14 Sep 2018 10:53:47 +0000 (12:53 +0200)]
vircgroup: extract virCgroupV1CopyPlacement

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract v1 detect functions
Pavel Hrdina [Fri, 14 Sep 2018 10:51:27 +0000 (12:51 +0200)]
vircgroup: extract v1 detect functions

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1CopyMounts
Pavel Hrdina [Fri, 17 Aug 2018 07:46:10 +0000 (09:46 +0200)]
vircgroup: extract virCgroupV1CopyMounts

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1ValidateMachineGroup
Pavel Hrdina [Fri, 14 Sep 2018 11:21:19 +0000 (13:21 +0200)]
vircgroup: extract virCgroupV1ValidateMachineGroup

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: detect available backend for cgroup
Pavel Hrdina [Wed, 12 Sep 2018 11:47:21 +0000 (13:47 +0200)]
vircgroup: detect available backend for cgroup

We need to update one test-case because now new cgroup object will be
created only if there is any cgroup backend available.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: extract virCgroupV1Available
Pavel Hrdina [Thu, 13 Sep 2018 14:27:56 +0000 (16:27 +0200)]
vircgroup: extract virCgroupV1Available

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: introduce cgroup v1 backend files
Pavel Hrdina [Fri, 17 Aug 2018 08:19:59 +0000 (10:19 +0200)]
vircgroup: introduce cgroup v1 backend files

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoutil: introduce vircgroupbackend files
Pavel Hrdina [Wed, 15 Aug 2018 11:10:24 +0000 (13:10 +0200)]
util: introduce vircgroupbackend files

We will need to extract current cgroup v1 implementation into separate
backend because there will be new cgroup v2 implementation and both will
have to co-exist.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgrouptest: call virCgroupNewSelf instead virCgroupDetectMounts
Pavel Hrdina [Fri, 14 Sep 2018 11:17:07 +0000 (13:17 +0200)]
vircgrouptest: call virCgroupNewSelf instead virCgroupDetectMounts

This will be required once cgroup v2 is introduced.  The cgroup
detection is not simple and we will have multiple backends so we
should not just jump into the middle of the detection code.

In order to use virCgroupNewSelf we need to create all the remaining
data files:

    - {name}.cgroups represents /proc/cgroups, it is a list of cgroup
      controllers compiled into kernel

    - {name}.self.cgroup represents /proc/self/cgroup, it describes
      cgroups to which the process belongs

For "no-cgroups" we need to modify the expected behavior because
virCgroupNewSelf() will fail if there are no controllers available.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgrouptest: call virCgroupDetectMounts directly
Pavel Hrdina [Fri, 14 Sep 2018 10:38:54 +0000 (12:38 +0200)]
vircgrouptest: call virCgroupDetectMounts directly

Because we can set which files to return for cgroup tests there
is no need to have special function tailored to run tests.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroupmock: rewrite cgroup fopen mocking
Pavel Hrdina [Mon, 24 Sep 2018 15:17:00 +0000 (17:17 +0200)]
vircgroupmock: rewrite cgroup fopen mocking

Move all the cgroup data into separate files out of vircgroupmock.c
and rework the fopen function to load data from files.  This will
make it easier to add more test cases.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroupmock: cleanup unused cgroup files
Pavel Hrdina [Sun, 19 Aug 2018 09:43:38 +0000 (11:43 +0200)]
vircgroupmock: cleanup unused cgroup files

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: introduce virCgroupAddThread
Pavel Hrdina [Mon, 24 Sep 2018 22:54:04 +0000 (00:54 +0200)]
vircgroup: introduce virCgroupAddThread

Once we introduce cgroup v2 support we need to handle processes and
threads differently.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: introduce virCgroupTaskFlags
Pavel Hrdina [Tue, 11 Sep 2018 13:06:29 +0000 (15:06 +0200)]
vircgroup: introduce virCgroupTaskFlags

Use flags in virCgroupAddTaskInternal instead of boolean parameter.
Following patch will add new flag to indicate thread instead of process.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: rename virCgroupAdd.*Task to virCgroupAdd.*Process
Pavel Hrdina [Tue, 11 Sep 2018 13:03:22 +0000 (15:03 +0200)]
vircgroup: rename virCgroupAdd.*Task to virCgroupAdd.*Process

In cgroup v2 we need to handle processes and threads differently,
following patch will introduce virCgroupAddThread.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: fix bug in virCgroupEnableMissingControllers
Pavel Hrdina [Mon, 10 Sep 2018 13:43:42 +0000 (15:43 +0200)]
vircgroup: fix bug in virCgroupEnableMissingControllers

If we are on host with systemd we need to build cgroup hierarchy
ourselves for controllers that are not managed by systemd.

As a starting parent we need to force root group because
virCgroupMakeGroup() takes that parent in order to inherit values
for cpuset controller.

By default cpuset controller is managed by systemd so we will never
hit the issue but for v2 cgroups we need to use parent cgroup every
time.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: cleanup controllers not managed by systemd on error
Pavel Hrdina [Mon, 10 Sep 2018 12:46:24 +0000 (14:46 +0200)]
vircgroup: cleanup controllers not managed by systemd on error

If virCgroupEnableMissingControllers() fails it could have already
created some directories, we should clean it up as well.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agolibxl: prefer new location of nested_hvm in libxl_domain_build_info
Marek Marczykowski-Górecki [Wed, 19 Sep 2018 00:50:32 +0000 (02:50 +0200)]
libxl: prefer new location of nested_hvm in libxl_domain_build_info

If available, use b_info->nested_hvm instead of
b_info->u.hvm.nested_hvm. This will make nested HVM config available
also for PVH domains.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agolibxl: set shadow memory for any guest type, not only HVM
Marek Marczykowski-Górecki [Wed, 19 Sep 2018 00:50:31 +0000 (02:50 +0200)]
libxl: set shadow memory for any guest type, not only HVM

Otherwise starting PVH guest will result in "arch_setup_bootlate:
mapping shared_info failed (pfn=..., rc=-1, errno: 12): Internal error".

After this change the behavior is the same as in `xl`.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agodocs: add documentation of arch element of capabilities.xml
Marek Marczykowski-Górecki [Wed, 19 Sep 2018 00:50:30 +0000 (02:50 +0200)]
docs: add documentation of arch element of capabilities.xml

Specifically, list sub-elements and where they can be used. In addition,
describe supported machine types for Xen.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agolxc: Resolve memory leak
John Ferlan [Thu, 20 Sep 2018 20:50:37 +0000 (16:50 -0400)]
lxc: Resolve memory leak

Commit 40b5c99a modified the virConfGetValue callers to use
virConfGetValueString. However, using the virConfGetValueString
resulted in leaking the returned @value string in each case.
So, let's modify each instance to use the VIR_AUTOFREE(char *)
syntax. In some instances changing the variable name since
@value was used more than once.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agolxc: Remove unnecessary error label
John Ferlan [Fri, 21 Sep 2018 11:26:00 +0000 (07:26 -0400)]
lxc: Remove unnecessary error label

Since lxcConvertSize already creates an error message, there
is no need to use an error: label in lxcSetMemTune to just
overwrite or essentially rewrite the same error. So remove
the label.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agotests: Resolve possible overrun
John Ferlan [Thu, 20 Sep 2018 21:34:38 +0000 (17:34 -0400)]
tests: Resolve possible overrun

Coverity noted that each of the fmemopen called used the strlen value
in order to allocate space, but that neglected space for terminating
null string. So just add 1 to the strlen.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Alter when ctxt->node is set
John Ferlan [Thu, 20 Sep 2018 21:34:36 +0000 (17:34 -0400)]
conf: Alter when ctxt->node is set

In virDomainMemoryDefParseXML and virDomainVideoDefParseXML if
the VIR_ALLOC fails and NULL is returned, then the alteration
to ctxt->node isn't reversed.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agotools: Fix printf format
Michal Privoznik [Mon, 24 Sep 2018 08:45:44 +0000 (10:45 +0200)]
tools: Fix printf format

We're passing size_t but using format for unsigned long.
Introduced in latest vshTable rework patches.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agobuild-aux:check-spacing: Introduce a new rule to check misaligned stuff in parenthesises
Shi Lei [Wed, 19 Sep 2018 08:38:19 +0000 (16:38 +0800)]
build-aux:check-spacing: Introduce a new rule to check misaligned stuff in parenthesises

This patch introduces a new rule to check misaligned stuff in parenthesis:
1. For misaligned arguments of function
2. For misaligned conditions of [if|while|switch|...]

There're too much misalignment, so it adds a temporary filter which
permits 'src/util' now. It _should_ be removed as soon as fixing all.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
6 years agobuild-aux:check-spacing: Add wrapper function of CheckCurlyBrackets
Shi Lei [Wed, 19 Sep 2018 08:38:18 +0000 (16:38 +0800)]
build-aux:check-spacing: Add wrapper function of CheckCurlyBrackets

This patch adds CheckCurlyBrackets to simplify check-spacing.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
6 years agobuild-aux:check-spacing: Add wrapper function of CheckWhiteSpaces
Shi Lei [Wed, 19 Sep 2018 08:38:17 +0000 (16:38 +0800)]
build-aux:check-spacing: Add wrapper function of CheckWhiteSpaces

This patch adds CheckWhiteSpaces to simplify check-spacing.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
6 years agobuild-aux:check-spacing: Add wrapper function of KillComments
Shi Lei [Wed, 19 Sep 2018 08:38:16 +0000 (16:38 +0800)]
build-aux:check-spacing: Add wrapper function of KillComments

This patch adds KillComments to simplifies check-spacing.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
6 years agobuild-aux:check-spacing: Add wrapper function of CheckFunctionBody
Shi Lei [Wed, 19 Sep 2018 08:38:15 +0000 (16:38 +0800)]
build-aux:check-spacing: Add wrapper function of CheckFunctionBody

This patch adds CheckFunctionBody to simplifies check-spacing.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
6 years agoutil: Fix misaligned arguments and misaligned conditions for [if|while|...]
Shi Lei [Wed, 19 Sep 2018 08:38:14 +0000 (16:38 +0800)]
util: Fix misaligned arguments and misaligned conditions for [if|while|...]

This patch just fixes misaligned arguments and misaligned conditions
of src/util/*.c.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
6 years agovirt-admin: Implement vshTable API to server-list and client-list
Simon Kobyda [Fri, 21 Sep 2018 14:17:24 +0000 (16:17 +0200)]
virt-admin: Implement vshTable API to server-list and client-list

Signed-off-by: Simon Kobyda <skobyda@redhat.com>