]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agoutil: netlink: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
Sukrit Bhatnagar [Thu, 9 Aug 2018 04:12:10 +0000 (09:42 +0530)]
util: netlink: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
src/util/viralloc.h, define a new wrapper around an existing
cleanup function which will be called when a variable declared
with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant
viralloc.h include, since that has moved from the source module into
the header.

This commit also typedefs virNetlinkMsg to struct nl_msg type for use
with the cleanup macros.

When a variable of type virNetlinkMsg * is declared using VIR_AUTOPTR,
the function nlmsg_free will be run automatically on it when it
goes out of scope.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: iscsi: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Thu, 9 Aug 2018 04:12:09 +0000 (09:42 +0530)]
util: iscsi: use VIR_AUTOFREE instead of VIR_FREE for scalar types

Add another usage for VIR_AUTOFREE macro which was left in the
commit ec3e878, thereby dropping a VIR_FREE call and and a cleanup
section.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agospec: Add libvirt-daemon-driver-storage-iscsi-direct
Cole Robinson [Wed, 8 Aug 2018 23:43:25 +0000 (19:43 -0400)]
spec: Add libvirt-daemon-driver-storage-iscsi-direct

Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Prefer nvdimmPath over hugepages for memory-backend-file
Michal Privoznik [Thu, 9 Aug 2018 14:29:17 +0000 (16:29 +0200)]
qemu: Prefer nvdimmPath over hugepages for memory-backend-file

If a domain has hugepages configured and we're currently building
memory-backend-file for a nvdimm device that domain has we will
put hugepages path onto the command line. It should have been
nvdimm path configured in the XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: fix MinGW build
Pavel Hrdina [Mon, 13 Aug 2018 14:03:03 +0000 (16:03 +0200)]
vircgroup: fix MinGW build

Broken by commit <901d2b9c87>.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoesx: Fix nodeGetInfo so cpu model fits inside nodeinfo->model
Marcos Paulo de Souza [Sun, 12 Aug 2018 11:05:19 +0000 (08:05 -0300)]
esx: Fix nodeGetInfo so cpu model fits inside nodeinfo->model

Commit 6c0d0210cbcd5d647f0d882c07f077d444bc707d changed the behavior of
virStr*cpy* functions, so now the nodeGetInfo call fails. Version 4.1.0
(default for Fedora 28) works:

Model: Intel Core i7-4500U CPU @ 1.80G

Current master tries to write "Intel Core i7-4500U CPU @ 1.80GHz", but
the string is bigger than nodeinfo->model (which is a char[32]). So this
patch "cuts" the string, and presents the same output from 4.1.0.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
6 years agoRevert "build: add --with-jansson"
Ján Tomko [Mon, 13 Aug 2018 11:41:14 +0000 (13:41 +0200)]
Revert "build: add --with-jansson"

This reverts commit 12b34f094e2f1c7f414f4bb8f880a9d65c8fcd85.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Conflicts:
  configure.ac:
    Commit 8aa85e0b introduced LIBVIRT_*_LIBISCSI macros.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "build: undef WITH_JANSSON for SETUID_RPC_CLIENT"
Ján Tomko [Mon, 13 Aug 2018 11:40:25 +0000 (13:40 +0200)]
Revert "build: undef WITH_JANSSON for SETUID_RPC_CLIENT"

This reverts commit 93fdc9e0b0cbb2eec32745a868ac4633f0912ad5.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "Switch from yajl to Jansson"
Ján Tomko [Mon, 13 Aug 2018 11:40:18 +0000 (13:40 +0200)]
Revert "Switch from yajl to Jansson"

This reverts commit 9cf38263d05ca7f27dbbd9b1a0b48d338d9280e2.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "Remove functions using yajl"
Ján Tomko [Mon, 13 Aug 2018 11:40:11 +0000 (13:40 +0200)]
Revert "Remove functions using yajl"

This reverts commit bf114decb34f21cd225ead6dc4d929d35a8c5fe5.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "build: remove references to WITH_YAJL for SETUID_RPC_CLIENT"
Ján Tomko [Mon, 13 Aug 2018 11:40:02 +0000 (13:40 +0200)]
Revert "build: remove references to WITH_YAJL for SETUID_RPC_CLIENT"

This reverts commit 1caf8441604b58e4a89aa2c09975b8346928c52a.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "Remove virJSONValueNewStringLen"
Ján Tomko [Mon, 13 Aug 2018 11:39:56 +0000 (13:39 +0200)]
Revert "Remove virJSONValueNewStringLen"

This reverts commit 8f802c6d8659beb9eb3cab96ba2553e251728337.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "build: switch --with-qemu default from yes to check"
Ján Tomko [Mon, 13 Aug 2018 11:39:48 +0000 (13:39 +0200)]
Revert "build: switch --with-qemu default from yes to check"

This reverts commit c5ae8e0c2b4b6bb3c667cfadaf65a66c3f4f3d85.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "build: require Jansson if QEMU driver is enabled"
Ján Tomko [Mon, 13 Aug 2018 11:39:39 +0000 (13:39 +0200)]
Revert "build: require Jansson if QEMU driver is enabled"

This reverts commit 01ce04375c3348fd683475e5aa5231149ef6a78a.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "m4: Introduce STABLE_ORDERING_JANSSON"
Ján Tomko [Mon, 13 Aug 2018 11:39:33 +0000 (13:39 +0200)]
Revert "m4: Introduce STABLE_ORDERING_JANSSON"

This reverts commit 4dd60540007042bfc0087a67f57f3e9f3311a84a.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "tests: also skip qemuagenttest with old jansson"
Ján Tomko [Mon, 13 Aug 2018 11:39:25 +0000 (13:39 +0200)]
Revert "tests: also skip qemuagenttest with old jansson"

This reverts commit c31146685f5c8558ff88d52d03a68533c9220feb.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "util: avoid symbol clash between json libraries"
Ján Tomko [Mon, 13 Aug 2018 11:39:16 +0000 (13:39 +0200)]
Revert "util: avoid symbol clash between json libraries"

This reverts commit ce3c6ef6843f98d81be5423ece11fad79eaab920.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "tests: qemucapsprobe: Fix output after switching to jansson"
Ján Tomko [Mon, 13 Aug 2018 11:39:09 +0000 (13:39 +0200)]
Revert "tests: qemucapsprobe: Fix output after switching to jansson"

This reverts commit 397447f80588438545994a86883792a5999cad15.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "util: jsoncompat: Stub out virJSONInitialize when compiling without jansson"
Ján Tomko [Mon, 13 Aug 2018 11:38:46 +0000 (13:38 +0200)]
Revert "util: jsoncompat: Stub out virJSONInitialize when compiling without jansson"

This reverts commit 9e44c2db8ad94d3c20acc1d081538c280af198b4.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "remote: daemon: Make sure that JSON symbols are properly loaded at startup"
Ján Tomko [Mon, 13 Aug 2018 11:38:38 +0000 (13:38 +0200)]
Revert "remote: daemon: Make sure that JSON symbols are properly loaded at startup"

This reverts commit 3251fc9c9b9639c3fec3181530599415523d671a.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "Fix link errors in tools/nss and tests"
Ján Tomko [Mon, 13 Aug 2018 11:38:28 +0000 (13:38 +0200)]
Revert "Fix link errors in tools/nss and tests"

This reverts commit b3d9b08ef797e569b14cfa42d3dceba23c2a5b14.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "src: Move DLOPEN_LIBS to libraries introducing the dependency"
Ján Tomko [Mon, 13 Aug 2018 11:37:53 +0000 (13:37 +0200)]
Revert "src: Move DLOPEN_LIBS to libraries introducing the dependency"

This reverts commit 5d40272ea67c74049600e120095d1b42287ed2d2.

Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonetworkStartNetworkVirtual: Don't leak macmap object
Michal Privoznik [Mon, 13 Aug 2018 09:17:20 +0000 (11:17 +0200)]
networkStartNetworkVirtual: Don't leak macmap object

When starting network a macmap object is created (which stores
MAC -> domain name mappings). However, if something goes wrong
(e.g. virNetDevIPCheckIPv6Forwarding() fails) then the object is
leaked.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agovirnetdevip: Free data.devices in virNetDevIPCheckIPv6Forwarding() too
Michal Privoznik [Mon, 13 Aug 2018 09:16:06 +0000 (11:16 +0200)]
virnetdevip: Free data.devices in virNetDevIPCheckIPv6Forwarding() too

We are freeing the individual strings (which were filled by
virNetDevIPCheckIPv6ForwardingCallback()) but not the array
itself.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agolxc: Use virCgroupGetMemoryStat
Pavel Hrdina [Fri, 20 Jul 2018 12:48:56 +0000 (14:48 +0200)]
lxc: Use virCgroupGetMemoryStat

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Introduce virCgroupGetMemoryStat
Pavel Hrdina [Fri, 20 Jul 2018 12:47:11 +0000 (14:47 +0200)]
vircgroup: Introduce virCgroupGetMemoryStat

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Remove virCgroupAddTaskController
Pavel Hrdina [Thu, 19 Jul 2018 12:39:43 +0000 (14:39 +0200)]
vircgroup: Remove virCgroupAddTaskController

There is no need for this function, both of the checks are done
later by virCgroupGetControllerPath.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: machinename will never be NULL
Pavel Hrdina [Tue, 31 Jul 2018 10:15:53 +0000 (12:15 +0200)]
vircgroup: machinename will never be NULL

Commit <eaf2c9f89107b9f60cf8db2c919f78b987ff7177> moved machineName
generation before virCgroupNewDetectMachine() is called.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Introduce virCgroupEnableMissingControllers
Pavel Hrdina [Tue, 31 Jul 2018 10:09:40 +0000 (12:09 +0200)]
vircgroup: Introduce virCgroupEnableMissingControllers

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Use virCgroupMountOptsMatchController in virCgroupDetectPlacement
Pavel Hrdina [Tue, 17 Jul 2018 11:43:55 +0000 (13:43 +0200)]
vircgroup: Use virCgroupMountOptsMatchController in virCgroupDetectPlacement

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Extract mount options matching into function
Pavel Hrdina [Wed, 13 Jun 2018 16:12:18 +0000 (18:12 +0200)]
vircgroup: Extract mount options matching into function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Remove pointless bool parameter
Pavel Hrdina [Wed, 13 Jun 2018 13:05:57 +0000 (15:05 +0200)]
vircgroup: Remove pointless bool parameter

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Move function used in tests into vircgrouppriv.h
Pavel Hrdina [Wed, 13 Jun 2018 10:55:27 +0000 (12:55 +0200)]
vircgroup: Move function used in tests into vircgrouppriv.h

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Unexport unused function virCgroupRemoveRecursively
Pavel Hrdina [Fri, 20 Jul 2018 12:58:41 +0000 (14:58 +0200)]
vircgroup: Unexport unused function virCgroupRemoveRecursively

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Unexport unused function virCgroupAddTaskController()
Pavel Hrdina [Wed, 13 Jun 2018 10:53:28 +0000 (12:53 +0200)]
vircgroup: Unexport unused function virCgroupAddTaskController()

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Remove unused function virCgroupKill()
Pavel Hrdina [Wed, 13 Jun 2018 10:52:52 +0000 (12:52 +0200)]
vircgroup: Remove unused function virCgroupKill()

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Extract file link resolving into separate function
Pavel Hrdina [Tue, 31 Jul 2018 10:08:08 +0000 (12:08 +0200)]
vircgroup: Extract file link resolving into separate function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Introduce standard set of typedefs and use them
Pavel Hrdina [Tue, 12 Jun 2018 11:47:10 +0000 (13:47 +0200)]
vircgroup: Introduce standard set of typedefs and use them

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Rename structs to start with underscore
Pavel Hrdina [Tue, 12 Jun 2018 11:46:04 +0000 (13:46 +0200)]
vircgroup: Rename structs to start with underscore

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agodocs: Update how we create cgroup directory names
Pavel Hrdina [Thu, 19 Apr 2018 12:45:19 +0000 (14:45 +0200)]
docs: Update how we create cgroup directory names

Commit <c3bd0019c0> changed the way how cgroup directory names are
constructed but the documentation was not updated.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agodocs: List cpuacct in controllers used by QEMU driver
Pavel Hrdina [Thu, 19 Apr 2018 12:42:43 +0000 (14:42 +0200)]
docs: List cpuacct in controllers used by QEMU driver

The cpuacct controller is used to get cpu stats.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoqemu_migration: Avoid writing to freed memory
Jiri Denemark [Thu, 2 Aug 2018 14:56:02 +0000 (16:56 +0200)]
qemu_migration: Avoid writing to freed memory

When a domain is killed on the source host while it is being migrated
and libvirtd is waiting for the migration to finish (waiting for the
domain condition in qemuMigrationSrcWaitForCompletion), the run-time
state including priv->job.current may already be freed once
virDomainObjWait returns with -1. Thus the priv->job.current pointer
cached in jobInfo is no longer valid and setting jobInfo->status may
crash the daemon.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: add wipeVol to iscsi-direct storage backend
Clementine Hayat [Sun, 12 Aug 2018 22:26:18 +0000 (00:26 +0200)]
storage: add wipeVol to iscsi-direct storage backend

Signed-off-by: Clementine Hayat <clem@lse.epita.fr>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agostorage: add SetConnection to iscsi-direct backend
Clementine Hayat [Sun, 12 Aug 2018 22:26:17 +0000 (00:26 +0200)]
storage: add SetConnection to iscsi-direct backend

The code to set the connection and connect using libiscsi will always be
the same. Add function to avoid code duplication.

Signed-off-by: Clementine Hayat <clem@lse.epita.fr>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agostorage: refactor volume capacity in iscsi-direct backend
Clementine Hayat [Sun, 12 Aug 2018 22:26:16 +0000 (00:26 +0200)]
storage: refactor volume capacity in iscsi-direct backend

The size of blocks inside a volume and the number of blocks are needed
later. Having a function that return thoses information will avoid code
duplication.

Signed-off-by: Clementine Hayat <clem@lse.epita.fr>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoconf: Introduce virDomainDefPostParseMemtune
Pavel Hrdina [Wed, 8 Aug 2018 15:03:40 +0000 (17:03 +0200)]
conf: Introduce virDomainDefPostParseMemtune

Previously we were ignoring "nodeset" attribute for hugepage pages
if there was no guest NUMA topology configured in the domain XML.
Commit <fa6bdf6afa878b8d7c5ed71664ee72be8967cdc5> partially fixed
that issue but it introduced a somehow valid regression.

In case that there is no guest NUMA topology configured and the
"nodeset" attribute is set to "0" it was accepted and was working
properly even though it was not completely valid XML.

This patch introduces a workaround that it will ignore the nodeset="0"
only in case that there is no guest NUMA topology in order not to
hit the validation error.

After this commit the following XML configuration is valid:

  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB' nodeset='0'/>
    </hugepages>
  </memoryBacking>

but this configuration remains invalid:

  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB' nodeset='0'/>
      <page size='1048576' unit='KiB'/>
    </hugepages>
  </memoryBacking>

The issue with the second configuration is that it was originally
working, however changing the order of the <page> elements resolved
into using different page size for the guest.  The code is written
in a way that it expect only one page configured and always uses only
the first page in case that there is no guest NUMA topology configured.
See qemuBuildMemPathStr() function for details.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoconf: Move hugepages validation out of XML parser
Pavel Hrdina [Tue, 10 Jul 2018 10:46:53 +0000 (12:46 +0200)]
conf: Move hugepages validation out of XML parser

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoconf: Move hugepage XML validation check out of qemu_command
Pavel Hrdina [Thu, 9 Aug 2018 12:02:16 +0000 (14:02 +0200)]
conf: Move hugepage XML validation check out of qemu_command

We can safely validate the hugepage nodeset attribute at a define time.
This validation is not done for already existing domains when the daemon
is restarted.

All the changes to the tests are necessary because we move the error
from domain start into XML parse.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: introduce hugepages-nodeset
Pavel Hrdina [Wed, 8 Aug 2018 14:53:45 +0000 (16:53 +0200)]
tests: introduce hugepages-nodeset

This use-case was broken by commit
<fa6bdf6afa878b8d7c5ed71664ee72be8967cdc5>.

We allowed this configuration and it was working as expected therefore
we can consider it as regression.  We should have never allowed such
configuration so now the best solution is in case of non-numa guest
silently ignore the 'nodeset' attribute if it's set to '0'.

That will be fixed by following patches.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: introduce hugepages-default-1G-nodeset-2M
Pavel Hrdina [Wed, 8 Aug 2018 13:59:27 +0000 (15:59 +0200)]
tests: introduce hugepages-default-1G-nodeset-2M

This test case is currently working but it uncovers existing issue
in our code that the generated QEMU commandline uses the default 1G
hugepage instead of the 2M hugepage specified for exact node.

The issue in our code is that for non-numa guests we take into account
only the first hugepage.  This will be fixed as invalid configuration
since it doesn't make any sense to set default and specific hugepage
for non-numa guest.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: rename hugepages-pages8 into hugepages-nodeset-nonexist
Pavel Hrdina [Wed, 8 Aug 2018 13:55:37 +0000 (15:55 +0200)]
tests: rename hugepages-pages8 into hugepages-nodeset-nonexist

Remove unnecessary XML elements as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: rename hugepages-pages7 into pages-dimm-discard
Pavel Hrdina [Fri, 10 Aug 2018 11:14:58 +0000 (13:14 +0200)]
tests: rename hugepages-pages7 into pages-dimm-discard

Remove unnecessary XML elements as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: rename hugepages-pages6 into hugepages-default-system-size
Pavel Hrdina [Fri, 10 Aug 2018 11:13:34 +0000 (13:13 +0200)]
tests: rename hugepages-pages6 into hugepages-default-system-size

Remove unnecessary XML elements as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: rename hugepages-pages5 into hugepages-default-2M
Pavel Hrdina [Fri, 10 Aug 2018 11:12:43 +0000 (13:12 +0200)]
tests: rename hugepages-pages5 into hugepages-default-2M

Remove unnecessary XML elements as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: rename hugepages-pages4 into hugepages-numa-nodeset-nonexist
Pavel Hrdina [Thu, 9 Aug 2018 11:41:02 +0000 (13:41 +0200)]
tests: rename hugepages-pages4 into hugepages-numa-nodeset-nonexist

Remove unnecessary XML elements as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: rename hugepages-pages3 into hugepages-numa-nodeset-part
Pavel Hrdina [Fri, 10 Aug 2018 11:10:29 +0000 (13:10 +0200)]
tests: rename hugepages-pages3 into hugepages-numa-nodeset-part

Remove unnecessary XML elements as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: extract pages-discard-hugepages out of hugepages-pages3
Pavel Hrdina [Thu, 9 Aug 2018 11:26:53 +0000 (13:26 +0200)]
tests: extract pages-discard-hugepages out of hugepages-pages3

Similar thing happens as for pages-discard, it is not passed to QEMU.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: rename hugepages-pages2 into hugepages-numa-default-2M
Pavel Hrdina [Fri, 10 Aug 2018 11:08:53 +0000 (13:08 +0200)]
tests: rename hugepages-pages2 into hugepages-numa-default-2M

Remove unnecessary XML elements as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: rename hugepages-pages into hugepages-numa-nodeset
Pavel Hrdina [Fri, 10 Aug 2018 11:05:50 +0000 (13:05 +0200)]
tests: rename hugepages-pages into hugepages-numa-nodeset

Remove unnecessary XML elements as well.

<numatune> for numa guest is tested by numatune-memnode test.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: extract pages-discard out of hugepages-pages
Pavel Hrdina [Wed, 8 Aug 2018 10:27:18 +0000 (12:27 +0200)]
tests: extract pages-discard out of hugepages-pages

From the args output you can see that the 'discard' feature is not
honored if you don't use hugepages, that is a bug, following patche
will fix it.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: remove unnecessary XML elements from hugepages-numa-default
Pavel Hrdina [Fri, 10 Aug 2018 11:04:15 +0000 (13:04 +0200)]
tests: remove unnecessary XML elements from hugepages-numa-default

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: rename hugepages-numa into hugepages-numa-default
Pavel Hrdina [Thu, 9 Aug 2018 09:56:39 +0000 (11:56 +0200)]
tests: rename hugepages-numa into hugepages-numa-default

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: extract hugepages-numa-default-dimm out of hugepages-numa
Pavel Hrdina [Tue, 7 Aug 2018 15:00:02 +0000 (17:00 +0200)]
tests: extract hugepages-numa-default-dimm out of hugepages-numa

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: rename hugepages to hugepages-default
Pavel Hrdina [Fri, 10 Aug 2018 10:54:52 +0000 (12:54 +0200)]
tests: rename hugepages to hugepages-default

Remove unnecessary XML elements as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agosrc: Move DLOPEN_LIBS to libraries introducing the dependency
Michal Privoznik [Fri, 10 Aug 2018 05:34:24 +0000 (07:34 +0200)]
src: Move DLOPEN_LIBS to libraries introducing the dependency

There are few places where dlopen() is called. This call means we
have to link with DLOPEN_LIBS. However, instead of having each
final, installable library linking with it, move the directive to
the source that introduced the dependency.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agoqemuBuildBootCommandLine: remove unused boot_order_str
Ján Tomko [Thu, 9 Aug 2018 14:35:20 +0000 (16:35 +0200)]
qemuBuildBootCommandLine: remove unused boot_order_str

After commit caccbba this variable is always NULL.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoconf: rewrite filtering for capabilities lookup
Daniel P. Berrangé [Thu, 2 Aug 2018 16:12:58 +0000 (17:12 +0100)]
conf: rewrite filtering for capabilities lookup

The virCapabilitiesDomainDataLookupInternal() is given a list of
parameters representing the desired domain characteristics. It then has
to look throught the capabilities to identify an acceptable match.

The virCapsDomainDataCompare() method is used for filtering out
candidates which don't match the desired criteria. It is called
primarily from the innermost loops and as such is doing many repeated
checks. For example if architcture and os type were checked at the top
level loop the two inner loops could be avoided entirely. If emulator
and domain type were checked in the 2nd level loop the 3rd level loop
can be avoided too.

This change thus removes the virCapsDomainDataCompare() method and puts
suitable checks at the start of each loop to ensure it executes the
minimal number of loop iterations possible. The code becomes clearer to
understand as a nice side-effect.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemuxml2xmloutdata: Use more symlinks
Michal Privoznik [Fri, 10 Aug 2018 05:09:50 +0000 (07:09 +0200)]
qemuxml2xmloutdata: Use more symlinks

There are couple of files that are the same in both
qemuxml2argvdata and qemuxml2xmloutdata directories. Link them
instead of having full copy.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoFix libvirt-driver-libxl check
Marek Marczykowski-Górecki [Sun, 5 Aug 2018 21:50:35 +0000 (23:50 +0200)]
Fix libvirt-driver-libxl check

Fix saving CFLAGS in LIBVIRT_DRIVER_CHECK_LIBXL - LIBVIRT_CHECK_LIB will
override old_CFLAGS, so use a different name.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
6 years agoqemu: domain: Fix machine type version check for 'isa-fdc' usage
Peter Krempa [Thu, 9 Aug 2018 10:35:41 +0000 (12:35 +0200)]
qemu: domain: Fix machine type version check for 'isa-fdc' usage

Starting from pc-q35-2.4 the floppy controller is not enabled by
default. Fix the version check so that it does not match 2.11 as being
2.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Don't format -device isa-fdc,... twice with two floppy drives
Peter Krempa [Thu, 9 Aug 2018 11:50:22 +0000 (13:50 +0200)]
qemu: command: Don't format -device isa-fdc,... twice with two floppy drives

Fix regression introduced in <42fd5a58adb>. With q35 machine type which
requires the explicitly specified FDC we'd format twoisa-fdc
controllers to the command line as the code was moved to a place where
it's called per-disk.

Move the call back after formatting all disks and reiterate the disks to
find the floppy controllers.

This also moves the '-global' directive which sets up the default
ISA-FDC to the end after all the disks but since we are modifying the
properties it is safe to do so.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemuxml2argv: Add 2 floppy drive tests for q35 with 2.9 and 2.11 machine
Peter Krempa [Thu, 9 Aug 2018 10:28:56 +0000 (12:28 +0200)]
tests: qemuxml2argv: Add 2 floppy drive tests for q35 with 2.9 and 2.11 machine

The floppy drive command line is different on the q35 machine. Make sure
to test that both drives are supported and also multiple machine
versions as we generate the commandline differently.

Note that both output files show wrong command line which will be fixed
subsequently.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Remove unused argument 'bootable' from qemuBuildDriveStr
Peter Krempa [Thu, 9 Aug 2018 11:33:41 +0000 (13:33 +0200)]
qemu: Remove unused argument 'bootable' from qemuBuildDriveStr

Now that the argument is unused we can remove it transitively from all
the call graphs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: capabilities: Remove unused QEMU_CAPS_DRIVE_BOOT
Peter Krempa [Thu, 9 Aug 2018 11:28:16 +0000 (13:28 +0200)]
qemu: capabilities: Remove unused QEMU_CAPS_DRIVE_BOOT

The capability was never set except for (stale) tests. Remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: capabilities: Always assume QEMU_CAPS_BOOTINDEX
Peter Krempa [Thu, 9 Aug 2018 11:26:17 +0000 (13:26 +0200)]
qemu: capabilities: Always assume QEMU_CAPS_BOOTINDEX

The field was added in qemu v0.13.0-rc0-731-g1ca4d09ae0 so all supported
qemu versions now use it.

There's a LOT of test fallout as we did not use capabilities close
enough to upstream for many of our tests.

Several tests had a 'bootindex' variant. Since they'd become redundant
they are also removed here.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: tweak error message when skipping file
Daniel P. Berrangé [Mon, 30 Jul 2018 16:43:56 +0000 (17:43 +0100)]
storage: tweak error message when skipping file

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: emit error when trying to update blkiotune group_name in qemuDomainChangeDiskLive
Katerina Koukiou [Tue, 31 Jul 2018 07:36:26 +0000 (09:36 +0200)]
qemu: emit error when trying to update blkiotune group_name in qemuDomainChangeDiskLive

The rest of blkiotune parameters are not updatable through UpdateDeviceFlags API.

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

Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoFix link errors in tools/nss and tests
Jim Fehlig [Wed, 8 Aug 2018 16:47:57 +0000 (10:47 -0600)]
Fix link errors in tools/nss and tests

While local builds succeed fine, a build worker building in a chroot
environment is encountering errors when linking some items in tools/nss
and tests, e.g.

[  469s] libtool: link: gcc -shared  -fPIC -DPIC  -Wl,--whole-archive nss/.libs/libnss_libvirt_impl.a -Wl,--no-whole-archive  -lpthread -lutil -ltirpc  -fstack-protector-strong -grecord-gcc-switches -O2 -fstack-protector-strong -g -Wl,--version-script=./nss/libvirt_nss.syms -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,--no-copy-dt-needed-entries -Wl,-z -Wl,defs -grecord-gcc-switches -O2 -fstack-protector-strong -g   -pthread -Wl,-soname -Wl,libnss_libvirt.so.2 -o nss/.libs/libnss_libvirt.so.2
[  469s] nss/.libs/libnss_libvirt_impl.a(libvirt_nss_la-virjsoncompat.o): In function `virJSONJanssonOnce':
[  469s] /home/abuild/rpmbuild/BUILD/libvirt-4.6.0/src/util/virjsoncompat.c:63: undefined reference to `dlopen'
[  469s] /home/abuild/rpmbuild/BUILD/libvirt-4.6.0/src/util/virjsoncompat.c:79: undefined reference to `dlsym'
...

A similar problem was fixed in commit b018ada3 and inspires this fix.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: add support for domain disk initiator IQN
Pavel Hrdina [Tue, 7 Aug 2018 12:57:43 +0000 (14:57 +0200)]
qemu: add support for domain disk initiator IQN

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: introduce qemu disk-network-iscsi-modern test cases
Pavel Hrdina [Tue, 7 Aug 2018 13:32:20 +0000 (15:32 +0200)]
tests: introduce qemu disk-network-iscsi-modern test cases

This uses the new -drive options instead of iSCSI URI.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoconf: introduce initiator IQN support for domain disks
Pavel Hrdina [Tue, 7 Aug 2018 11:32:56 +0000 (13:32 +0200)]
conf: introduce initiator IQN support for domain disks

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agodocs: move storage initiator def into storagecommon.rng
Pavel Hrdina [Tue, 7 Aug 2018 11:28:24 +0000 (13:28 +0200)]
docs: move storage initiator def into storagecommon.rng

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoconf: use virStorageSourceInitiator functions
Pavel Hrdina [Tue, 7 Aug 2018 11:31:31 +0000 (13:31 +0200)]
conf: use virStorageSourceInitiator functions

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoutil: introduce virStorageSourceInitiator functions
Pavel Hrdina [Tue, 7 Aug 2018 11:01:40 +0000 (13:01 +0200)]
util: introduce virStorageSourceInitiator functions

The same code would be used for storage pools and domain disks.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoconf: rename and move virStoragePoolSourceInitiatorAttr
Pavel Hrdina [Tue, 7 Aug 2018 11:25:21 +0000 (13:25 +0200)]
conf: rename and move virStoragePoolSourceInitiatorAttr

This structure will be reused by domain disk images as well.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agoconf: properly translate iscsi-direct storage pool
Pavel Hrdina [Mon, 6 Aug 2018 15:52:41 +0000 (17:52 +0200)]
conf: properly translate iscsi-direct storage pool

We cannot simply used the same code as for iscsi storage pool because
the default mode is 'host' which is not possible with iscsi-direct.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agodocs: fix iscsi-direct XML example
Pavel Hrdina [Mon, 6 Aug 2018 11:42:39 +0000 (13:42 +0200)]
docs: fix iscsi-direct XML example

The <initiator> element is part of <source> element.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agorpm: simplify applying of patches
Daniel P. Berrangé [Fri, 3 Aug 2018 09:34:32 +0000 (10:34 +0100)]
rpm: simplify applying of patches

The distros we support for RPM builds all have %autosetup support so we
can ditch the convoluted code for running git manually and use the RPM
defaults.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agospec: Use %make_install
Cole Robinson [Tue, 31 Jul 2018 15:31:34 +0000 (11:31 -0400)]
spec: Use %make_install

It's on RHEL7, saves a bit of typing, and lets us drop the comment

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoconf: virDomainDefValidateInternal prohibit some characters in shmem name
Simon Kobyda [Wed, 1 Aug 2018 15:50:03 +0000 (17:50 +0200)]
conf: virDomainDefValidateInternal prohibit some characters in shmem name

Validate that the provided XML shmem name is not directory specific to "."  or
".." as well as ensure that there is no path separator '/' in the name.

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

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
6 years agoFix the build on non-linux platforms after VIR_AUTOPTR related changes
Erik Skultety [Tue, 7 Aug 2018 16:40:11 +0000 (18:40 +0200)]
Fix the build on non-linux platforms after VIR_AUTOPTR related changes

Commits 7b706f33ac and 4acb7887e4 introduced some compound type *Free
wrappers in order to use them with VIR_DEFINE_AUTOPTR_FUNC. However,
since those were not used in the code right away, Clang complained about
unused functions (static ones that are defined by the macro above).
This patch puts the defined functions in use.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: virnetdevopenvswitch: Drop an unused variable @ovs_timeout
Erik Skultety [Tue, 7 Aug 2018 16:34:51 +0000 (18:34 +0200)]
util: virnetdevopenvswitch: Drop an unused variable @ovs_timeout

Technically, it was never used ever since commit @f4d06ca8fd9 introduced
it, but the fact that we called VIR_FREE on it was enough for Clang to
never complain about it.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: ensure default machine types don't change if QEMU changes
Daniel P. Berrangé [Fri, 3 Aug 2018 12:29:26 +0000 (13:29 +0100)]
qemu: ensure default machine types don't change if QEMU changes

It is increasingly likely that some distro is going to change the
default "x86" machine type in QEMU from "pc" to "q35". This will
certainly break existing applications which write their XML on the
assumption that it is using a "pc" machine by default. For example they'll
lack a IDE CDROM and get PCIe instead of PCI which changes the topology
radically.

Libvirt promises to isolate applications from hypervisor changes that
may cause incompatibilities, so we must ensure that we always use the
"pc" machine type if it is available. Only use QEMU's own reported
default machine type if "pc" does not exist.

This issue is not x86-only, other arches are liable to change their
default machine, while some arches don't report any default at all
causing libvirt to pick the first machine in the list. Thus to
guarantee stability to applications, declare a preferred default
machine for all architectures we currently support with QEMU.

Note this change assumes there will always be a "pc" alias as long as a
versioned "pc-XXX" machine type exists. If QEMU were to ship a "pc-XXX"
machine type but not provide the "pc" alias, it is too hard to decide
which to default so. Versioned machine types are supposed to be
considered opaque strings, so we can't apply any sensible ordering
ourselves and QEMU isn't reporting the list of machines in any sensible
ordering itself.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: qemu: use VIR_AUTOPTR for aggregate types
Sukrit Bhatnagar [Sat, 28 Jul 2018 18:01:47 +0000 (23:31 +0530)]
util: qemu: use VIR_AUTOPTR for aggregate types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: qemu: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Sat, 28 Jul 2018 18:01:46 +0000 (23:31 +0530)]
util: qemu: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: process: use VIR_AUTOPTR for aggregate types
Sukrit Bhatnagar [Sat, 28 Jul 2018 18:01:45 +0000 (23:31 +0530)]
util: process: use VIR_AUTOPTR for aggregate types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: process: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Sat, 28 Jul 2018 18:01:44 +0000 (23:31 +0530)]
util: process: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: pidfile: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Sat, 28 Jul 2018 18:01:43 +0000 (23:31 +0530)]
util: pidfile: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: perf: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Sat, 28 Jul 2018 18:01:42 +0000 (23:31 +0530)]
util: perf: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: perf: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
Sukrit Bhatnagar [Sat, 28 Jul 2018 18:01:41 +0000 (23:31 +0530)]
util: perf: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
src/util/viralloc.h, define a new wrapper around an existing
cleanup function which will be called when a variable declared
with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant
viralloc.h include, since that has moved from the source module into
the header.

When a variable of type virPerfPtr is declared using VIR_AUTOPTR,
the function virPerfFree will be run automatically on it when it
goes out of scope.

This commit also adds an intermediate typedef for virPerf
type for use with the cleanup macros.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>