]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agotests/domaincaps: Move most of DO_TEST_QEMU() into a function
Andrea Bolognani [Tue, 22 Oct 2019 14:27:21 +0000 (16:27 +0200)]
tests/domaincaps: Move most of DO_TEST_QEMU() into a function

Macros become less and less appealing the more work you perform
inside them: DO_TEST_QEMU() has arguably already crossed that
threshold, and we're going to add even more code later on.

While factoring the code out of the macro, convert it to use the
GLib string manipulation functions and take advantage of autofree.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests/domaincaps: Don't mess with test name
Andrea Bolognani [Tue, 22 Oct 2019 12:22:22 +0000 (14:22 +0200)]
tests/domaincaps: Don't mess with test name

Requiring the user to provide the final string themselves will
make subsequent changes easier to implement.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests: Rename domaincapsschemadata/ -> domaincapsdata/
Andrea Bolognani [Tue, 22 Oct 2019 12:36:41 +0000 (14:36 +0200)]
tests: Rename domaincapsschemadata/ -> domaincapsdata/

The usual convention is to use ${foo}test.c for the test program
itself and either ${foo}data/ or ${foo}outdata/, depending on
whether it contains both input and output files or only the latter,
for the corresponding data directory.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests: testQemuCapsIterate: Pass prefix and version to callback
Andrea Bolognani [Tue, 22 Oct 2019 14:08:10 +0000 (16:08 +0200)]
tests: testQemuCapsIterate: Pass prefix and version to callback

Right now we're passing a "base" string that contains both,
separated by an underscore. Some changes that we're going to
introduce later will require us to have the version number on its
own, and instead of delegating the task of splitting the two apart
to the callback it make more sense to perform it upfront.

This change results in quite a bit of churn because we're now
using the version number only, without the prefix, to calculate
the dummy microcodeVersion.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests: testQemuCapsIterate: Pass suffix to callback
Andrea Bolognani [Tue, 22 Oct 2019 13:44:37 +0000 (15:44 +0200)]
tests: testQemuCapsIterate: Pass suffix to callback

Right now users need to hardcode the suffix, which is not a big
deal since they're the ones who passed it to testQemuCapsIterate()
in the first place; however, since we're already passing most of
the information to the callback and we're going to add more later
on, it makes sense to be consistent and pass the suffix too.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests: testQemuCapsIterate: Pass inputDir to callback
Andrea Bolognani [Tue, 22 Oct 2019 13:34:10 +0000 (15:34 +0200)]
tests: testQemuCapsIterate: Pass inputDir to callback

Right now users need to know input file live inside
TEST_QEMU_CAPS_PATH, which is bad layering.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests: testQemuCapsIterate: Validate suffix
Andrea Bolognani [Tue, 22 Oct 2019 16:34:03 +0000 (18:34 +0200)]
tests: testQemuCapsIterate: Validate suffix

We're going to depend on the fact that the suffix starts with a
dot later on, so we better ensure that it does.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests: testQemuCapsIterate: Don't ignore malformed file names
Andrea Bolognani [Tue, 22 Oct 2019 16:31:09 +0000 (18:31 +0200)]
tests: testQemuCapsIterate: Don't ignore malformed file names

If files whose name doesn't follow the expected format are added
to the repository, it's better to make the test suite fail than to
silently ignore them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests/qemucapabilities: Separate inputDir and outputDir
Andrea Bolognani [Tue, 22 Oct 2019 13:31:37 +0000 (15:31 +0200)]
tests/qemucapabilities: Separate inputDir and outputDir

We'll need this later.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agobuild: src: fix libtool dependency issue
Pavel Hrdina [Thu, 24 Oct 2019 10:11:18 +0000 (12:11 +0200)]
build: src: fix libtool dependency issue

Libtool gets a wrong order of arguments of libraries to install and it
fails when installing libvirt-admin.so that libvirt.so is not yet
installed.  Caused by commit <3097282d8668693eb4b7c3fb1b4fe5b474996b9c>.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoDrop needless ret variable
Michal Privoznik [Thu, 17 Oct 2019 08:10:10 +0000 (10:10 +0200)]
Drop needless ret variable

In few places we have the following code pattern:

  int ret;
  ... /* @ret is not accessed here */
  ret = f(...);
  return ret;

This pattern can be written less verbose:

  ...
  return f(...);

This patch was generated with following coccinelle spatch:

  @@
  type T;
  constant C;
  expression f;
  identifier ret;
  @@
  -T ret = C;
   ... when != ret
  -ret = f;
  -return ret;
  +return f;

Afterwards I needed to fix a few places, e.g. comment in
virDomainNetIPParseXML() was removed too because coccinelle
thinks it refers to @ret while in fact it doesn't. Also in few
places it replaced @ret declaration with a few spaces instead of
removing the line. But nothing terribly wrong.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years ago.gitignore: Ignore src/admin/libvirt_admin.{def,syms}
Michal Privoznik [Wed, 23 Oct 2019 13:10:56 +0000 (15:10 +0200)]
.gitignore: Ignore src/admin/libvirt_admin.{def,syms}

In v5.8.0-332-g3097282d86 the libvirt-admin.so was moved into
src/admin/ directory. However, corresponding .gitignore change
was left out.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu_command: Change logic in qemuVirCommandGet{FDSet,GetDevSet}
Michal Privoznik [Sat, 19 Oct 2019 11:19:32 +0000 (13:19 +0200)]
qemu_command: Change logic in qemuVirCommandGet{FDSet,GetDevSet}

These two functions have pattern that's preventing us from
simpler virAsprintf() -> g_strdup_printf() transition. Modify
their logic a bit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agosrc: Don't rely on virAsprintf() returning string length
Michal Privoznik [Sat, 19 Oct 2019 10:09:32 +0000 (12:09 +0200)]
src: Don't rely on virAsprintf() returning string length

In a few places our code relies on the fact that virAsprintf()
not only prints to allocated string but also that it returns the
length of that string. Fortunately, only few such places were
identified:

  https://www.redhat.com/archives/libvir-list/2019-September/msg01382.html

In case of virNWFilterSnoopLeaseFileWrite() and virFilePrintf()
we can use strlen() right after virAsprintf() to calculate the
length. In case of virDoubleToStr() it's only caller checks for
error case only, so we can limit the set of returned values to
just [-1, 0].

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: generate files into build dir and stop distributing them
Pavel Hrdina [Fri, 18 Oct 2019 15:21:06 +0000 (17:21 +0200)]
docs: generate files into build dir and stop distributing them

Historically we did not support VPATH builds and everything was
generated into source directory.  The introduction of VPATH builds did
not changed the way how our documentation is handled.

This patch changes the rules to generate everything into build
directory and stops distributing generated files in order to have
properly separated VPATH builds.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: apibuild: remove old code paths
Pavel Hrdina [Fri, 18 Oct 2019 15:20:30 +0000 (17:20 +0200)]
docs: apibuild: remove old code paths

There is no need to keep old compatibility code around as it it will
never be used in our current source tree.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoinclude: stop distributing generated source files
Pavel Hrdina [Thu, 17 Oct 2019 12:05:36 +0000 (14:05 +0200)]
include: stop distributing generated source files

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agosrc: move nodist_libvirt_driver_remote_la_SOURCES into remote Makefile
Pavel Hrdina [Thu, 17 Oct 2019 12:30:05 +0000 (14:30 +0200)]
src: move nodist_libvirt_driver_remote_la_SOURCES into remote Makefile

Commit <124f06534c65618b1eeeee07bb26182ab8e30119> moved remote related
build rules into separate makefile but forgot to move this part as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agobuild: move admin code into admin directory
Pavel Hrdina [Tue, 15 Oct 2019 10:41:29 +0000 (12:41 +0200)]
build: move admin code into admin directory

There is no need to have the libvirt-admin.so library definition in the
src directory.  In addition the library uses directly code from admin
sub-directory so move the remaining bits there as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agologging: separate log driver code into libvirt_driver_log.la
Pavel Hrdina [Fri, 11 Oct 2019 06:10:38 +0000 (08:10 +0200)]
logging: separate log driver code into libvirt_driver_log.la

Follow the same pattern as for other sub-directories where we create a
static library that is linked into libvirt.so.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: separate lock driver code into libvirt_driver_lock.la
Pavel Hrdina [Fri, 11 Oct 2019 06:00:38 +0000 (08:00 +0200)]
locking: separate lock driver code into libvirt_driver_lock.la

Follow the same pattern as for other sub-directories where we create a
static library that is linked into libvirt.so.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agom4: virt-selinux: remove obsolete checks
Pavel Hrdina [Wed, 9 Oct 2019 14:43:53 +0000 (16:43 +0200)]
m4: virt-selinux: remove obsolete checks

All OSes that we support have libselinux >= 2.5 except for Ubuntu 16.04
where the version is 2.4.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agom4: virt-netcf: bump minimal version to 0.1.8
Pavel Hrdina [Wed, 9 Oct 2019 12:47:34 +0000 (14:47 +0200)]
m4: virt-netcf: bump minimal version to 0.1.8

This version is available on all supported OSes and includes the
transaction APIs.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agom4: virt-libnl: drop libnl-1.0 support
Pavel Hrdina [Wed, 9 Oct 2019 12:36:32 +0000 (14:36 +0200)]
m4: virt-libnl: drop libnl-1.0 support

All supported OSes have libnl-3.0 and netcf uses it so there is no need
to keep libnl-1.0 compatibility code.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agom4: virt-driver-libxl: remove Fedora 28 check
Pavel Hrdina [Wed, 9 Oct 2019 12:09:38 +0000 (14:09 +0200)]
m4: virt-driver-libxl: remove Fedora 28 check

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodomain_conf: Relax SCSI addr used check
Michal Privoznik [Wed, 28 Aug 2019 09:41:49 +0000 (11:41 +0200)]
domain_conf: Relax SCSI addr used check

In domain_conf.c we have virDomainSCSIDriveAddressIsUsed()
function which returns true or false if given drive address is
already in use for given domain config or not. However, it also
takes a shortcut and returns true (meaning address in use) if the
unit number equals 7. This is because for some controllers this
is reserved address. The limitation comes mostly from vmware and
applies to lsilogic, buslogic, spapr-vscsi and vmpvscsi models.
On the other hand, we were not checking for the maximum unit
number (aka LUN number) which is also relevant and differs from
model to model.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodomain_conf: Make virDomainDeviceFindSCSIController accept virDomainDeviceDriveAddres...
Michal Privoznik [Tue, 10 Sep 2019 14:45:47 +0000 (16:45 +0200)]
domain_conf: Make virDomainDeviceFindSCSIController accept virDomainDeviceDriveAddress struct

So far, the virDomainDeviceFindSCSIController() takes
virDomainDeviceInfo structure which is an overkill. It assumes
that the passed structure is type of
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE which is not obvious.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: hacking: fix typo
Ján Tomko [Fri, 18 Oct 2019 22:03:51 +0000 (00:03 +0200)]
docs: hacking: fix typo

s/verca/versa/

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: amend push-without-review rules
Ján Tomko [Fri, 18 Oct 2019 21:19:42 +0000 (23:19 +0200)]
docs: hacking: amend push-without-review rules

Include the 'semi-automatic' updates in the list of patches pushed
at maintainers' discretion to match current practice.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: extend goto documentation
Ján Tomko [Fri, 18 Oct 2019 21:17:51 +0000 (23:17 +0200)]
docs: hacking: extend goto documentation

Replace reference to VIR_FREE with g_free and mention the use
of g_auto cleanup attributes that eliminate most of label use.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: remove reference to ATTRIBUTE_FORMAT
Ján Tomko [Fri, 18 Oct 2019 21:16:46 +0000 (23:16 +0200)]
docs: hacking: remove reference to ATTRIBUTE_FORMAT

Prefer G_GNUC_PRINTF.

Also, pick another example than virAsprintf since it may get
removed in the future.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: document string concatenations
Ján Tomko [Fri, 18 Oct 2019 21:15:38 +0000 (23:15 +0200)]
docs: hacking: document string concatenations

Recommend GString for generic strings and virBuffer for strings
that need helpers for other uses, like XML or command line
formatting.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: document preferred strdup alternatives
Ján Tomko [Fri, 18 Oct 2019 21:14:40 +0000 (23:14 +0200)]
docs: hacking: document preferred strdup alternatives

Recommend g_str(n)dup instead of VIR_STRDUP.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: mention GLib alternatives of libvirt string allocation macros
Ján Tomko [Fri, 18 Oct 2019 21:12:19 +0000 (23:12 +0200)]
docs: hacking: mention GLib alternatives of libvirt string allocation macros

Document the preferred alternatives to existing libvirt macros for
allocating strings. These cannot be deleted just yet because
converting them will require a lot of work.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: mention GLib alternatives of libvirt allocation macros
Ján Tomko [Fri, 18 Oct 2019 21:12:19 +0000 (23:12 +0200)]
docs: hacking: mention GLib alternatives of libvirt allocation macros

Document the preferred alternatives to existing libvirt macros for
memory allocation. These cannot be deleted just yet because
converting them will require a lot of work.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: mention compiler annotations
Ján Tomko [Fri, 18 Oct 2019 21:12:19 +0000 (23:12 +0200)]
docs: hacking: mention compiler annotations

Mention all the __attribute__ annotations we use to make the compiler
and/or the static analysis tools understand the code better.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: extend the table of removed libvirt macros
Ján Tomko [Fri, 18 Oct 2019 21:10:28 +0000 (23:10 +0200)]
docs: hacking: extend the table of removed libvirt macros

Mention the various ATTRIBUTE* macros and ARRAY_CARDINALITY
that were removed earlier.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: demonstrate the powers of VIR_TEST_RANGE
Ján Tomko [Fri, 18 Oct 2019 21:03:27 +0000 (23:03 +0200)]
docs: hacking: demonstrate the powers of VIR_TEST_RANGE

Mention a more complex example.

Invoke the test without 'make' since the mentioned example
does not seem to be working anymore.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: remove notes about -Werror
Ján Tomko [Fri, 18 Oct 2019 20:59:49 +0000 (22:59 +0200)]
docs: hacking: remove notes about -Werror

Our HACKING file is clear about requiring submission from a git
checkout, which automatically enables -Werror.

Remove the mentions of explicitly enabling it to alleviate
the collective cognitive encumbrance.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: emphasize some sections
Ján Tomko [Fri, 18 Oct 2019 20:57:23 +0000 (22:57 +0200)]
docs: hacking: emphasize some sections

Namely:
* holding up the first-time patch submissions for moderation,
  which might cause first-time submitters to question the process
* not CC-ing individual developers

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: mention git-publish prominently
Ján Tomko [Fri, 18 Oct 2019 20:55:05 +0000 (22:55 +0200)]
docs: hacking: mention git-publish prominently

This tool takes care of many of the tedious parts of submitting
a patch. Mention it first, above the "manual" way using
git send-email.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: hacking: remove note about rename detection
Ján Tomko [Fri, 18 Oct 2019 19:29:24 +0000 (21:29 +0200)]
docs: hacking: remove note about rename detection

It has been enabled by default for over three years now:

commit 5d2a30d7d8777319c745804f040fa405d02169ce
Author:     Junio C Hamano <gitster@pobox.com>
CommitDate: 2016-04-03 10:29:22 -0700

    Merge branch 'mm/diff-renames-default'

https://github.com/git/git/commit/5d2a30d7d8777319c745804f040fa405d02169ce

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agolibxl_domain: Use g_autoptr for libxlDriverConfig
Michal Privoznik [Sat, 19 Oct 2019 11:16:54 +0000 (13:16 +0200)]
libxl_domain: Use g_autoptr for libxlDriverConfig

This simplifies some functions, but mostly
libxlDomainManagedSavePath() which is going to be modified in
future commits.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agom4: Improve portability for non-bash shells
Maya Rashish [Sat, 19 Oct 2019 11:46:33 +0000 (11:46 +0000)]
m4: Improve portability for non-bash shells

= and == are both operators to test for string equality in bash,
but only = is required by POSIX.

Signed-off-by: Maya Rashish <coypu@sdf.org>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agobhyve: Ignore test_libvirtd_bhyve.aug
Michal Privoznik [Tue, 22 Oct 2019 06:58:11 +0000 (08:58 +0200)]
bhyve: Ignore test_libvirtd_bhyve.aug

The file is generated during build, but not ignored.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agobhyve_conf: Drop unused 'error' label in virBhyveDriverConfigNew()
Michal Privoznik [Tue, 22 Oct 2019 06:52:04 +0000 (08:52 +0200)]
bhyve_conf: Drop unused 'error' label in virBhyveDriverConfigNew()

There's unused 'error' label left after transition from
VIR_STRDUP() to g_strdup (v5.8.0-255-g652cdbe364).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: block: Don't query monitor in qemuBlockStorageSourceCreateDetectSize
Peter Krempa [Thu, 10 Oct 2019 13:02:00 +0000 (15:02 +0200)]
qemu: block: Don't query monitor in qemuBlockStorageSourceCreateDetectSize

Calling the monitor was convenient for the implementation in
qemuDomainBlockCopyCommon, but causes the snapshot code to call
query-named-block-nodes for every disk.

Fix this by removing the monitor call from
qemuBlockStorageSourceCreateDetectSize so that the data can be reused in
loops.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: monitor: Introduce new interface to query-named-block-nodes
Peter Krempa [Wed, 9 Oct 2019 12:13:10 +0000 (14:13 +0200)]
qemu: monitor: Introduce new interface to query-named-block-nodes

Retrieve data for individual block nodes in a hash table. Currently only
capacity and allocation data is extracted but this will be extended in
the future.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agoutil: hash: Introduce virHashHasEntry
Peter Krempa [Thu, 17 Oct 2019 12:45:47 +0000 (14:45 +0200)]
util: hash: Introduce virHashHasEntry

Add a helper that checks whether an entry with given name exists but
does not touch the userdata.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agoutil: hash: Add new constructor 'virHashNew'
Peter Krempa [Wed, 9 Oct 2019 13:34:54 +0000 (15:34 +0200)]
util: hash: Add new constructor 'virHashNew'

Add a simpler constructor for hash tables which specifically does not
require specifying the initial hash size and uses simpler freeing
function.

The initial hash table size usually is not important as the hash table
is growing when it reaches certain number of entries in one bucket.
Additionally many callers pass in a random small number for ad-hoc table
use so using a central one will simplify things.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agoutil: hash: Add possibility to use simpler data free function in virHash
Peter Krempa [Wed, 9 Oct 2019 13:26:37 +0000 (15:26 +0200)]
util: hash: Add possibility to use simpler data free function in virHash

Introduce a new type virHashDataFreeSimple which has only a void * as
argument for cases when knowing the name of the entry when freeing the
hash entry is not required.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agoReplace virDomainDiskByName by virDomainDiskByTarget in appropriate cases
Peter Krempa [Mon, 14 Oct 2019 15:24:20 +0000 (17:24 +0200)]
Replace virDomainDiskByName by virDomainDiskByTarget in appropriate cases

In many cases we used virDomainDiskByName to solely look up disk by
target. We have a new helper now so we can replace it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoconf: Remove unused virDomainDiskFindByBusAndDst
Peter Krempa [Mon, 14 Oct 2019 15:19:15 +0000 (17:19 +0200)]
conf: Remove unused virDomainDiskFindByBusAndDst

Previous commit removed last use of this function so we can get rid of
it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: Replace use of virDomainDiskFindByBusAndDst with virDomainDiskByTarget
Peter Krempa [Mon, 14 Oct 2019 15:17:16 +0000 (17:17 +0200)]
qemu: Replace use of virDomainDiskFindByBusAndDst with virDomainDiskByTarget

In both replaced cases we have other code that verifies that the bus
can't be changed or that the target is unique, so limiting the search to
disks with same bus makes no sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoconf: Introduce virDomainDiskByTarget
Peter Krempa [Mon, 14 Oct 2019 14:54:53 +0000 (16:54 +0200)]
conf: Introduce virDomainDiskByTarget

Introduce a simpler replacement for virDomainDiskByName when looking up
by disk target.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoconf: Remove virDomainDiskPathByName
Peter Krempa [Mon, 14 Oct 2019 14:47:21 +0000 (16:47 +0200)]
conf: Remove virDomainDiskPathByName

Last use was removed in 29682196d8f.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: domain: Tolerate NULL @disk in qemuDomainPrepareDiskSourceData
Peter Krempa [Tue, 8 Oct 2019 13:17:32 +0000 (15:17 +0200)]
qemu: domain: Tolerate NULL @disk in qemuDomainPrepareDiskSourceData

In some cases we want to prepare a @src which is not meant to belong to
a disk and thus does not require us to copy the data. Allow passing in
NULL @disk into qemuDomainPrepareDiskSourceData.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: domain: clarify sematics of qemuDomainPrepareDiskSourceData
Peter Krempa [Tue, 8 Oct 2019 13:16:41 +0000 (15:16 +0200)]
qemu: domain: clarify sematics of qemuDomainPrepareDiskSourceData

Note in the comment that this function prepares the storage source based
on the configuration of the disk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: domain: Remove pointless return value in qemuDomainPrepareDiskSourceData
Peter Krempa [Tue, 8 Oct 2019 13:14:22 +0000 (15:14 +0200)]
qemu: domain: Remove pointless return value in qemuDomainPrepareDiskSourceData

The function does not do anything that could fail. Remove the return
value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: domain: Split out setup of virStorageSource from qemu driver config
Peter Krempa [Tue, 8 Oct 2019 12:58:48 +0000 (14:58 +0200)]
qemu: domain: Split out setup of virStorageSource from qemu driver config

qemuDomainPrepareDiskSourceData historically prepared everything but
we've split out the majority of the functionality so that it sets up
predominately only according to the configuration of the disk. There
was one leftover bit of setting the gluster debug level from the config.

Split this out into a separate function so that
qemuDomainPrepareDiskSourceData only prepares based on the disk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agotests: Add test case for empty 'network' cdrom
Peter Krempa [Tue, 15 Oct 2019 13:19:58 +0000 (15:19 +0200)]
tests: Add test case for empty 'network' cdrom

We don't allow such config in the schema but the code can handle that so
add a test case supporting it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: Reset disk type if <source> element is completely missing
Peter Krempa [Tue, 15 Oct 2019 13:21:21 +0000 (15:21 +0200)]
conf: Reset disk type if <source> element is completely missing

The disk type is not part of source and thus it's parsed earlier. This
bypasses the checks when parsing a disk type='network' if it's
completely missing the source.

Since there are possible active users of this (it was reported as a
problem with openstack) fix it by resetting the disk type to '_FILE' for
an empty cdrom which is handled correctly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemuDomainGetHostdevPath: Drop @freeTmpPath
Michal Privoznik [Tue, 17 Sep 2019 09:25:03 +0000 (11:25 +0200)]
qemuDomainGetHostdevPath: Drop @freeTmpPath

The @freeTmpPath boolean is used to determine if @tmpPath holds
an allocated memory or is a pointer to a constant string and
therefore if it needs to be freed or not when returning from the
function. Well, we can unify the way we set @tmpPath so that it
always holds an allocated memory and thus always must be freed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu_domain: Drop few useless checks in qemuDomainGetHostdevPath
Michal Privoznik [Tue, 17 Sep 2019 09:20:42 +0000 (11:20 +0200)]
qemu_domain: Drop few useless checks in qemuDomainGetHostdevPath

There are three cases where vir*DeviceGetPath() returns a const
string. In these cases, the string is initialized in
corresponding vir*DeviceNew() calls which fail if string couldn't
be allocated. There's no point in checking the second time if the
string is NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu_cgroup: Teardown Cgroup for more host device types
Michal Privoznik [Tue, 17 Sep 2019 08:39:00 +0000 (10:39 +0200)]
qemu_cgroup: Teardown Cgroup for more host device types

Since its introduction in v1.0.5-rc1-19-g6e13860cb4 the
qemuTeardownHostdevCgroup() does nothing unless the passed
hostdev is a PCI device with VFIO backend. This seems
unnecessary.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu: Introduce qemuDomainNeedsVFIO
Michal Privoznik [Mon, 16 Sep 2019 15:14:48 +0000 (17:14 +0200)]
qemu: Introduce qemuDomainNeedsVFIO

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu_hostdev: Introduce qemuHostdevNeedsVFIO()
Michal Privoznik [Tue, 17 Sep 2019 07:33:28 +0000 (09:33 +0200)]
qemu_hostdev: Introduce qemuHostdevNeedsVFIO()

There are two types of host devices that require /dev/vfio/vfio
access:

  1) PCI devices with VFIO backend
  2) Mediated devices

Introduce a simple helper that returns true if passed @hostdev
falls in either of the categories.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoconf: Introduce virDomainDefHasMdevHostdev
Michal Privoznik [Tue, 17 Sep 2019 05:54:32 +0000 (07:54 +0200)]
conf: Introduce virDomainDefHasMdevHostdev

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agovirhostdev: Introduce and use virHostdevIsVFIODevice
Michal Privoznik [Tue, 6 Aug 2019 14:25:12 +0000 (16:25 +0200)]
virhostdev: Introduce and use virHostdevIsVFIODevice

In some places we need to check if a hostdev has VFIO backend.
Because of how complicated virDomainHostdevDef structure is, the
check consists of three lines. Move them to a function and
replace all checks with the function call.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agovirhostdev: Fix const correctness of virHostdevIs{PCINet,SCSI,Mdev}Device()
Michal Privoznik [Tue, 6 Aug 2019 13:38:06 +0000 (15:38 +0200)]
virhostdev: Fix const correctness of virHostdevIs{PCINet,SCSI,Mdev}Device()

These functions do not change any of the passed hostdevs. They
just read them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoUse g_strdup instead of VIR_STRDUP everywhere
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
Use g_strdup instead of VIR_STRDUP everywhere

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotools: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
tools: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
tests: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovbox: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
vbox: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoutil: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
util: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovircgroup: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
vircgroup: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovirstorage: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
virstorage: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotest: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
test: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agostorage: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
storage: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agosecurity: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
security: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agorpc: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
rpc: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoremote: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
remote: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
qemu: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonwfilter: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
nwfilter: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonode_device: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
node_device: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonetwork: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
network: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolxc: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
lxc: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agologging: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
logging: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolocking: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
locking: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolibxl: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
libxl: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agointerface: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
interface: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoesx: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
esx: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodatatypes: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
datatypes: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agocpu: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
cpu: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
conf: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agobhyve: use g_strdup instead of VIR_STRDUP
Ján Tomko [Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)]
bhyve: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoUse g_strdup to fill in default values
Ján Tomko [Fri, 18 Oct 2019 13:08:21 +0000 (15:08 +0200)]
Use g_strdup to fill in default values

Replace:
  if (!s && VIR_STRDUP(s, str) < 0)
    goto;
with:
  if (!s)
    s = g_strdup(str);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoUse g_strdup where VIR_STRDUP's return value was propagated
Ján Tomko [Sun, 20 Oct 2019 10:55:05 +0000 (12:55 +0200)]
Use g_strdup where VIR_STRDUP's return value was propagated

All the callers of these functions only check for a negative
return value.

However, virNetDevOpenvswitchGetVhostuserIfname is documented
as returning 1 for openvswitch interfaces so preserve that.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodrivers: use g_strdup in probe functions
Ján Tomko [Sun, 20 Oct 2019 10:41:35 +0000 (12:41 +0200)]
drivers: use g_strdup in probe functions

The callers expect '1' on a successful probe,
so return 1 just like VIR_STRDUP would.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoUse g_strdup instead of ignoring VIR_STRDUP_QUIET's value
Ján Tomko [Fri, 18 Oct 2019 11:27:03 +0000 (13:27 +0200)]
Use g_strdup instead of ignoring VIR_STRDUP_QUIET's value

Replace all the occurrences of
  ignore_value(VIR_STRDUP_QUIET(a, b));
with
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>