[libvirt] [PATCH v2 0/2] Alter qemu live/cold device attach algorithm
by John Ferlan
v1: https://www.redhat.com/archives/libvir-list/2018-June/msg00465.html
The first patch is essentially a repeat of the v1 patch, but with
a more correct commit message. During testing if the same address
was supplied for the --config it wasn't checked.
The second patch rearranges qemuDomainAttachDeviceLiveAndConfig to
perform CONFIG and LIVE actions separately since the generated
@devConf or @devLive could be different depending on whether the
incoming XML has an <address> or not and whether the corresponding
domain parse and post parse algorithms need to generate some sort
of address for the device.
John Ferlan (2):
qemu: Check for existing hostdev address for cold attach device
qemu: Use the correct vm def on cold attach
src/qemu/qemu_driver.c | 58 +++++++++++++++++++++++++-------------------------
1 file changed, 29 insertions(+), 29 deletions(-)
--
2.14.4
6 years, 5 months
[libvirt] [PATCH] set-lifecycle-action: add description of type and action
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
In [1], <type> are described as "on_poweroff",
"on_reboot", "on_crash".
but we accept "poweroff", "reboot" and "crash".
This patch adds docs about them.
[1]: https://libvirt.org/formatdomain.html#elementsEvents
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
tools/virsh.pod | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 7cb8c8a6e4..1b479f318d 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2414,8 +2414,12 @@ the B<virsh dominfo> command.
=item B<set-lifecycle-action> I<domain> I<type> I<action>
[[I<--config>] [I<--live>] | [I<--current>]]
-Set the lifecycle I<action> for specified lifecycle I<type>. For the list of
-lifecycle types and actions and possible combinations see the documentation at
+Set the lifecycle I<action> for specified lifecycle I<type>.
+The valid I<type> are "poweroff", "reboot" and "crash", each of them
+allow valid I<action> are "destroy", "restart", "rename-restart", "preserve".
+For I<type> "crash", additional actions "coredump-destroy"
+and "coredump-restart" are supported. For the list of lifecycle types
+and actions and possible combinations see the documentation at
L<https://libvirt.org/formatdomain.html#elementsEvents>.
=item B<set-user-password> I<domain> I<user> I<password> [I<--encrypted>]
--
2.17.1
6 years, 5 months
[libvirt] [PATCH v3 00/10] Storage encryption adjustments
by John Ferlan
v2: https://www.redhat.com/archives/libvir-list/2018-May/msg01268.html
Try #3 - this time since Peter removed support for qcow encrypted
volumes for domains, I'm taking the same approach for storage.
This is totally different from the previous approach which tried to
actually create a qcow2 encrypted volume. This time slowly extricate
the qcow2 encryption support from the storage driver - at least anything
that can have a result via qemu-img.
Additionally, added some more luks tests and added the capability
to create a luks encrypted volume from a raw image using the two
step process that was part of v2.
John Ferlan (10):
storage: Don't allow encryption secretPath to be NULL
tests: Add luks creation examples to storagevolxml2argvtest
storage: Rename encryption info variable for clarity
tests: Remove qcow2 encryption from storagevol tests
storage: Disallow create/resize of qcow2 encrypted images
storage: Clean up storageBackendCreateQemuImgCheckEncryption
storage: Clean up storageBackendCreateQemuImgOpts
storage: Remove storageBackendGenerateSecretData
storage: Add support for using inputvol for encryption
docs: Add news article for volume encryption modifications
docs/formatsecret.html.in | 22 +-
docs/formatstorageencryption.html.in | 29 +-
docs/news.xml | 25 ++
src/storage/storage_util.c | 303 +++++++--------------
src/storage/storage_util.h | 10 +-
src/util/virqemu.c | 26 +-
tests/storagevolxml2argvdata/luks-cipher.argv | 5 +
tests/storagevolxml2argvdata/luks-convert.argv | 9 +
tests/storagevolxml2argvdata/luks.argv | 4 +
tests/storagevolxml2argvdata/qcow2-1.1.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-compat.argv | 2 +-
.../qcow2-from-logical-compat.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-lazy.argv | 2 +-
.../qcow2-nobacking-convert-prealloc-compat.argv | 2 +-
.../qcow2-nobacking-prealloc-compat.argv | 2 +-
.../qcow2-nocapacity-convert-prealloc.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-nocapacity.argv | 2 +-
.../storagevolxml2argvdata/qcow2-nocow-compat.argv | 2 +-
tests/storagevolxml2argvtest.c | 76 +++++-
tests/storagevolxml2xmlin/vol-luks-convert.xml | 21 ++
tests/storagevolxml2xmlin/vol-qcow2-0.10-lazy.xml | 3 -
tests/storagevolxml2xmlin/vol-qcow2-1.1.xml | 3 -
tests/storagevolxml2xmlin/vol-qcow2-encryption.xml | 31 +++
tests/storagevolxml2xmlin/vol-qcow2-lazy.xml | 3 -
tests/storagevolxml2xmlin/vol-qcow2-nobacking.xml | 3 -
.../vol-qcow2-nocapacity-backing.xml | 3 -
tests/storagevolxml2xmlin/vol-qcow2-nocapacity.xml | 3 -
tests/storagevolxml2xmlin/vol-qcow2-nocow.xml | 3 -
tests/storagevolxml2xmlin/vol-qcow2.xml | 3 -
tests/storagevolxml2xmlout/vol-qcow2-0.10-lazy.xml | 3 -
tests/storagevolxml2xmlout/vol-qcow2-1.1.xml | 3 -
.../storagevolxml2xmlout/vol-qcow2-encryption.xml | 31 +++
tests/storagevolxml2xmlout/vol-qcow2-lazy.xml | 3 -
tests/storagevolxml2xmlout/vol-qcow2-nobacking.xml | 3 -
.../storagevolxml2xmlout/vol-qcow2-nocapacity.xml | 3 -
tests/storagevolxml2xmlout/vol-qcow2-nocow.xml | 3 -
tests/storagevolxml2xmlout/vol-qcow2.xml | 3 -
tests/storagevolxml2xmltest.c | 1 +
38 files changed, 344 insertions(+), 312 deletions(-)
create mode 100644 tests/storagevolxml2argvdata/luks-cipher.argv
create mode 100644 tests/storagevolxml2argvdata/luks-convert.argv
create mode 100644 tests/storagevolxml2argvdata/luks.argv
create mode 100644 tests/storagevolxml2xmlin/vol-luks-convert.xml
create mode 100644 tests/storagevolxml2xmlin/vol-qcow2-encryption.xml
create mode 100644 tests/storagevolxml2xmlout/vol-qcow2-encryption.xml
--
2.14.4
6 years, 5 months
[libvirt] [PATCH 0/7] qemu: Support page size tuning for pSeries guests
by Andrea Bolognani
This applies cleanly on top of a0d6894af1b1.
Patch 1/7 is too big to go through the list; it can be fetched,
along with the rest of the series, from [1].
Patch 2/7 conflicts with patch 1/3 from [2], but making this one
depend on it didn't feel right; whichever of the two series gets
reviewed and merged first, I'll probably post a rebase of the
other one immediately afterwards.
Changes from [RFC]:
* the QEMU interface has changed based on feedback, which means
some of the code is no longer useful and has been dropped;
* switched to virXMLFormatElement(), as suggested during review;
* added documentation and release notes entry.
[1] https://github.com/andreabolognani/libvirt/tree/pseries-hpt-maxpagesize
[2] https://www.redhat.com/archives/libvir-list/2018-June/msg01374.html
[RFC] https://www.redhat.com/archives/libvir-list/2018-May/msg01710.html
Andrea Bolognani (7):
tests: Add replies for QEMU 3.0.0 on ppc64
qemu: Add capability for the HPT maxpagesize feature
conf: Reintroduce virDomainDef::hpt_resizing
conf: Tweak HPT feature parsing and formatting
conf: Parse and format HPT maxpagesize
qemu: Format HPT maxpagesize on the command line
news: Update for HPT maxpagesize feature
docs/formatdomain.html.in | 11 +-
docs/news.xml | 11 +
docs/schemas/domaincommon.rng | 21 +-
src/conf/domain_conf.c | 60 +-
src/conf/domain_conf.h | 2 +
src/qemu/qemu_capabilities.c | 8 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 43 +-
src/qemu/qemu_domain.c | 2 +-
.../caps_2.12.0.aarch64.replies | 48 +-
.../caps_2.12.0.aarch64.xml | 2 +-
.../caps_2.12.0.ppc64.replies | 197 +-
.../caps_2.12.0.ppc64.xml | 2 +-
.../caps_2.12.0.s390x.replies | 52 +-
.../caps_2.12.0.s390x.xml | 2 +-
.../caps_2.12.0.x86_64.replies | 64 +-
.../caps_2.12.0.x86_64.xml | 2 +-
...ppc64.replies => caps_3.0.0.ppc64.replies} | 5268 ++++++++++-------
..._2.12.0.ppc64.xml => caps_3.0.0.ppc64.xml} | 19 +-
tests/qemucapabilitiestest.c | 1 +
tests/qemuxml2argvdata/pseries-features.args | 3 +-
tests/qemuxml2argvdata/pseries-features.xml | 18 +-
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmloutdata/pseries-features.xml | 31 +-
tests/qemuxml2xmltest.c | 1 +
25 files changed, 3624 insertions(+), 2246 deletions(-)
copy tests/qemucapabilitiesdata/{caps_2.12.0.ppc64.replies => caps_3.0.0.ppc64.replies} (92%)
copy tests/qemucapabilitiesdata/{caps_2.12.0.ppc64.xml => caps_3.0.0.ppc64.xml} (99%)
mode change 120000 => 100644 tests/qemuxml2xmloutdata/pseries-features.xml
--
2.17.1
6 years, 5 months
[libvirt] [jenkins-ci PATCH v2] jobs: Change git URL to fast external mirrors
by Pavel Hrdina
We had our own local copy of all projects synchronized by cron on
the host where we have the CI VMs. This was to save the traffic from
libvirt.org repositories and to make the cloning for our Jenkins jobs
faster.
We might move our VMs into a cloud in future we would not be able to
have any local copy so this changes the git URL to use fast external
mirrors.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
v1: <https://www.redhat.com/archives/libvir-list/2018-June/msg01513.html>
jobs/autotools.yaml | 2 +-
jobs/generic.yaml | 2 +-
jobs/go.yaml | 2 +-
jobs/perl-modulebuild.yaml | 2 +-
jobs/python-distutils.yaml | 2 +-
projects/libosinfo.yaml | 1 +
projects/libvirt-cim.yaml | 1 +
projects/libvirt-dbus.yaml | 1 +
projects/libvirt-glib.yaml | 1 +
projects/libvirt-go-xml.yaml | 1 +
projects/libvirt-go.yaml | 1 +
projects/libvirt-perl.yaml | 1 +
projects/libvirt-python.yaml | 1 +
projects/libvirt-sandbox.yaml | 1 +
projects/libvirt-tck.yaml | 1 +
projects/libvirt.yaml | 1 +
projects/osinfo-db-tools.yaml | 1 +
projects/osinfo-db.yaml | 1 +
projects/virt-manager.yaml | 1 +
projects/virt-viewer.yaml | 1 +
20 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/jobs/autotools.yaml b/jobs/autotools.yaml
index f526ed2..c1d0f27 100644
--- a/jobs/autotools.yaml
+++ b/jobs/autotools.yaml
@@ -21,7 +21,7 @@
num-to-keep: 1000
scm:
- git:
- url: git://n64.pufty.ci.centos.org/{name}.git
+ url: '{git-url}'
branches:
- origin/{branch}
clean:
diff --git a/jobs/generic.yaml b/jobs/generic.yaml
index 3e20962..6c59c63 100644
--- a/jobs/generic.yaml
+++ b/jobs/generic.yaml
@@ -21,7 +21,7 @@
num-to-keep: 1000
scm:
- git:
- url: git://n64.pufty.ci.centos.org/{name}.git
+ url: '{git-url}'
branches:
- origin/{branch}
clean:
diff --git a/jobs/go.yaml b/jobs/go.yaml
index bffe56e..10518c4 100644
--- a/jobs/go.yaml
+++ b/jobs/go.yaml
@@ -21,7 +21,7 @@
num-to-keep: 1000
scm:
- git:
- url: git://n64.pufty.ci.centos.org/{name}.git
+ url: '{git-url}'
branches:
- origin/{branch}
clean:
diff --git a/jobs/perl-modulebuild.yaml b/jobs/perl-modulebuild.yaml
index 4a79bab..934b216 100644
--- a/jobs/perl-modulebuild.yaml
+++ b/jobs/perl-modulebuild.yaml
@@ -21,7 +21,7 @@
num-to-keep: 1000
scm:
- git:
- url: git://n64.pufty.ci.centos.org/{name}.git
+ url: '{git-url}'
branches:
- origin/{branch}
clean:
diff --git a/jobs/python-distutils.yaml b/jobs/python-distutils.yaml
index c075245..0b20b17 100644
--- a/jobs/python-distutils.yaml
+++ b/jobs/python-distutils.yaml
@@ -21,7 +21,7 @@
num-to-keep: 1000
scm:
- git:
- url: git://n64.pufty.ci.centos.org/{name}.git
+ url: '{git-url}'
branches:
- origin/{branch}
clean:
diff --git a/projects/libosinfo.yaml b/projects/libosinfo.yaml
index 8e3d105..22c957e 100644
--- a/projects/libosinfo.yaml
+++ b/projects/libosinfo.yaml
@@ -3,6 +3,7 @@
name: libosinfo
machines: '{all_machines}'
title: libosinfo
+ git-url: https://gitlab.com/libosinfo/libosinfo.git
jobs:
- autotools-build-job:
parent_jobs: 'osinfo-db-master-build'
diff --git a/projects/libvirt-cim.yaml b/projects/libvirt-cim.yaml
index dff3976..c6a7a6d 100644
--- a/projects/libvirt-cim.yaml
+++ b/projects/libvirt-cim.yaml
@@ -3,6 +3,7 @@
name: libvirt-cim
machines: '{rpm_machines}'
title: libvirt CIM
+ git-url: https://github.com/libvirt/libvirt-cim.git
jobs:
- autotools-build-job:
parent_jobs: 'libvirt-master-build'
diff --git a/projects/libvirt-dbus.yaml b/projects/libvirt-dbus.yaml
index c460db4..44d1b23 100644
--- a/projects/libvirt-dbus.yaml
+++ b/projects/libvirt-dbus.yaml
@@ -2,6 +2,7 @@
- project:
name: libvirt-dbus
title: Libvirt D-Bus
+ git-url: https://github.com/libvirt/libvirt-dbus.git
jobs:
- autotools-build-job:
parent_jobs: 'libvirt-glib-master-build'
diff --git a/projects/libvirt-glib.yaml b/projects/libvirt-glib.yaml
index 286d25b..f61ca1e 100644
--- a/projects/libvirt-glib.yaml
+++ b/projects/libvirt-glib.yaml
@@ -3,6 +3,7 @@
name: libvirt-glib
machines: '{all_machines}'
title: Libvirt GLib
+ git-url: https://github.com/libvirt/libvirt-glib.git
jobs:
- autotools-build-job:
parent_jobs: 'libvirt-master-build'
diff --git a/projects/libvirt-go-xml.yaml b/projects/libvirt-go-xml.yaml
index 8d9c16d..6eb7ef0 100644
--- a/projects/libvirt-go-xml.yaml
+++ b/projects/libvirt-go-xml.yaml
@@ -3,6 +3,7 @@
name: libvirt-go-xml
machines: '{all_machines}'
title: Libvirt Go XML
+ git-url: https://github.com/libvirt/libvirt-go-xml.git
jobs:
- go-build-job:
parent_jobs: 'libvirt-master-build'
diff --git a/projects/libvirt-go.yaml b/projects/libvirt-go.yaml
index f2eb87e..0495374 100644
--- a/projects/libvirt-go.yaml
+++ b/projects/libvirt-go.yaml
@@ -3,6 +3,7 @@
name: libvirt-go
machines: '{all_machines}'
title: Libvirt Go
+ git-url: https://github.com/libvirt/libvirt-go.git
jobs:
- go-build-job:
parent_jobs: 'libvirt-master-build'
diff --git a/projects/libvirt-perl.yaml b/projects/libvirt-perl.yaml
index 28288e8..956ba93 100644
--- a/projects/libvirt-perl.yaml
+++ b/projects/libvirt-perl.yaml
@@ -3,6 +3,7 @@
name: libvirt-perl
machines: '{all_machines}'
title: Libvirt Perl
+ git-url: https://github.com/libvirt/libvirt-perl.git
jobs:
- perl-modulebuild-build-job:
parent_jobs: 'libvirt-master-build'
diff --git a/projects/libvirt-python.yaml b/projects/libvirt-python.yaml
index 1e742da..fdc55e0 100644
--- a/projects/libvirt-python.yaml
+++ b/projects/libvirt-python.yaml
@@ -3,6 +3,7 @@
name: libvirt-python
machines: '{all_machines}'
title: Libvirt Python
+ git-url: https://github.com/libvirt/libvirt-python.git
jobs:
- python-distutils-build-job:
parent_jobs: 'libvirt-master-build'
diff --git a/projects/libvirt-sandbox.yaml b/projects/libvirt-sandbox.yaml
index bb8bda6..518080a 100644
--- a/projects/libvirt-sandbox.yaml
+++ b/projects/libvirt-sandbox.yaml
@@ -7,6 +7,7 @@
- libvirt-fedora-28
- libvirt-fedora-rawhide
title: Libvirt Sandbox
+ git-url: https://github.com/libvirt/libvirt-sandbox.git
jobs:
- autotools-build-job:
parent_jobs: 'libvirt-glib-master-build'
diff --git a/projects/libvirt-tck.yaml b/projects/libvirt-tck.yaml
index 065678d..c406fda 100644
--- a/projects/libvirt-tck.yaml
+++ b/projects/libvirt-tck.yaml
@@ -10,6 +10,7 @@
- libvirt-freebsd-10
- libvirt-freebsd-11
title: Libvirt TCK
+ git-url: https://github.com/libvirt/libvirt-tck.git
jobs:
- perl-modulebuild-build-job:
parent_jobs: 'libvirt-perl-master-build'
diff --git a/projects/libvirt.yaml b/projects/libvirt.yaml
index 7a8392e..c64ac5b 100644
--- a/projects/libvirt.yaml
+++ b/projects/libvirt.yaml
@@ -4,6 +4,7 @@
machines: '{all_machines}'
title: Libvirt
archive_format: xz
+ git-url: https://github.com/libvirt/libvirt.git
jobs:
- autotools-build-job:
parent_jobs:
diff --git a/projects/osinfo-db-tools.yaml b/projects/osinfo-db-tools.yaml
index cab85af..d4cef11 100644
--- a/projects/osinfo-db-tools.yaml
+++ b/projects/osinfo-db-tools.yaml
@@ -3,6 +3,7 @@
name: osinfo-db-tools
machines: '{all_machines}'
title: osinfo database tools
+ git-url: https://gitlab.com/libosinfo/osinfo-db-tools.git
jobs:
- autotools-build-job:
parent_jobs:
diff --git a/projects/osinfo-db.yaml b/projects/osinfo-db.yaml
index a197bbd..141a373 100644
--- a/projects/osinfo-db.yaml
+++ b/projects/osinfo-db.yaml
@@ -4,6 +4,7 @@
machines: '{all_machines}'
title: osinfo database
archive_format: xz
+ git-url: https://gitlab.com/libosinfo/osinfo-db.git
jobs:
- generic-build-job:
parent_jobs: 'osinfo-db-tools-master-build'
diff --git a/projects/virt-manager.yaml b/projects/virt-manager.yaml
index 74f7fc1..84a95a6 100644
--- a/projects/virt-manager.yaml
+++ b/projects/virt-manager.yaml
@@ -9,6 +9,7 @@
- libvirt-freebsd-10
- libvirt-freebsd-11
title: Virtual Machine Manager
+ git-url: https://github.com/virt-manager/virt-manager.git
jobs:
- python-distutils-build-job:
parent_jobs:
diff --git a/projects/virt-viewer.yaml b/projects/virt-viewer.yaml
index 633ac9a..12335f3 100644
--- a/projects/virt-viewer.yaml
+++ b/projects/virt-viewer.yaml
@@ -3,6 +3,7 @@
name: virt-viewer
machines: '{all_machines}'
title: Virt Viewer
+ git-url: https://pagure.io/virt-viewer.git
jobs:
- autotools-build-job:
parent_jobs: 'libvirt-glib-master-build'
--
2.17.1
6 years, 5 months
[libvirt] [PATCH] qemu: monitor: Fix memory leak in qemuMonitorJSONNBDServerStart()
by w00251574
Subject: [PATCH] qemu: monitor: Fix memory leak in qemuMonitorJSONNBDServerStart()
Exiting early through the return path did result in 'port_str'
being leaked.
Signed-off-by: Jie Wang <wangjie88.huawei.com>
---
src/qemu/qemu_monitor_json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index aa89ea7056..3e90279b71 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6540,7 +6540,7 @@ qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon,
return ret;
if (!(addr = qemuMonitorJSONBuildInetSocketAddress(host, port_str)))
- return ret;
+ goto cleanup;
if (!(cmd = qemuMonitorJSONMakeCommand("nbd-server-start",
"a:addr", &addr,
--
2.15.0.windows.1
6 years, 5 months
[libvirt] [PATCH 0/2] Deny live device alias change
by Michal Privoznik
*** BLURB HERE ***
Michal Privoznik (2):
qemuDomainUpdateDeviceFlags: Parse device as live if needed
conf: Forbid device alias change on device-update
src/conf/domain_conf.c | 12 +++++++++++-
src/conf/domain_conf.h | 3 ++-
src/lxc/lxc_driver.c | 6 +++---
src/qemu/qemu_driver.c | 28 ++++++++++++++++------------
4 files changed, 32 insertions(+), 17 deletions(-)
--
2.16.4
6 years, 5 months
[libvirt] [GSoC] Code design for scalar and external types
by Sukrit Bhatnagar
Hi,
I am starting this discussion thread as a continuation of my GSoC
weekly meeting with Erik and Pavel on 8th June.
I was going through src/util/virstring.c for adding cleanup macros and
saw that virStringListFree takes on char ** as an argument, and
equivalently, we declare a list of strings as char **.
For the cleanup function defined by VIR_DEFINE_AUTOPTR_FUNC, it is
required that the associated type has a name like virSomethingPtr.
It was also discussed that there are similar issues with DBus types,
but VIR_AUTOFREE can work there as we use VIR_ALLOC. I honestly don't
know much about that.
We discussed that we have two solutions:
- Create a virSomethingPtr by typedef-ing char**
As Pavel told, GLib has typedef gchar** GStrv; which is used together
with g_auto and it has g_strfreev(gchar **str_array) which is the same
as we have virStringListFree()
I have tried adding the following in src/util/virstrnig.h, and it
seems to work fine:
typedef char **virStringList;
VIR_DEFINE_AUTOPTR_FUNC(virStringList, virStringListFree)
We can use it as:
VIR_AUTOPTR(virStringList) lines = NULL;
There may be other scalar and external types where this problem
occurs, and it is not good to create a typedef for each of them, but
maybe we can make an exception for char ** and create a type for it.
- Overload VIR_AUTOFREE macro by making it variadic
As Erik told, we could make VIR_AUTOFREE a variadic macro whose
varying parameter can be the Free function name. If left blank, we use
virFree.
I went ahead with trying it and after reading some posts on
StackOverflow, I came up with this:
#define _VIR_AUTOFREE_0(type) __attribute__((cleanup(virFree))) type
#define _VIR_AUTOFREE_1(type, func) __attribute__((cleanup(func))) type
#define _VIR_AUTOFREE_OVERLOADER(_1, _2, NAME, ...) NAME
#define VIR_AUTOFREE(...) _VIR_AUTOFREE_OVERLOADER(__VA_ARGS__,
_VIR_AUTOFREE_1, _VIR_AUTOFREE_0)(__VA_ARGS__)
The required functionality is working as expected; passing only one
argument will use virFree, and passing two arguments will use the
function specified as 2nd argument. Passing more than 2 arguments will
result in an error.
The macros with _ prefix are meant to be for internal use only.
Also, @func needs to be a wrapper around virStringListFree as it will
take char ***, not just char **. We probably need to define a new
function.
Here we are specifying the Free function to use at the time of usage
of the VIR_AUTOFREE macro, which may make the code look bad:
VIR_AUTOFREE(char **, virStringListSomethingFree) lines = NULL;
Suggestions and opinions are welcome.
Thanks,
Sukrit
6 years, 5 months
[libvirt] [PATCH] util: fix mount issue by moving NULL value to "none" in syscall.
by Julio Faracco
After running libvirt daemon with valgrind tools, some errors are
appearing when you try to start a domain. One example:
==18012== Syscall param mount(type) points to unaddressable byte(s)
==18012== at 0x6FEE3CA: mount (syscall-template.S:78)
==18012== by 0x531344D: virFileMoveMount (virfile.c:3828)
==18012== by 0x27FE7675: qemuDomainBuildNamespace (qemu_domain.c:11501)
==18012== by 0x2800C44E: qemuProcessHook (qemu_process.c:2870)
==18012== by 0x52F7E1D: virExec (vircommand.c:726)
==18012== by 0x52F7E1D: virCommandRunAsync (vircommand.c:2477)
==18012== by 0x52F4EDD: virCommandRun (vircommand.c:2309)
==18012== by 0x2800A731: qemuProcessLaunch (qemu_process.c:6235)
==18012== by 0x2800D6B4: qemuProcessStart (qemu_process.c:6569)
==18012== by 0x28074876: qemuDomainObjStart (qemu_driver.c:7314)
==18012== by 0x280522EB: qemuDomainCreateWithFlags (qemu_driver.c:7367)
==18012== by 0x55484BF: virDomainCreate (libvirt-domain.c:6531)
==18012== by 0x12CDBD: remoteDispatchDomainCreate (remote_daemon_dispatch_stubs.h:4350)
==18012== by 0x12CDBD: remoteDispatchDomainCreateHelper (remote_daemon_dispatch_stubs.h:4326)
==18012== Address 0x0 is not stack'd, malloc'd or (recently) free'd
Some documentation recommends to use "none" when you don't have a
filesystem type to use. Specially, for bind and move actions.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/util/virfile.c | 2 +-
src/util/virprocess.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 9296ccbe2a..378d03ecf0 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -3825,7 +3825,7 @@ virFileMoveMount(const char *src,
{
const unsigned long mount_flags = MS_MOVE;
- if (mount(src, dst, NULL, mount_flags, NULL) < 0) {
+ if (mount(src, dst, "none", mount_flags, NULL) < 0) {
virReportSystemError(errno,
_("Unable to move %s mount to %s"),
src, dst);
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 1fbbbb3a27..f92b0dce37 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -1181,7 +1181,7 @@ virProcessSetupPrivateMountNS(void)
goto cleanup;
}
- if (mount("", "/", NULL, MS_SLAVE|MS_REC, NULL) < 0) {
+ if (mount("", "/", "none", MS_SLAVE|MS_REC, NULL) < 0) {
virReportSystemError(errno, "%s",
_("Failed to switch root mount into slave mode"));
goto cleanup;
--
2.17.1
6 years, 5 months