[libvirt] [PATCH] gcrypt: fix build in case we do not use gnutls and gcrypt
by Olga Krishtal
In case when we use any crypt library and gnutls make returns
compilation errors.
Signed-off-by: Olga Krishtal <okrishtal(a)virtuozzo.com>
---
src/libvirt.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 52462e3..77365d1 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -269,7 +269,7 @@ virWinsockInit(void)
}
#endif
-
+#ifdef WITH_GNUTLS
#ifdef WITH_GNUTLS_GCRYPT
static int
virTLSMutexInit(void **priv)
@@ -332,6 +332,7 @@ static struct gcry_thread_cbs virTLSThreadImpl = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
#endif /* WITH_GNUTLS_GCRYPT */
+#endif /* WITH_GNUTLS */
static bool virGlobalError;
@@ -357,6 +358,7 @@ virGlobalInit(void)
}
#endif
+#ifdef WITH_GNUTLS
#ifdef WITH_GNUTLS_GCRYPT
/*
* This sequence of API calls it copied exactly from
@@ -371,13 +373,10 @@ virGlobalInit(void)
gcry_control(GCRYCTL_DISABLE_SECMEM, NULL, 0);
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, NULL, 0);
}
-#endif
-
- virLogSetFromEnv();
-
-#ifdef WITH_GNUTLS
+#endif /* End of WITH_GNUTLS_GCRYPT*/
virNetTLSInit();
-#endif
+#endif /* End of WITH_GNUTLS*/
+ virLogSetFromEnv();
#if WITH_CURL
curl_global_init(CURL_GLOBAL_DEFAULT);
--
1.8.3.1
8 years
[libvirt] [PATCH v2] libvirt.spec: Build & run tests in parallel
by Michal Privoznik
So far, the main code is built in parallel, which makes it pretty
fast. But with a lots of tests we have now I've noticed this part
takes too much time to build. The problem was that tests were
build and run in a single job.
Also, 'make' in the first hunk is useless. The test suite is not
built due to 'make all' because there's no .git in the sources
unpacked from a tar.xz archive. It's 'make check' which triggers
tests build.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v1:
- Instead of fixing 'make' in the first hunk, drop it from there.
libvirt.spec.in | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 545990c..5133936 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1290,7 +1290,6 @@ rm -fr %{buildroot}
%check
cd tests
-make
# These tests don't current work in a mock build root
for i in nodeinfotest seclabeltest
do
@@ -1299,7 +1298,7 @@ do
printf '#!/bin/sh\nexit 0\n' > $i
chmod +x $i
done
-if ! make check VIR_TEST_DEBUG=1
+if ! make %{?_smp_mflags} check VIR_TEST_DEBUG=1
then
cat test-suite.log || true
exit 1
--
2.8.4
8 years
[libvirt] [PATCH v4 0/7] New libssh transport
by Pino Toscano
Hi,
this series introduces a new libssh transport in libvirt, based on the
libssh C library. This library supports what libssh2 does, and more:
- easier API for known_hosts handling (there's a ticket upstream to
request extensions for it, but what is implemented now works well)
- potential GSSAPI authentication (not enabled yet because of a libssh
bug [1])
- easier API for ssh-agent support
The implementation for the new transport is based on the libssh2 one,
hence it shares origin and style.
[1] https://red.libssh.org/issues/242
Thanks,
Changes from v3 to v4:
- integrate most of the issues spotted by Peter Krempa
- add patch #3
- minor naming changes
Changes from v2 to v3:
- split into more commits
- integrate all the issues spotted by Daniel P. Berrange and
Peter Krempa
- restore the specified order of authentication methods (as in libssh2)
- add a related documentation fix
- minor coding fixes
Changes from v1 to v2:
- implemented keyboard interactive
- code polish, and fixes
Pino Toscano (7):
virNetSocket: allow to not close FD
virerror: add error for libssh transport
virnetsocket: improve search for default SSH key
libssh_transport: add new libssh-based transport
remote: expose a new libssh transport
spec: enable libssh transport on Fedora
docs: fix default value for sshauth option of libssh2/libssh
config-post.h | 2 +
configure.ac | 3 +
docs/remote.html.in | 39 +-
include/libvirt/virterror.h | 2 +
libvirt.spec.in | 10 +
m4/virt-libssh.m4 | 26 +
po/POTFILES.in | 1 +
src/Makefile.am | 21 +-
src/libvirt_libssh.syms | 21 +
src/remote/remote_driver.c | 41 ++
src/rpc/virnetclient.c | 167 ++++-
src/rpc/virnetclient.h | 13 +
src/rpc/virnetlibsshsession.c | 1485 +++++++++++++++++++++++++++++++++++++++++
src/rpc/virnetlibsshsession.h | 78 +++
src/rpc/virnetsocket.c | 184 ++++-
src/rpc/virnetsocket.h | 13 +
src/util/virerror.c | 9 +-
17 files changed, 2082 insertions(+), 33 deletions(-)
create mode 100644 m4/virt-libssh.m4
create mode 100644 src/libvirt_libssh.syms
create mode 100644 src/rpc/virnetlibsshsession.c
create mode 100644 src/rpc/virnetlibsshsession.h
--
2.7.4
8 years
[libvirt] [PATCH] libvirt.spec: Build & run tests in parallel
by Michal Privoznik
So far, the main code is built in parallel, which makes it pretty
fast. But with a lots of tests we have now I've noticed this part
takes too much time to build. The problem was that tests were
build and run in a single job.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
libvirt.spec.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 545990c..4378d0a 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1290,7 +1290,7 @@ rm -fr %{buildroot}
%check
cd tests
-make
+make %{?_smp_mflags}
# These tests don't current work in a mock build root
for i in nodeinfotest seclabeltest
do
@@ -1299,7 +1299,7 @@ do
printf '#!/bin/sh\nexit 0\n' > $i
chmod +x $i
done
-if ! make check VIR_TEST_DEBUG=1
+if ! make %{?_smp_mflags} check VIR_TEST_DEBUG=1
then
cat test-suite.log || true
exit 1
--
2.8.4
8 years
[libvirt] [PATCH v2] [glib 1/5] gconfig: Allow schema to be NULL
by Zeeshan Ali
Validation (if attempted) should just fail in this case instead of
crashing.
---
libvirt-gconfig/libvirt-gconfig-object.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index 6225de2..851e35c 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -209,6 +209,14 @@ void gvir_config_object_validate(GVirConfigObject *config,
return;
}
+ if (!priv->schema) {
+ gvir_config_set_error_literal(err,
+ GVIR_CONFIG_OBJECT_ERROR,
+ 0,
+ _("No XML schema associated with this config object"));
+ return;
+ }
+
rngParser = xmlRelaxNGNewParserCtxt(priv->schema);
if (!rngParser) {
gvir_config_set_error(err,
--
2.9.3
8 years
[libvirt] [PATCH RFC] virhook: Adding inotify support to virhook.
by Julio Faracco
Libvirtd only support hooks when the daemon is started. Hooks cannot be
loaded when the daemon is already running. So, to load a hook you need to
restart the service everytime. Now, the inotify support enables the option
of create a hook and run it even if libvirtd was started.
Cc: Carlos Castilho <ccasti(a)br.ibm.com>
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
daemon/libvirtd.c | 1 +
src/libvirt_private.syms | 1 +
src/util/virhook.c | 165 ++++++++++++++++++++++++++++++++++++++++++++++-
src/util/virhook.h | 10 +++
4 files changed, 175 insertions(+), 2 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 95c1b1c..56175d1 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1622,6 +1622,7 @@ int main(int argc, char **argv) {
0, "shutdown", NULL, NULL);
cleanup:
+ virHookCleanUp();
virNetlinkEventServiceStopAll();
virObjectUnref(remoteProgram);
virObjectUnref(lxcProgram);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6a77e46..c8ad816 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1648,6 +1648,7 @@ virHashValueFree;
virHookCall;
virHookInitialize;
virHookPresent;
+virHookCleanUp;
# util/virhostdev.h
diff --git a/src/util/virhook.c b/src/util/virhook.c
index facd74a..d5fc928 100644
--- a/src/util/virhook.c
+++ b/src/util/virhook.c
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
+#include <sys/inotify.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -45,6 +46,10 @@ VIR_LOG_INIT("util.hook");
#define LIBVIRT_HOOK_DIR SYSCONFDIR "/libvirt/hooks"
+#define virHookInstall(driver) virHooksFound |= (1 << driver);
+
+#define virHookUninstall(driver) virHooksFound ^= (1 << driver);
+
VIR_ENUM_DECL(virHookDriver)
VIR_ENUM_DECL(virHookDaemonOp)
VIR_ENUM_DECL(virHookSubop)
@@ -109,6 +114,8 @@ VIR_ENUM_IMPL(virHookLibxlOp, VIR_HOOK_LIBXL_OP_LAST,
static int virHooksFound = -1;
+static virHookInotifyPtr virHooksInotify = NULL;
+
/**
* virHookCheck:
* @driver: the driver name "daemon", "qemu", "lxc"...
@@ -153,6 +160,121 @@ virHookCheck(int no, const char *driver)
return ret;
}
+/**
+ * virHookInotifyEvent:
+ * @fd: inotify file descriptor.
+ *
+ * Identifies file events at libvirt's hook directory.
+ * Install or uninstall hooks on demand. Acording file manipulation.
+ */
+static void
+virHookInotifyEvent(int watch ATTRIBUTE_UNUSED,
+ int fd,
+ int events ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ char buf[1024];
+ struct inotify_event *e;
+ int got;
+ int driver;
+ char *tmp, *name;
+
+ VIR_DEBUG("inotify event in virHookInotify()");
+
+reread:
+ got = read(fd, buf, sizeof(buf));
+ if (got == -1) {
+ if (errno == EINTR)
+ goto reread;
+ return;
+ }
+
+ tmp = buf;
+ while (got) {
+ if (got < sizeof(struct inotify_event))
+ return;
+
+ VIR_WARNINGS_NO_CAST_ALIGN
+ e = (struct inotify_event *)tmp;
+ VIR_WARNINGS_RESET
+
+ tmp += sizeof(struct inotify_event);
+ got -= sizeof(struct inotify_event);
+
+ if (got < e->len)
+ return;
+
+ tmp += e->len;
+ got -= e->len;
+
+ name = (char *)&(e->name);
+
+ /* Removing hook file. */
+ if (e->mask & (IN_DELETE | IN_MOVED_FROM)) {
+ if ((driver = virHookDriverTypeFromString(name)) < 0) {
+ VIR_DEBUG("Invalid hook name for %s", name);
+ return;
+ }
+
+ virHookUninstall(driver);
+ }
+
+ /* Creating hook file. */
+ if (e->mask & (IN_CREATE | IN_CLOSE_WRITE | IN_MOVED_TO)) {
+ if ((driver = virHookDriverTypeFromString(name)) < 0) {
+ VIR_DEBUG("Invalid hook name for %s", name);
+ return;
+ }
+
+ virHookInstall(driver);
+ }
+ }
+}
+
+/**
+ * virHookInotifyInit:
+ *
+ * Initialize inotify hooks support.
+ * Enable hooks installation on demand.
+ *
+ * Returns 0 if inotify was successfully installed, -1 in case of failure.
+ */
+static int
+virHookInotifyInit(void) {
+
+ if (VIR_ALLOC(virHooksInotify) < 0)
+ goto error;
+
+ if ((virHooksInotify->inotifyFD = inotify_init()) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot initialize inotify"));
+ goto error;
+ }
+
+ if ((virHooksInotify->inotifyWatch =
+ inotify_add_watch(virHooksInotify->inotifyFD,
+ LIBVIRT_HOOK_DIR,
+ IN_CREATE | IN_MODIFY | IN_DELETE)) < 0) {
+ virReportSystemError(errno, _("Failed to create inotify watch on %s"),
+ LIBVIRT_HOOK_DIR);
+ goto error;
+ }
+
+ if ((virHooksInotify->inotifyHandler =
+ virEventAddHandle(virHooksInotify->inotifyFD,
+ VIR_EVENT_HANDLE_READABLE,
+ virHookInotifyEvent, NULL, NULL)) < 0) {
+ VIR_DEBUG("Failed to add inotify handle in virHook.");
+ goto error;
+ }
+
+ return 0;
+
+error:
+ virHookCleanUp();
+ return -1;
+}
+
+
/*
* virHookInitialize:
*
@@ -174,10 +296,14 @@ virHookInitialize(void)
return -1;
if (res == 1) {
- virHooksFound |= (1 << i);
+ virHookInstall(i);
ret++;
}
}
+
+ if (virHookInotifyInit() < 0)
+ VIR_INFO("Disabling hooks inotify support.");
+
return ret;
}
@@ -309,7 +435,12 @@ virHookCall(int driver,
if (output)
virCommandSetOutputBuffer(cmd, output);
- ret = virCommandRun(cmd, NULL);
+ ret = virHookCheck(driver, virHookDriverTypeToString(driver));
+
+ if (ret > 0) {
+ ret = virCommandRun(cmd, NULL);
+ }
+
if (ret < 0) {
/* Convert INTERNAL_ERROR into known error. */
virReportError(VIR_ERR_HOOK_SCRIPT_FAILED, "%s",
@@ -322,3 +453,33 @@ virHookCall(int driver,
return ret;
}
+
+/**
+ * virHookCall:
+ *
+ * Release all structures and data used in virhooks.
+ *
+ * Returns: 0 if the execution succeeded
+ */
+int
+virHookCleanUp(void)
+{
+ if (!virHooksInotify)
+ return -1;
+
+ if ((virHooksInotify->inotifyFD >= 0) &&
+ (virHooksInotify->inotifyWatch >= 0))
+ if (inotify_rm_watch(virHooksInotify->inotifyFD,
+ virHooksInotify->inotifyWatch) < 0)
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot remove inotify watcher."));
+
+ if (virHooksInotify->inotifyHandler >= 0)
+ virEventRemoveHandle(virHooksInotify->inotifyHandler);
+
+ VIR_FORCE_CLOSE(virHooksInotify->inotifyFD);
+ VIR_FREE(virHooksInotify);
+
+ virHooksFound = -1;
+
+ return 0;
+}
diff --git a/src/util/virhook.h b/src/util/virhook.h
index 205249c..47a32c7 100644
--- a/src/util/virhook.h
+++ b/src/util/virhook.h
@@ -100,6 +100,14 @@ typedef enum {
VIR_HOOK_LIBXL_OP_LAST,
} virHookLibxlOpType;
+struct _virHookInotify {
+ int inotifyFD;
+ int inotifyWatch;
+ int inotifyHandler;
+};
+
+typedef struct _virHookInotify *virHookInotifyPtr;
+
int virHookInitialize(void);
int virHookPresent(int driver);
@@ -107,4 +115,6 @@ int virHookPresent(int driver);
int virHookCall(int driver, const char *id, int op, int sub_op,
const char *extra, const char *input, char **output);
+int virHookCleanUp(void);
+
#endif /* __VIR_HOOKS_H__ */
--
2.7.4
8 years
[libvirt] [PATCH] docs: Add Qt Virtual machines manager and Qt Remote viewer
by F1ash
From: Alexander Vasilenko <kaperang07(a)gmail.com>
---
docs/apps.html.in | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/docs/apps.html.in b/docs/apps.html.in
index 1a138b3..4efb318 100644
--- a/docs/apps.html.in
+++ b/docs/apps.html.in
@@ -208,6 +208,17 @@
to remote consoles supporting the VNC protocol. Also provides
an optional mozilla browser plugin.
</dd>
+ <dt><a href="http://f1ash.github.io/qt-virt-manager">qt-virt-manager</a></dt>
+ <dd>
+ The Qt GUI for create and control VMs and another virtual entities
+ (aka networks, storages, interfaces, secrets, network filters).
+ Contains integrated LXC/SPICE/VNC viewer for accessing the graphical or
+ text console associated with a virtual machine or container.
+ </dd>
+ <dt><a href="http://f1ash.github.io/qt-virt-manager/#virtual-machines-viewer">qt-remote-viewer</a></dt>
+ <dd>
+ The Qt VNC/SPICE viewer for access to remote desktops or VMs.
+ </dd>
</dl>
<h2><a name="iaas">Infrastructure as a Service (IaaS)</a></h2>
--
2.10.1
8 years
[libvirt] [glib 1/5] gconfig: Allow schema to be NULL
by Zeeshan Ali
Validation (if attempted) should just fail in this case instead of
crashing.
---
libvirt-gconfig/libvirt-gconfig-object.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index 6225de2..851e35c 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -209,6 +209,14 @@ void gvir_config_object_validate(GVirConfigObject *config,
return;
}
+ if (!priv->schema) {
+ gvir_config_set_error_literal(err,
+ GVIR_CONFIG_OBJECT_ERROR,
+ 0,
+ _("No XML schema associated with this config object"));
+ return;
+ }
+
rngParser = xmlRelaxNGNewParserCtxt(priv->schema);
if (!rngParser) {
gvir_config_set_error(err,
--
2.9.3
8 years
[libvirt] [PATCH] qemu: Reset post-copy capability after migration
by Jiri Denemark
Unlike other migration capabilities, post-copy is also set on the
destination host which means it doesn't disappear once domain is
migrated. As a result of that other functionality which internally uses
migration to a file (virDomainManagedSave, virDomainSave,
virDomainCoreDump) may fail after migration because the post-copy
capability is still set.
https://bugzilla.redhat.com/show_bug.cgi?id=1374718
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
We need a more generic way to store and reset migration
capabilities and parameters on both sides of migration since we
need to reset them in case migration fails. But it will need a
little bit more work, so let's start with this simple patch
fixing the most visible issue. I'll work on the generic solution
later.
src/qemu/qemu_migration.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 1c4a80c..d4a55d8 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -6418,6 +6418,9 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
*/
if (inPostCopy)
VIR_FREE(priv->job.completed);
+
+ qemuMigrationSetPostCopy(driver, vm, false,
+ QEMU_ASYNC_JOB_MIGRATION_IN);
}
qemuMigrationJobFinish(driver, vm);
--
2.10.2
8 years
[libvirt] [python PATCH] Post-release version bump to 2.5.0
by Pavel Hrdina
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
Pushed as trivial.
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 683dc93..ed11e2e 100755
--- a/setup.py
+++ b/setup.py
@@ -307,7 +307,7 @@ class my_clean(clean):
_c_modules, _py_modules = get_module_lists()
setup(name = 'libvirt-python',
- version = '2.4.0',
+ version = '2.5.0',
url = 'http://www.libvirt.org',
maintainer = 'Libvirt Maintainers',
maintainer_email = 'libvir-list(a)redhat.com',
--
2.10.2
8 years