[libvirt] [PATCH] Add parameter to wait for lock in file locking APIs
by Nehal J Wani
Our current pidfile acquire APis (virPidFileAcquire) simply return -1 upon
failure to acquire a lock. This patch adds a parameter 'bool waitForLock'
which instructs the APIs if we want to make it block and wait for the lock
or not.
---
Based on Daniel's comments on:
https://www.redhat.com/archives/libvir-list/2014-March/msg00841.html
daemon/libvirtd.c | 2 +-
src/locking/lock_daemon.c | 4 ++--
src/util/virfile.c | 14 +++++++++-----
src/util/virfile.h | 2 +-
src/util/virlockspace.c | 6 +++---
src/util/virpidfile.c | 6 ++++--
src/util/virpidfile.h | 2 ++
7 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index a471b3b..27c4fff 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1369,7 +1369,7 @@ int main(int argc, char **argv) {
umask(old_umask);
/* Try to claim the pidfile, exiting if we can't */
- if ((pid_file_fd = virPidFileAcquirePath(pid_file, getpid())) < 0) {
+ if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0) {
ret = VIR_DAEMON_ERR_PIDFILE;
goto cleanup;
}
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index e047751..7dc4292 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -1020,7 +1020,7 @@ virLockDaemonPostExecRestart(const char *state_file,
/* Re-claim PID file now as we will not be daemonizing */
if (pid_file &&
- (*pid_file_fd = virPidFileAcquirePath(pid_file, getpid())) < 0)
+ (*pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0)
goto cleanup;
if (!(lockDaemon = virLockDaemonNewPostExecRestart(object, privileged)))
@@ -1382,7 +1382,7 @@ int main(int argc, char **argv) {
}
/* If we have a pidfile set, claim it now, exiting if already taken */
- if ((pid_file_fd = virPidFileAcquirePath(pid_file, getpid())) < 0) {
+ if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0) {
ret = VIR_LOCK_DAEMON_ERR_PIDFILE;
goto cleanup;
}
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 6da564b..a4a4827 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -339,13 +339,14 @@ virFileWrapperFdFree(virFileWrapperFdPtr wfd)
* @shared: type of lock to acquire
* @start: byte offset to start lock
* @len: length of lock (0 to acquire entire remaining file from @start)
+ * @waitForLock: wait for previously held lock or not
*
* Attempt to acquire a lock on the file @fd. If @shared
* is true, then a shared lock will be acquired,
* otherwise an exclusive lock will be acquired. If
* the lock cannot be acquired, an error will be
- * returned. This will not wait to acquire the lock if
- * another process already holds it.
+ * returned. If @waitForLock is true, this will wait
+ * for the lock if another process has already acquired it.
*
* The lock will be released when @fd is closed. The lock
* will also be released if *any* other open file descriptor
@@ -356,7 +357,7 @@ virFileWrapperFdFree(virFileWrapperFdPtr wfd)
*
* Returns 0 on success, or -errno otherwise
*/
-int virFileLock(int fd, bool shared, off_t start, off_t len)
+int virFileLock(int fd, bool shared, off_t start, off_t len, bool waitForLock)
{
struct flock fl = {
.l_type = shared ? F_RDLCK : F_WRLCK,
@@ -365,7 +366,9 @@ int virFileLock(int fd, bool shared, off_t start, off_t len)
.l_len = len,
};
- if (fcntl(fd, F_SETLK, &fl) < 0)
+ int cmd = waitForLock ? F_SETLKW : F_SETLK;
+
+ if (fcntl(fd, cmd, &fl) < 0)
return -errno;
return 0;
@@ -402,7 +405,8 @@ int virFileUnlock(int fd, off_t start, off_t len)
int virFileLock(int fd ATTRIBUTE_UNUSED,
bool shared ATTRIBUTE_UNUSED,
off_t start ATTRIBUTE_UNUSED,
- off_t len ATTRIBUTE_UNUSED)
+ off_t len ATTRIBUTE_UNUSED,
+ bool waitForLock ATTRIBUTE_UNUSED)
{
return -ENOSYS;
}
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 20baf6f..302b74f 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -97,7 +97,7 @@ int virFileWrapperFdClose(virFileWrapperFdPtr dfd);
void virFileWrapperFdFree(virFileWrapperFdPtr dfd);
-int virFileLock(int fd, bool shared, off_t start, off_t len);
+int virFileLock(int fd, bool shared, off_t start, off_t len, bool waitForLock);
int virFileUnlock(int fd, off_t start, off_t len);
typedef int (*virFileRewriteFunc)(int fd, void *opaque);
diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c
index 90a39bb..a187e1e 100644
--- a/src/util/virlockspace.c
+++ b/src/util/virlockspace.c
@@ -82,7 +82,7 @@ static void virLockSpaceResourceFree(virLockSpaceResourcePtr res)
if (res->flags & VIR_LOCK_SPACE_ACQUIRE_SHARED) {
/* We must upgrade to an exclusive lock to ensure
* no one else still has it before trying to delete */
- if (virFileLock(res->fd, false, 0, 1) < 0) {
+ if (virFileLock(res->fd, false, 0, 1, false) < 0) {
VIR_DEBUG("Could not upgrade shared lease to exclusive, not deleting");
} else {
if (unlink(res->path) < 0 &&
@@ -155,7 +155,7 @@ virLockSpaceResourceNew(virLockSpacePtr lockspace,
goto error;
}
- if (virFileLock(res->fd, shared, 0, 1) < 0) {
+ if (virFileLock(res->fd, shared, 0, 1, false) < 0) {
if (errno == EACCES || errno == EAGAIN) {
virReportError(VIR_ERR_RESOURCE_BUSY,
_("Lockspace resource '%s' is locked"),
@@ -202,7 +202,7 @@ virLockSpaceResourceNew(virLockSpacePtr lockspace,
goto error;
}
- if (virFileLock(res->fd, shared, 0, 1) < 0) {
+ if (virFileLock(res->fd, shared, 0, 1, false) < 0) {
if (errno == EACCES || errno == EAGAIN) {
virReportError(VIR_ERR_RESOURCE_BUSY,
_("Lockspace resource '%s' is locked"),
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 298d57c..28db24c 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -372,6 +372,7 @@ cleanup:
}
int virPidFileAcquirePath(const char *path,
+ bool waitForLock,
pid_t pid)
{
int fd = -1;
@@ -405,7 +406,7 @@ int virPidFileAcquirePath(const char *path,
return -1;
}
- if (virFileLock(fd, false, 0, 1) < 0) {
+ if (virFileLock(fd, false, 0, 1, waitForLock) < 0) {
virReportSystemError(errno,
_("Failed to acquire pid file '%s'"),
path);
@@ -448,6 +449,7 @@ int virPidFileAcquirePath(const char *path,
int virPidFileAcquire(const char *dir,
const char *name,
+ bool waitForLock,
pid_t pid)
{
int rc = 0;
@@ -463,7 +465,7 @@ int virPidFileAcquire(const char *dir,
goto cleanup;
}
- rc = virPidFileAcquirePath(pidfile, pid);
+ rc = virPidFileAcquirePath(pidfile, waitForLock, pid);
cleanup:
VIR_FREE(pidfile);
diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h
index 3194a89..2720206 100644
--- a/src/util/virpidfile.h
+++ b/src/util/virpidfile.h
@@ -56,9 +56,11 @@ int virPidFileDelete(const char *dir,
int virPidFileAcquirePath(const char *path,
+ bool waitForLock,
pid_t pid) ATTRIBUTE_RETURN_CHECK;
int virPidFileAcquire(const char *dir,
const char *name,
+ bool waitForLock,
pid_t pid) ATTRIBUTE_RETURN_CHECK;
int virPidFileReleasePath(const char *path,
--
1.7.1
10 years, 9 months
[libvirt] get information about weighted instances
by sahid
Greetings,
There is a new field I would like to add in the return of the command
"vcpuinfo" to get the current "cpu shares" of a domain.
The aim is to help managing weighted instances. Avoiding to look at the domain
xml to compare instances.
VCPU: 0
CPU: 3
State: running
CPU time: 4811.3s
CPU Affinity: yyyy
CPU Shares: 2048
I would like to know if this solution make sens for the community? and if yes I
could be work on it.
The real aim at the end of this is to add the ability to weight instances in
real time, like we can do with the command "vcpupin". Does it makes sense?
Best,
Sahid.
10 years, 9 months
[libvirt] [PATCH] Fix mistakes in checking return values
by Daniel P. Berrange
Thre was a syntax error in checking virRegisterStateDriver in
the remote driver, and bogus checking of a void return type
of virDomainConfNWFilterRegister in nwfilter.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/nwfilter/nwfilter_driver.c | 3 +--
src/remote/remote_driver.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
Pushed as a build break fix.
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 228794d..8ce2b7d 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -720,7 +720,6 @@ int nwfilterRegister(void) {
return -1;
if (virRegisterStateDriver(&stateDriver) < 0)
return -1;
- if (virDomainConfNWFilterRegister(&domainNWFilterDriver) < 0)
- return -1;
+ virDomainConfNWFilterRegister(&domainNWFilterDriver);
return 0;
}
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index c9711bb..e85f34d 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -7840,7 +7840,7 @@ remoteRegister(void)
if (virRegisterNWFilterDriver(&nwfilter_driver) < 0)
return -1;
#ifdef WITH_LIBVIRTD
- if (virRegisterStateDriver(&state_driver) == -1) < 0)
+ if (virRegisterStateDriver(&state_driver) < 0)
return -1;
#endif
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCH] spec: move some dirs into appropriate subpackages
by Michael Chapman
This commit moves a few directories into more appropriate subpackages.
In a few cases a directory is owned by two subpackages, however this is
OK as long as the permissions and ownership for the directory are
consistent between them.
- %{_sysconfdir}/libvirt/qemu/
Used by the qemu and network drivers.
When building with separate driver modules, this directory is only
owned by l-d-d-network. l-d-d-qemu has a hard dependency on
l-d-d-network, which means this directory is created with the
correct permissions and ownership, however it's clearer if both
subpackages own the directory independently.
- %{_sysconfdir}/libvirt/nwfilter/
Used by the nwfilter driver only.
This directory is currently always owned by libvirt-daemon. This
commit moves it into l-d-d-nwfilter when building with separate
driver modules.
- %{_localstatedir}/run/libvirt/network/
Used by the network and nwfilter drivers.
When building without separate driver modules, this directory is
should be owned by libvirt-daemon only if either of these drivers
are enabled. When building with separate driver modules, this
directory should be owned by l-d-d-nwfilter in addition to
l-d-d-network.
- %{_datadir}/libvirt/networks/ and
%{_datadir}/libvirt/networks/default.xml
Used only by the %post scriptlet in libvirt-daemon-config-network.
Signed-off-by: Michael Chapman <mike(a)very.puzzling.org>
---
libvirt.spec.in | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 014fe5d..ac71db0 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1837,10 +1837,6 @@ exit 0
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/
- %if %{with_nwfilter}
-%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/
- %endif
-
%if %{with_systemd}
%{_unitdir}/libvirtd.service
%{_unitdir}/virtlockd.service
@@ -1903,16 +1899,21 @@ exit 0
%{_mandir}/man8/virtlockd.8*
%if ! %{with_driver_modules}
- %if %{with_network}
+ %if %{with_network} || %{with_qemu}
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
+ %endif
+ %if %{with_network} || %{with_nwfilter}
+%ghost %dir %{_localstatedir}/run/libvirt/network/
+ %endif
+ %if %{with_network}
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart
-%dir %{_datadir}/libvirt/networks/
-%{_datadir}/libvirt/networks/default.xml
-%ghost %dir %{_localstatedir}/run/libvirt/network/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/
%dir %attr(0755, root, root) %{_localstatedir}/lib/libvirt/dnsmasq/
%endif
+ %if %{with_nwfilter}
+%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/
+ %endif
%if %{with_storage_disk}
%attr(0755, root, root) %{_libexecdir}/libvirt_parthelper
%endif
@@ -1958,6 +1959,8 @@ exit 0
%if %{with_network}
%files daemon-config-network
%defattr(-, root, root)
+%dir %{_datadir}/libvirt/networks/
+%{_datadir}/libvirt/networks/default.xml
%endif
%if %{with_nwfilter}
@@ -1979,8 +1982,6 @@ exit 0
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart
-%dir %{_datadir}/libvirt/networks/
-%{_datadir}/libvirt/networks/default.xml
%ghost %dir %{_localstatedir}/run/libvirt/network/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/
%dir %attr(0755, root, root) %{_localstatedir}/lib/libvirt/dnsmasq/
@@ -1996,6 +1997,8 @@ exit 0
%if %{with_nwfilter}
%files daemon-driver-nwfilter
%defattr(-, root, root)
+%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/
+%ghost %dir %{_localstatedir}/run/libvirt/network/
%{_libdir}/%{name}/connection-driver/libvirt_driver_nwfilter.so
%endif
@@ -2015,6 +2018,7 @@ exit 0
%if %{with_qemu}
%files daemon-driver-qemu
%defattr(-, root, root)
+%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
%config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
%config(noreplace) %{_sysconfdir}/libvirt/qemu-lockd.conf
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCH 1/1] Fix issue found by coverity and cleanup
by Pavel Hrdina
Coverity found an issue in lxc_driver and uml_driver that we don't
check the return value of register functions.
I've also updated all other places and unify the way we check the
return value.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/bhyve/bhyve_driver.c | 6 ++++--
src/interface/interface_backend_netcf.c | 3 ++-
src/lxc/lxc_driver.c | 6 ++++--
src/network/bridge_driver.c | 3 ++-
src/nwfilter/nwfilter_driver.c | 9 ++++++---
src/qemu/qemu_driver.c | 6 ++++--
src/remote/remote_driver.c | 24 ++++++++++++++++--------
src/secret/secret_driver.c | 6 ++++--
src/storage/storage_driver.c | 3 ++-
src/uml/uml_driver.c | 6 ++++--
10 files changed, 48 insertions(+), 24 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 9dbb299..f1ed510 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -715,7 +715,9 @@ static virStateDriver bhyveStateDriver = {
int
bhyveRegister(void)
{
- virRegisterDriver(&bhyveDriver);
- virRegisterStateDriver(&bhyveStateDriver);
+ if (virRegisterDriver(&bhyveDriver) < 0)
+ return -1;
+ if (virRegisterStateDriver(&bhyveStateDriver) < 0)
+ return -1;
return 0;
}
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index b4c1fe9..98ce83b 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -1194,6 +1194,7 @@ int netcfIfaceRegister(void) {
_("failed to register netcf interface driver"));
return -1;
}
- virRegisterStateDriver(&interfaceStateDriver);
+ if (virRegisterStateDriver(&interfaceStateDriver) < 0)
+ return -1;
return 0;
}
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 0ab1ba2..27c27d8 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -5767,7 +5767,9 @@ static virStateDriver lxcStateDriver = {
int lxcRegister(void)
{
- virRegisterDriver(&lxcDriver);
- virRegisterStateDriver(&lxcStateDriver);
+ if (virRegisterDriver(&lxcDriver) < 0)
+ return -1;
+ if (virRegisterStateDriver(&lxcStateDriver) < 0)
+ return -1;
return 0;
}
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index c797f8f..181541e 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3232,7 +3232,8 @@ static virStateDriver networkStateDriver = {
int networkRegister(void) {
if (virRegisterNetworkDriver(&networkDriver) < 0)
return -1;
- virRegisterStateDriver(&networkStateDriver);
+ if (virRegisterStateDriver(&networkStateDriver) < 0)
+ return -1;
return 0;
}
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 2e89d07..228794d 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -716,8 +716,11 @@ static virDomainConfNWFilterDriver domainNWFilterDriver = {
int nwfilterRegister(void) {
- virRegisterNWFilterDriver(&nwfilterDriver);
- virRegisterStateDriver(&stateDriver);
- virDomainConfNWFilterRegister(&domainNWFilterDriver);
+ if (virRegisterNWFilterDriver(&nwfilterDriver) < 0)
+ return -1;
+ if (virRegisterStateDriver(&stateDriver) < 0)
+ return -1;
+ if (virDomainConfNWFilterRegister(&domainNWFilterDriver) < 0)
+ return -1;
return 0;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 89f443f..fc382a5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16796,7 +16796,9 @@ static virStateDriver qemuStateDriver = {
};
int qemuRegister(void) {
- virRegisterDriver(&qemuDriver);
- virRegisterStateDriver(&qemuStateDriver);
+ if (virRegisterDriver(&qemuDriver) < 0)
+ return -1;
+ if (virRegisterStateDriver(&qemuStateDriver) < 0)
+ return -1;
return 0;
}
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 955465a..c9711bb 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -7825,15 +7825,23 @@ remoteRegister(void)
{
remoteDriver = &remote_driver;
- if (virRegisterDriver(&remote_driver) == -1) return -1;
- if (virRegisterNetworkDriver(&network_driver) == -1) return -1;
- if (virRegisterInterfaceDriver(&interface_driver) == -1) return -1;
- if (virRegisterStorageDriver(&storage_driver) == -1) return -1;
- if (virRegisterNodeDeviceDriver(&node_device_driver) == -1) return -1;
- if (virRegisterSecretDriver(&secret_driver) == -1) return -1;
- if (virRegisterNWFilterDriver(&nwfilter_driver) == -1) return -1;
+ if (virRegisterDriver(&remote_driver) < 0)
+ return -1;
+ if (virRegisterNetworkDriver(&network_driver) < 0)
+ return -1;
+ if (virRegisterInterfaceDriver(&interface_driver) < 0)
+ return -1;
+ if (virRegisterStorageDriver(&storage_driver) < 0)
+ return -1;
+ if (virRegisterNodeDeviceDriver(&node_device_driver) < 0)
+ return -1;
+ if (virRegisterSecretDriver(&secret_driver) < 0)
+ return -1;
+ if (virRegisterNWFilterDriver(&nwfilter_driver) < 0)
+ return -1;
#ifdef WITH_LIBVIRTD
- if (virRegisterStateDriver(&state_driver) == -1) return -1;
+ if (virRegisterStateDriver(&state_driver) == -1) < 0)
+ return -1;
#endif
return 0;
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 9f7f946..5cb6391 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -1194,7 +1194,9 @@ static virStateDriver stateDriver = {
int
secretRegister(void)
{
- virRegisterSecretDriver(&secretDriver);
- virRegisterStateDriver(&stateDriver);
+ if (virRegisterSecretDriver(&secretDriver) < 0)
+ return -1;
+ if (virRegisterStateDriver(&stateDriver) < 0)
+ return -1;
return 0;
}
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 7dbff6c..466ceba 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -2696,7 +2696,8 @@ int storageRegister(void)
{
if (virRegisterStorageDriver(&storageDriver) < 0)
return -1;
- virRegisterStateDriver(&stateDriver);
+ if (virRegisterStateDriver(&stateDriver) < 0)
+ return -1;
return 0;
}
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 3496e52..8ddf181 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -2909,7 +2909,9 @@ static virStateDriver umlStateDriver = {
};
int umlRegister(void) {
- virRegisterDriver(¨Driver);
- virRegisterStateDriver(¨StateDriver);
+ if (virRegisterDriver(¨Driver) < 0)
+ return -1;
+ if (virRegisterStateDriver(¨StateDriver) < 0)
+ return -1;
return 0;
}
--
1.8.3.1
10 years, 9 months
Re: [libvirt] Zombie process after open libvirt connection
by Carlos Rodrigues
The zimbie processes is from perl. What is your perl and libvirt version?
Em 17/03/2014 12:37, Michal Privoznik <mprivozn(a)redhat.com> escreveu:
>
> On 17.03.2014 12:13, Carlos Rodrigues wrote:
> > Hell Michal,
> >
> > Thank you for your answer, but this doesn't fix my problem.
> >
> > Run your fixed script and we get the same behavior:
> >
> > $ perl test-chldhandle-bug-fixed.pl
> > init... pid=29713
> > while...
> > fork 1
> > end... pid=29716
> > receive chld
> > fork 2
> > end... pid=29717
> > receive chld
> > 2014-03-17 11:10:37.234+0000: 29713: info : libvirt version: 1.0.5.7, package: 2.fc19 (Fedora Project, 2013-11-17-23:21:57, buildvm-18.phx2.fedoraproject.org)
> > 2014-03-17 11:10:37.234+0000: 29713: warning : virNetTLSContextCheckCertificate:1099 : Certificate check failed Certificate [session] owner does not match the hostname 10.10.4.249
> > connection open
> > fork 3
> > end... pid=29827
> > fork 4
> > end... pid=29930
> > go next...
> >
> >
>
> I'm not a perl expert, but I don't think it's a libvirt bug anyhow.
> Moreover, I don't see any zombies:
>
> $ perl test-chldhandle-bug-fixed.pl & sleep 5 && echo && ps axf | grep
> perl && echo
> [1] 11239
> init... pid=11239
> while...
> fork 1
> end... pid=11241
> receive chld
> fork 2
> end... pid=11242
> receive chld
> connection open
>
> 11239 pts/18 S 0:00 | \_ perl test-chldhandle-bug-fixed.pl
> 11245 pts/18 S+ 0:00 | \_ grep --colour=auto perl
>
> fork 3
> end... pid=11246
> receive chld
> fork 4
> end... pid=11247
> receive chld
> go next...
>
> btw: with older version I'm seeing this:
>
> 11399 pts/18 S 0:00 | \_ perl test-chldhandle-bug.pl
> 11401 pts/18 Z 0:00 | | \_ [perl] <defunct>
> 11402 pts/18 Z 0:00 | | \_ [perl] <defunct>
> 11405 pts/18 S+ 0:00 | \_ grep --colour=auto perl
>
> What zombies are you seeing? Perl ones or libvirt or ..,?
>
> Michal
10 years, 9 months
[libvirt] RFC: viridentitytest Failure on CentOS 6.5?
by Nehal J Wani
I followed the following steps to build a clean development version of
libvirt from source. Can't seem to understand what is wrong. (Entire
buildLog has been attached):
➜ /tmp cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m
➜ /tmp sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted
➜ /tmp git clone git://libvirt.org/libvirt.git
Initialized empty Git repository in /tmp/libvirt/.git/
remote: Counting objects: 138935, done.
remote: Compressing objects: 100% (21143/21143), done.
remote: Total 138935 (delta 117282), reused 138935 (delta 117282)
Receiving objects: 100% (138935/138935), 137.72 MiB | 559 KiB/s, done.
Resolving deltas: 100% (117282/117282), done.
➜ /tmp cd libvirt
➜ libvirt git:(master) ./autogen.sh --system
Running ./configure with --prefix=/usr --sysconfdir=/etc
--localstatedir=/var --libdir=/usr/lib64
..
..
Now type 'make' to compile libvirt.
➜ libvirt git:(master) make
..
..
make[1]: Leaving directory `/tmp/libvirt'
➜ libvirt git:(master) ✗ cd tests
➜ tests git:(master) ✗ ./viridentitytest
/tmp/libvirt/tests/.libs/libsecurityselinuxhelper.so: No such file or directory
➜ tests git:(master) ✗
--
Nehal J Wani
10 years, 9 months
[libvirt] [PATCH] virlog: add log lock in virLogSetDefaultPriority
by Wangrui (K)
When the global variable virLogDefaultPriority is modified, it will
be better to have a lock.
Signed-off-by: Zhou Yimin <zhouyimin(a)huawei.com>
---
src/util/virlog.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 68af0f3..ba370e2 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -498,7 +498,10 @@ virLogSetDefaultPriority(virLogPriority priority)
if (virLogInitialize() < 0)
return -1;
+ virLogLock();
virLogDefaultPriority = priority;
+ virLogUnlock();
+
return 0;
}
--
1.7.12.4
10 years, 9 months
[libvirt] [PATCH] Avoid warning message from libxl driver on non-Xen kernels
by Daniel P. Berrange
The libxl driver reads /proc/xen/capabilities to see if it
is on a Dom0 kernel. If that file does not even exist though,
an error is logged. Check for the file existance before trying
to read its contents to avoid the log message.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/libxl/libxl_driver.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index ae7342a..445a61a 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -970,6 +970,10 @@ libxlDriverShouldLoad(bool privileged)
return ret;
}
+ if (!virFileExists("/proc/xen/capabilities")) {
+ VIR_INFO("Disabling driver as /proc/xen/capabilities does not exist");
+ return false;
+ }
/*
* Don't load if not running on a Xen control domain (dom0). It is not
* sufficient to check for the file to exist as any guest can mount
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCH] Fix leak of iterator in nwfilter instantiate code
by Daniel P. Berrange
The ebiptablesCreateRuleInstanceIterate creates a
virNWFilterVarCombIterPtr instance and iterates over
it. Unfortunately in doing so, it discards the original
pointer. At the end of the method it will thus effectively
do virNWFilterVarCombIterFree(NULL), which means it will
leak the iterator.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/nwfilter/nwfilter_ebiptables_driver.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 57c0476..9dbd3ff 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -2865,14 +2865,14 @@ ebiptablesCreateRuleInstanceIterate(
virNWFilterRuleInstPtr res)
{
int rc = 0;
- virNWFilterVarCombIterPtr vciter;
+ virNWFilterVarCombIterPtr vciter, tmp;
/* rule->vars holds all the variables names that this rule will access.
* iterate over all combinations of the variables' values and instantiate
* the filtering rule with each combination.
*/
- vciter = virNWFilterVarCombIterCreate(vars,
- rule->varAccess, rule->nVarAccess);
+ tmp = vciter = virNWFilterVarCombIterCreate(vars,
+ rule->varAccess, rule->nVarAccess);
if (!vciter)
return -1;
@@ -2881,12 +2881,12 @@ ebiptablesCreateRuleInstanceIterate(
nwfilter,
rule,
ifname,
- vciter,
+ tmp,
res);
if (rc < 0)
break;
- vciter = virNWFilterVarCombIterNext(vciter);
- } while (vciter != NULL);
+ tmp = virNWFilterVarCombIterNext(tmp);
+ } while (tmp != NULL);
virNWFilterVarCombIterFree(vciter);
--
1.8.5.3
10 years, 9 months