[libvirt] [PATCH v2 0/4] Optimize mass closing of FDs on child spwaning
by Michal Privoznik
v2 of:
https://www.redhat.com/archives/libvir-list/2019-July/msg00089.html
diff to v1:
- Added a test for stats parsing,
- Added big fat warning as requested by Eric that malloc() in between
fork() and exec() is okay with glibc (I guess we don't care about
other libc-s like musl or uclibc).
Michal Prívozník (4):
virNetDevOpenvswitchInterfaceStats: Optimize for speed
test: Introduce virnetdevopenvswitchtest
vircommand: Separate mass FD closing into a function
virCommand: use procfs to learn opened FDs
src/libvirt_private.syms | 1 +
src/util/vircommand.c | 122 +++++++++++++++---
src/util/virnetdevopenvswitch.c | 136 +++++++++++++++------
src/util/virnetdevopenvswitch.h | 4 +
tests/Makefile.am | 13 +-
tests/virnetdevopenvswitchdata/stats1.json | 1 +
tests/virnetdevopenvswitchdata/stats2.json | 1 +
tests/virnetdevopenvswitchtest.c | 101 +++++++++++++++
8 files changed, 321 insertions(+), 58 deletions(-)
create mode 100644 tests/virnetdevopenvswitchdata/stats1.json
create mode 100644 tests/virnetdevopenvswitchdata/stats2.json
create mode 100644 tests/virnetdevopenvswitchtest.c
--
2.21.0
5 years, 5 months
[libvirt] [PATCH v2] qapi: add dirty-bitmaps to query-named-block-nodes result
by John Snow
From: Vladimir Sementsov-Ogievskiy <vsementsov(a)virtuozzo.com>
Let's add a possibility to query dirty-bitmaps not only on root nodes.
It is useful when dealing both with snapshots and incremental backups.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov(a)virtuozzo.com>
[Added deprecation and feature flag information. --js]
Signed-off-by: John Snow <jsnow(a)redhat.com>
---
block/qapi.c | 5 +++++
qapi/block-core.json | 14 +++++++++++++-
qemu-deprecated.texi | 12 ++++++++++++
3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/block/qapi.c b/block/qapi.c
index 917435f022..15f1030264 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -79,6 +79,11 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
info->backing_file = g_strdup(bs->backing_file);
}
+ if (!QLIST_EMPTY(&bs->dirty_bitmaps)) {
+ info->has_dirty_bitmaps = true;
+ info->dirty_bitmaps = bdrv_query_dirty_bitmaps(bs);
+ }
+
info->detect_zeroes = bs->detect_zeroes;
if (blk && blk_get_public(blk)->throttle_group_member.throttle_state) {
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 0d43d4f37c..0d67dd245c 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -360,6 +360,16 @@
# @write_threshold: configured write threshold for the device.
# 0 if disabled. (Since 2.3)
#
+# @dirty-bitmaps: dirty bitmaps information (only present if node
+# has one or more dirty bitmaps) (Since 4.2)
+#
+# Features:
+# @node-dirty-bitmaps: Signals the capability to return dirty bitmap information
+# per-node instead of per-drive. If this flag is present,
+# dirty-bitmaps should not be read from the BlockInfo
+# structure, the top-level data for query-block.
+# (Since 4.2)
+#
# Since: 0.14.0
#
##
@@ -378,7 +388,8 @@
'*bps_wr_max_length': 'int', '*iops_max_length': 'int',
'*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
'*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
- 'write_threshold': 'int' } }
+ 'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] },
+ 'features': [ { 'name': 'node-dirty-bitmaps' } ] }
##
# @BlockDeviceIoStatus:
@@ -656,6 +667,7 @@
#
# @dirty-bitmaps: dirty bitmaps information (only present if the
# driver has one or more dirty bitmaps) (Since 2.0)
+# Deprecated in 4.2; see BlockDirtyInfo instead.
#
# @io-status: @BlockDeviceIoStatus. Only present if the device
# supports it and the VM is configured to stop on errors
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index c90b08d553..bc4e5ac1d7 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -134,6 +134,18 @@ The ``status'' field of the ``BlockDirtyInfo'' structure, returned by
the query-block command is deprecated. Two new boolean fields,
``recording'' and ``busy'' effectively replace it.
+@subsection query-block result field dirty-bitmaps (Since 4.2)
+
+The ``dirty-bitmaps`` field of the ``BlockInfo`` structure, returned by
+the query-block command is itself now deprecated. The ``dirty-bitmaps``
+field of the ``BlockDeviceInfo`` struct should be used instead, which is the
+type of the ``inserted`` field in query-block replies, as well as the
+type of array items in query-named-block-nodes.
+
+In the absence of bitmaps on either structure, management APIs may use the
+presence of the ``node-dirty-bitmaps`` feature flag on the ``BlockDeviceInfo``
+structure to know where to anticipate bitmap data when present.
+
@subsection query-cpus (since 2.12.0)
The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command.
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/3] Optimize mass closing of FDs on child spwaning
by Michal Privoznik
If the limit for max opened files is way bigger than the default (1024),
say 3 orders bigger then spawning a child through virCommand can be
expensive because we iterate over ALL FDs within the limit and close
them. There's no need to that since we can learn the list of opened FDs
from /proc/self/fd/.
Michal Prívozník (3):
virNetDevOpenvswitchInterfaceStats: Optimize for speed
vircommand: Separate mass FD closing into a function
virCommand: use procfs to learn opened FDs
src/util/vircommand.c | 114 +++++++++++++++++++++++++++-----
src/util/virnetdevopenvswitch.c | 111 ++++++++++++++++++++-----------
2 files changed, 170 insertions(+), 55 deletions(-)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] tests: don't assume "localhost" only resolves to 1/2 IPs
by Daniel P. Berrangé
On Debian derived distros "localhost" can resolve to the normal
"127.0.0.1" and "::1", but it can also resolve to "127.0.1.1"
Rewrite the code so that it doesn't assume a fixed number of IPs.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
tests/virsystemdtest.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index cd031914ab..dd87caeebf 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -548,22 +548,21 @@ testActivation(bool useNames)
size_t nsockIP;
int ret = -1;
size_t i;
- const char *names2 = "demo-unix.socket:demo-ip.socket";
- const char *names3 = "demo-unix.socket:demo-ip.socket:demo-ip.socket";
char nfdstr[INT_BUFSIZE_BOUND(size_t)];
char pidstr[INT_BUFSIZE_BOUND(pid_t)];
virSystemdActivationMap map[2];
int *fds = NULL;
size_t nfds = 0;
VIR_AUTOPTR(virSystemdActivation) act = NULL;
+ virBuffer names = VIR_BUFFER_INITIALIZER;
+
+ virBufferAddLit(&names, "demo-unix.socket");
if (testActivationCreateFDs(&sockUNIX, &sockIP, &nsockIP) < 0)
return -1;
- if (nsockIP != 1 && nsockIP != 2) {
- fprintf(stderr, "Got %zu IP sockets but expected only 1 or 2\n", nsockIP);
- goto cleanup;
- }
+ for (i = 0; i < nsockIP; i++)
+ virBufferAddLit(&names, ":demo-ip.socket");
snprintf(nfdstr, sizeof(nfdstr), "%zu", 1 + nsockIP);
snprintf(pidstr, sizeof(pidstr), "%lld", (long long)getpid());
@@ -571,8 +570,11 @@ testActivation(bool useNames)
setenv("LISTEN_FDS", nfdstr, 1);
setenv("LISTEN_PID", pidstr, 1);
+ if (virBufferError(&names))
+ goto cleanup;
+
if (useNames)
- setenv("LISTEN_FDNAMES", nsockIP == 1 ? names2 : names3, 1);
+ setenv("LISTEN_FDNAMES", virBufferCurrentContent(&names), 1);
else
unsetenv("LISTEN_FDNAMES");
@@ -627,6 +629,7 @@ testActivation(bool useNames)
ret = 0;
cleanup:
+ virBufferFreeAndReset(&names);
virObjectUnref(sockUNIX);
for (i = 0; i < nsockIP; i++)
virObjectUnref(sockIP[i]);
--
2.21.0
5 years, 5 months
[libvirt] [libvirt-php PATCH 0/2] Add binding for virDomainInterfaceAddresses
by Dawid Zamirski
Hello,
The following two patches add a new bingding for virDomainInterfaceAddresses.
While working on it I have found that the PHP7 version of the
VIRT_ARRAY_INIT macro was causing segfaults which I have fixed in the
first patch wheread the actual implementation of the binding is in the
second one. Details are included in the commit messages of each patch.
Regards,
Dawid
Dawid Zamirski (2):
Fix PHP7 VIRT_ARRAY_INIT macro implementation.
Add binding for virDomainInterfaceAddresses.
src/libvirt-domain.c | 55 ++++++++++++++++++++++++++++++++++++++++++++
src/libvirt-domain.h | 2 ++
src/libvirt-php.c | 9 ++++++++
src/util.h | 7 +++---
4 files changed, 70 insertions(+), 3 deletions(-)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] test_driver: implement virDomainSetMemoryParameters
by Ilias Stamatis
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
src/test/test_driver.c | 85 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c14603e3af..2f4f94968b 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2861,6 +2861,90 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
virTypedParameterAssign(¶ms[index], name, type, value) < 0) \
goto cleanup
+
+static int
+testDomainSetMemoryParameters(virDomainPtr dom,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags)
+{
+ virDomainObjPtr vm = NULL;
+ virDomainDefPtr def = NULL;
+ unsigned long long swap_hard_limit = 0;
+ unsigned long long hard_limit = 0;
+ unsigned long long soft_limit = 0;
+ bool set_swap_hard_limit = false;
+ bool set_hard_limit = false;
+ bool set_soft_limit = false;
+ int rc;
+ int ret = -1;
+
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+ if (virTypedParamsValidate(params, nparams,
+ VIR_DOMAIN_MEMORY_HARD_LIMIT,
+ VIR_TYPED_PARAM_ULLONG,
+ VIR_DOMAIN_MEMORY_SOFT_LIMIT,
+ VIR_TYPED_PARAM_ULLONG,
+ VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT,
+ VIR_TYPED_PARAM_ULLONG,
+ NULL) < 0)
+ return -1;
+
+ if (!(vm = testDomObjFromDomain(dom)))
+ return -1;
+
+ if (!(def = virDomainObjGetOneDef(vm, flags)))
+ goto cleanup;
+
+#define VIR_GET_LIMIT_PARAMETER(PARAM, VALUE) \
+ if ((rc = virTypedParamsGetULLong(params, nparams, PARAM, &VALUE)) < 0) \
+ goto cleanup; \
+ \
+ if (rc == 1) \
+ set_ ## VALUE = true;
+
+ VIR_GET_LIMIT_PARAMETER(VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, swap_hard_limit)
+ VIR_GET_LIMIT_PARAMETER(VIR_DOMAIN_MEMORY_HARD_LIMIT, hard_limit)
+ VIR_GET_LIMIT_PARAMETER(VIR_DOMAIN_MEMORY_SOFT_LIMIT, soft_limit)
+
+#undef VIR_GET_LIMIT_PARAMETER
+
+ if (set_swap_hard_limit || set_hard_limit) {
+ unsigned long long mem_limit = vm->def->mem.hard_limit;
+ unsigned long long swap_limit = vm->def->mem.swap_hard_limit;
+
+ if (set_swap_hard_limit)
+ swap_limit = swap_hard_limit;
+
+ if (set_hard_limit)
+ mem_limit = hard_limit;
+
+ if (mem_limit > swap_limit) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("memory hard_limit tunable value must be lower "
+ "than or equal to swap_hard_limit"));
+ goto cleanup;
+ }
+ }
+
+ if (set_soft_limit)
+ def->mem.soft_limit = soft_limit;
+
+ if (set_hard_limit)
+ def->mem.hard_limit = hard_limit;
+
+ if (set_swap_hard_limit)
+ def->mem.swap_hard_limit = swap_hard_limit;
+
+ ret = 0;
+ cleanup:
+ virDomainObjEndAPI(&vm);
+ return ret;
+}
+
+
static int
testDomainGetMemoryParameters(virDomainPtr dom,
virTypedParameterPtr params,
@@ -7615,6 +7699,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainGetVcpuPinInfo = testDomainGetVcpuPinInfo, /* 1.2.18 */
.domainGetMaxVcpus = testDomainGetMaxVcpus, /* 0.7.3 */
.domainGetXMLDesc = testDomainGetXMLDesc, /* 0.1.4 */
+ .domainSetMemoryParameters = testDomainSetMemoryParameters, /* 5.6.0 */
.domainGetMemoryParameters = testDomainGetMemoryParameters, /* 5.6.0 */
.domainGetNumaParameters = testDomainGetNumaParameters, /* 5.6.0 */
.domainGetInterfaceParameters = testDomainGetInterfaceParameters, /* 5.6.0 */
--
2.22.0
5 years, 5 months
[libvirt] [PATCH] test_driver: implement virDomainSetUserPassword
by Ilias Stamatis
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
src/test/test_driver.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 49d7030d21..891a398a92 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2602,6 +2602,31 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
return ret;
}
+
+static int
+testDomainSetUserPassword(virDomainPtr dom,
+ const char *user ATTRIBUTE_UNUSED,
+ const char *password ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+ int ret = -1;
+ virDomainObjPtr vm;
+
+ virCheckFlags(VIR_DOMAIN_PASSWORD_ENCRYPTED, -1);
+
+ if (!(vm = testDomObjFromDomain(dom)))
+ return -1;
+
+ if (virDomainObjCheckActive(vm) < 0)
+ goto cleanup;
+
+ ret = 0;
+ cleanup:
+ virDomainObjEndAPI(&vm);
+ return ret;
+}
+
+
static int
testDomainSetVcpus(virDomainPtr domain, unsigned int nrCpus)
{
@@ -7628,6 +7653,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainSaveImageGetXMLDesc = testDomainSaveImageGetXMLDesc, /* 5.5.0 */
.domainCoreDump = testDomainCoreDump, /* 0.3.2 */
.domainCoreDumpWithFormat = testDomainCoreDumpWithFormat, /* 1.2.3 */
+ .domainSetUserPassword = testDomainSetUserPassword, /* 5.6.0 */
.domainSetVcpus = testDomainSetVcpus, /* 0.1.4 */
.domainSetVcpusFlags = testDomainSetVcpusFlags, /* 0.8.5 */
.domainGetVcpusFlags = testDomainGetVcpusFlags, /* 0.8.5 */
--
2.22.0
5 years, 5 months
[libvirt] [PATCH] all: don't wait for driver lock during startup
by Daniel P. Berrangé
When the drivers acquire their pidfile lock we don't want to wait if the
lock is already held. We need the driver to immediately report error,
causing the daemon to exit.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/bhyve/bhyve_driver.c | 2 +-
src/interface/interface_backend_netcf.c | 2 +-
src/interface/interface_backend_udev.c | 2 +-
src/libxl/libxl_driver.c | 2 +-
src/lxc/lxc_driver.c | 2 +-
src/network/leaseshelper.c | 2 +-
src/node_device/node_device_hal.c | 2 +-
src/node_device/node_device_udev.c | 2 +-
src/nwfilter/nwfilter_driver.c | 2 +-
src/qemu/qemu_driver.c | 2 +-
src/secret/secret_driver.c | 2 +-
src/vz/vz_driver.c | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index cfcf4e1fba..5387ac5570 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1280,7 +1280,7 @@ bhyveStateInitialize(bool privileged,
}
if ((bhyve_driver->lockFD =
- virPidFileAcquire(BHYVE_STATE_DIR, "driver", true, getpid())) < 0)
+ virPidFileAcquire(BHYVE_STATE_DIR, "driver", false, getpid())) < 0)
goto cleanup;
if (virDomainObjListLoadAllConfigs(bhyve_driver->domains,
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index 868e49c56e..f575768c4c 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -120,7 +120,7 @@ netcfStateInitialize(bool privileged,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto error;
/* open netcf */
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index fcd7f1c04a..2feaeb95b7 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -1199,7 +1199,7 @@ udevStateInitialize(bool privileged,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto cleanup;
driver->udev = udev_new();
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index a99c7471bb..492028c487 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -747,7 +747,7 @@ libxlStateInitialize(bool privileged,
}
if ((libxl_driver->lockFD =
- virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0)
+ virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
goto error;
if (!(libxl_driver->lockManager =
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 3982c24f34..d0b6703101 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1607,7 +1607,7 @@ static int lxcStateInitialize(bool privileged,
}
if ((lxc_driver->lockFD =
- virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0)
+ virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
goto cleanup;
/* Get all the running persistent or transient configs first */
diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index 89d9a003e2..2a10fbf33a 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -164,7 +164,7 @@ main(int argc, char **argv)
goto cleanup;
/* Try to claim the pidfile, exiting if we can't */
- if ((pid_file_fd = virPidFileAcquirePath(pid_file, true, getpid())) < 0)
+ if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0)
goto cleanup;
/* Since interfaces can be hot plugged, we need to make sure that the
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 1920f4566e..1f3f867599 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -637,7 +637,7 @@ nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto failure;
if (!(driver->devs = virNodeDeviceObjListNew()))
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index d883462948..8bc63c506c 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1848,7 +1848,7 @@ nodeStateInitialize(bool privileged,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto cleanup;
if (!(driver->devs = virNodeDeviceObjListNew()) ||
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 43561241f6..530e4f5872 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -215,7 +215,7 @@ nwfilterStateInitialize(bool privileged,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto error;
if (virNWFilterIPAddrMapInit() < 0)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fc0d12c335..d3a144aabd 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -677,7 +677,7 @@ qemuStateInitialize(bool privileged,
}
if ((qemu_driver->lockFD =
- virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0)
+ virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
goto error;
qemu_driver->qemuImgBinary = virFindFileInPath("qemu-img");
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 9344948db4..0af2bcef96 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -504,7 +504,7 @@ secretStateInitialize(bool privileged,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto error;
if (!(driver->secrets = virSecretObjListNew()))
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 75430fb0d9..f5d05a7f43 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -4129,7 +4129,7 @@ vzStateInitialize(bool privileged,
}
if ((vz_driver_lock_fd =
- virPidFileAcquire(VZ_STATEDIR, "driver", true, getpid())) < 0)
+ virPidFileAcquire(VZ_STATEDIR, "driver", false, getpid())) < 0)
return -1;
if (prlsdkInit() < 0) {
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] interface: fix driver name in state directory path
by Daniel P. Berrangé
Typo meant we use 'nodedev' instead of 'interface'. This doesn't hurt
libvirtd because if a process tries to acquire a lock it already holds
it will succeed. It fails when nodedev & interface drivers are in
separate daemons though.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/interface/interface_backend_netcf.c | 4 ++--
src/interface/interface_backend_udev.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index f575768c4c..0000587cee 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -102,14 +102,14 @@ netcfStateInitialize(bool privileged,
if (privileged) {
if (virAsprintf(&driver->stateDir,
- "%s/run/libvirt/nodedev", LOCALSTATEDIR) < 0)
+ "%s/run/libvirt/interface", LOCALSTATEDIR) < 0)
goto error;
} else {
VIR_AUTOFREE(char *) rundir = NULL;
if (!(rundir = virGetUserRuntimeDirectory()))
goto error;
- if (virAsprintf(&driver->stateDir, "%s/nodedev/run", rundir) < 0)
+ if (virAsprintf(&driver->stateDir, "%s/interface/run", rundir) < 0)
goto error;
}
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index 2feaeb95b7..fea5108dbc 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -1181,14 +1181,14 @@ udevStateInitialize(bool privileged,
if (privileged) {
if (virAsprintf(&driver->stateDir,
- "%s/run/libvirt/nodedev", LOCALSTATEDIR) < 0)
+ "%s/run/libvirt/interface", LOCALSTATEDIR) < 0)
goto cleanup;
} else {
VIR_AUTOFREE(char *) rundir = NULL;
if (!(rundir = virGetUserRuntimeDirectory()))
goto cleanup;
- if (virAsprintf(&driver->stateDir, "%s/nodedev/run", rundir) < 0)
+ if (virAsprintf(&driver->stateDir, "%s/interface/run", rundir) < 0)
goto cleanup;
}
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/5] libvirt_nss: Report newer addresses first
by Michal Privoznik
See the last patch for explanation.
Michal Prívozník (5):
libvirt_nss: Use VIR_STEAL_PTR() in findLease()
libvirt_nss: Use VIR_AUTOPTR and VIR_AUTOFREE
libvirt_nss: Drop some needless cleanup labels
libvirt_nss: Pass @name to appendAddr()
libvirt_nss: Report newer addresses first
tests/nssdata/virbr0.status | 6 +--
tests/nsstest.c | 21 ++++------
tools/nss/libvirt_nss.c | 80 +++++++++++++++++++++++--------------
3 files changed, 60 insertions(+), 47 deletions(-)
--
2.21.0
5 years, 5 months