[libvirt] [PATCH 00/21] Support NBD for tunnelled migration
by Pavel Boldin
The provided patchset implements NBD disk migration over a tunnelled
connection provided by libvirt.
The migration source instructs QEMU to NBD mirror drives into the provided
UNIX socket. These connections and all the data are then tunnelled to the
destination using newly introduced RPC call. The migration destination
implements a driver method that connects the tunnelled stream to the QEMU's
NBD destination.
The detailed scheme is the following:
PREPARE
1. Migration destination starts QEMU's NBD server listening on a UNIX socket
using the `nbd-server-add` monitor command and tells NBD to accept listed
disks via code added to qemuMigrationStartNBDServer that calls introduced
qemuMonitorNBDServerStartUnix monitor function.
PERFORM
2. Migration source creates a UNIX socket that is later used as NBDs
destination in `drive-mirror` monitor command.
This is implemented as a call to virNetSocketNewListenUnix from
doTunnelMigrate.
3. Source starts IOThread that polls on the UNIX socket, accepting every
incoming QEMU connection.
This is done by adding a new pollfd in the poll(2) call in
qemuMigrationIOFunc that calls introduced qemuNBDTunnelAcceptAndPipe
function.
4. The qemuNBDTunnelAcceptAndPipe function accepts the connection and creates
two virStream's. One is `local` that is later associated with just accepted
connection using virFDStreamOpen. Second is `remote` that is later
tunnelled to the remote destination stream.
The `local` stream is converted to a virFDStreamDrv stream using the
virFDStreamOpen call on the fd returned by accept(2).
The `remote` stream is associated with a stream on the destination in
the way similar to used by PrepareTunnel3* function. That is, the
virDomainMigrateOpenTunnel function called on the destination
connection object. The virDomainMigrateOpenTunnel calls remote driver's
handler remoteDomainMigrateOpenTunnel that makes DOMAIN_MIGRATE_OPEN_TUNNEL
call to the destination host. The code in remoteDomainMigrateOpenTunnel
ties passed virStream object to a virStream on the destination host via
remoteStreamDrv driver. The remote driver handles stream's IO by tunnelling
data through the RPC connection.
The qemuNBDTunnelAcceptAndPipe at last assigns both streams the same event
callback qemuMigrationPipeEvent. Its job is to track statuses of the
streams doing IO whenever it is necessary.
5. Source starts the drive mirroring using the qemuMigrationDriveMirror func.
The function instructs QEMU to mirror drives to the UNIX socket that thread
listens on.
Since it is necessary for the mirror driving to get into the 'synchronized'
state, where writes go to both destinations simultaneously, before
continuing VM migration, the thread serving the connections must be
started earlier.
6. When the connection to a UNIX socket on the migration source is made
the DOMAIN_MIGRATE_OPEN_TUNNEL proc is called on the migration destination.
The handler of this code calls virDomainMigrateOpenTunnel which calls
qemuMigrationOpenNBDTunnel by the means of qemuDomainMigrateOpenTunnel.
The qemuMigrationOpenNBDTunnel connects the stream linked to a source's
stream to the NBD's UNIX socket on the migration destination side.
7. The rest of the disk migration occurs semimagically: virStream* APIs tunnel
data in both directions. This is done by qemuMigrationPipeEvent event
callback set for both streams.
The order of the patches is roughly the following:
* First, the RPC machinery and remote driver's virDrvDomainMigrateOpenTunnel
implementation are added.
* Then, the source-side of the protocol is implemented: code listening
on a UNIX socket is added, DriveMirror is enhanced to instruct QEMU to
`drive-mirror` here and starting IOThread driving the tunneling sooner.
* After that, the destination-side of the protocol is implemented:
the qemuMonitorNBDServerStartUnix added and qemuMigrationStartNBDServer
enhanced to call it. The qemuDomainMigrateOpenTunnel is implemented
along with qemuMigrationOpenNBDTunnel that does the real job.
* Finally, the code blocking NBD migration for tunnelled migration is
removed.
Pavel Boldin (21):
rpc: add DOMAIN_MIGRATE_OPEN_TUNNEL proc
driver: add virDrvDomainMigrateOpenTunnel
remote_driver: introduce virRemoteClientNew
remote_driver: add remoteDomainMigrateOpenTunnel
domain: add virDomainMigrateOpenTunnel
domain: add virDomainMigrateTunnelFlags
remote: impl remoteDispatchDomainMigrateOpenTunnel
qemu: migration: src: add nbd tunnel socket data
qemu: migration: src: nbdtunnel unix socket
qemu: migration: src: qemu `drive-mirror` to UNIX
qemu: migration: src: qemuSock for running thread
qemu: migration: src: add NBD unixSock to iothread
qemu: migration: src: qemuNBDTunnelAcceptAndPipe
qemu: migration: src: stream piping
qemu: monitor: add qemuMonitorNBDServerStartUnix
qemu: migration: dest: nbd-server to UNIX sock
qemu: migration: dest: qemuMigrationOpenTunnel
qemu: driver: add qemuDomainMigrateOpenTunnel
qemu: migration: dest: qemuMigrationOpenNBDTunnel
qemu: migration: allow NBD tunneling migration
apparmor: fix tunnelmigrate permissions
daemon/remote.c | 50 ++++
docs/apibuild.py | 1 +
docs/hvsupport.pl | 1 +
include/libvirt/libvirt-domain.h | 3 +
src/driver-hypervisor.h | 8 +
src/libvirt-domain.c | 43 ++++
src/libvirt_internal.h | 6 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_driver.c | 24 ++
src/qemu/qemu_migration.c | 495 +++++++++++++++++++++++++++++++++------
src/qemu/qemu_migration.h | 6 +
src/qemu/qemu_monitor.c | 12 +
src/qemu/qemu_monitor.h | 2 +
src/qemu/qemu_monitor_json.c | 35 +++
src/qemu/qemu_monitor_json.h | 2 +
src/remote/remote_driver.c | 91 +++++--
src/remote/remote_protocol.x | 19 +-
src/remote_protocol-structs | 8 +
src/security/virt-aa-helper.c | 4 +-
19 files changed, 719 insertions(+), 92 deletions(-)
--
1.9.1
8 years, 11 months
[libvirt] [PATCH] nestedhvm for libxl
by Alvin Starr
This patch adds a nestedhvm directive to the lxm features to allow libxl to create a nested HVM.
It also has mask_svm_npt to allow the created HVM to have the svm/npt bits masked so that it cannot in turn run up an nested hvm.
Alvin Starr (1):
add nested HVM to libxl
docs/schemas/domaincommon.rng | 10 ++++++++++
src/conf/domain_conf.c | 6 ++++++
src/conf/domain_conf.h | 2 ++
src/libxl/libxl_conf.c | 35 +++++++++++++++++++++++++++++++++++
4 files changed, 53 insertions(+)
--
2.4.3
8 years, 11 months
[libvirt] [PATCHv2] "Don't include .c file for editing support" bug was fixed. Callbacks in special struct were added instead of EDIT-* macros
by rodinasophie@gmail.com
From: Sofia Rodina <rodinasophie(a)gmail.com>
---
tools/Makefile.am | 1 +
tools/virsh-domain.c | 187 ++++++++++++++++++++++++++++++++++++------------
tools/virsh-edit.c | 79 ++++++--------------
tools/virsh-edit.h | 42 +++++++++++
tools/virsh-interface.c | 64 +++++++++++++----
tools/virsh-network.c | 62 ++++++++++++----
tools/virsh-nwfilter.c | 64 +++++++++++++----
tools/virsh-pool.c | 64 +++++++++++++----
tools/virsh-snapshot.c | 76 ++++++++++++++------
9 files changed, 464 insertions(+), 175 deletions(-)
create mode 100644 tools/virsh-edit.h
diff --git a/tools/Makefile.am b/tools/Makefile.am
index d5638d9..88bb1b2 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -205,6 +205,7 @@ virsh_SOURCES = \
virsh-domain.c virsh-domain.h \
virsh-domain-monitor.c virsh-domain-monitor.h \
virsh-host.c virsh-host.h \
+ virsh-edit.c virsh-edit.h \
virsh-interface.c virsh-interface.h \
virsh-network.c virsh-network.h \
virsh-nodedev.c virsh-nodedev.h \
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 12e85e3..0beaa62 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -56,6 +56,7 @@
#include "virtime.h"
#include "virtypedparam.h"
#include "virxml.h"
+#include "virsh-edit.h"
/* Gnulib doesn't guarantee SA_SIGINFO support. */
#ifndef SA_SIGINFO
@@ -4622,6 +4623,44 @@ static const vshCmdOptDef opts_save_image_edit[] = {
{.name = NULL}
};
+typedef struct virshEditDomainUniversalStruct
+{
+ vshControl *ctl;
+ virshControlPtr priv;
+ const char *file;
+ virDomainPtr dom;
+ unsigned int getxml_flags;
+ bool *ret;
+ unsigned int *define_flags;
+ const char *key;
+ virDomainPtr *dom_edited;
+} virshEditDomainUniversalStruct;
+
+static char *
+virshEditDomainSaveImageGetXML(void *args)
+{
+ virshEditDomainUniversalStruct *str = (virshEditDomainUniversalStruct *)args;
+ return virDomainSaveImageGetXMLDesc(str->priv->conn, str->file, str->getxml_flags);
+}
+
+static void
+virshEditDomainSaveImageNotChanged(void *args)
+{
+ virshEditDomainUniversalStruct *str = (virshEditDomainUniversalStruct*)args;
+ vshPrint(str->ctl, _("Saved image %s XML configuration not changed.\n"), str->file);
+ *(str->ret) = true;
+}
+
+static bool
+virshEditDomainSaveIageDefine(void *args, char *doc_edited, char *doc)
+{
+ if (!doc)
+ return false;
+ virshEditDomainUniversalStruct *str = (virshEditDomainUniversalStruct*)args;
+ return (virDomainSaveImageDefineXML(str->priv->conn, str->file,
+ doc_edited, *(str->define_flags)) == 0);
+}
+
static bool
cmdSaveImageEdit(vshControl *ctl, const vshCmd *cmd)
{
@@ -4647,20 +4686,22 @@ cmdSaveImageEdit(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptStringReq(ctl, cmd, "file", &file) < 0)
return false;
-
-#define EDIT_GET_XML \
- virDomainSaveImageGetXMLDesc(priv->conn, file, getxml_flags)
-#define EDIT_NOT_CHANGED \
- do { \
- vshPrint(ctl, _("Saved image %s XML configuration " \
- "not changed.\n"), file); \
- ret = true; \
- goto edit_cleanup; \
- } while (0)
-#define EDIT_DEFINE \
- (virDomainSaveImageDefineXML(priv->conn, file, doc_edited, define_flags) == 0)
-#include "virsh-edit.c"
-
+ {
+ virshEditDomainUniversalStruct editDomainArgs = {
+ NULL, priv, file, NULL, getxml_flags,
+ &ret, &define_flags, NULL, NULL
+ };
+ virshEditControl editCtl = {
+ &virshEditDomainSaveImageGetXML,
+ &virshEditDomainSaveImageNotChanged,
+ &virshEditDomainSaveIageDefine,
+ NULL,
+ &editDomainArgs,
+ };
+
+ if (!virshEdit(ctl, &editCtl))
+ goto cleanup;
+ }
vshPrint(ctl, _("State file %s edited.\n"), file);
ret = true;
@@ -8145,6 +8186,30 @@ virshDomainGetEditMetadata(vshControl *ctl,
return ret;
}
+static char *
+virshEditDomainMetadataGetXML(void *args)
+{
+ virshEditDomainUniversalStruct *str = (virshEditDomainUniversalStruct*)(args);
+ return virshDomainGetEditMetadata(str->ctl, str->dom, str->file, str->getxml_flags);
+}
+
+static void
+virshEditMetadataNotChanged(void *args)
+{
+ virshEditDomainUniversalStruct *str = (virshEditDomainUniversalStruct*)args;
+ vshPrint(str->ctl, "%s", _("Metadata not changed"));
+ *(str->ret) = true;
+}
+
+static bool
+virshEditMetadataDefine(void *args, char *doc_edited, char *doc)
+{
+ if (!doc)
+ return false;
+ virshEditDomainUniversalStruct *str = (virshEditDomainUniversalStruct*)args;
+ return (virDomainSetMetadata(str->dom, VIR_DOMAIN_METADATA_ELEMENT, doc_edited,
+ str->key, str->file, *(str->define_flags)) == 0);
+}
static bool
cmdMetadata(vshControl *ctl, const vshCmd *cmd)
@@ -8196,20 +8261,19 @@ cmdMetadata(vshControl *ctl, const vshCmd *cmd)
else
vshPrint("%s\n", _("Metadata modified"));
} else if (edit) {
-#define EDIT_GET_XML \
- virshDomainGetEditMetadata(ctl, dom, uri, flags)
-#define EDIT_NOT_CHANGED \
- do { \
- vshPrint(ctl, "%s", _("Metadata not changed")); \
- ret = true; \
- goto edit_cleanup; \
- } while (0)
-
-#define EDIT_DEFINE \
- (virDomainSetMetadata(dom, VIR_DOMAIN_METADATA_ELEMENT, doc_edited, \
- key, uri, flags) == 0)
-#include "virsh-edit.c"
-
+ virshEditDomainUniversalStruct editMetadataArgs = {
+ ctl, NULL, uri, dom,
+ flags, &ret, &flags, key, NULL
+ };
+ virshEditControl editCtl = {
+ &virshEditDomainMetadataGetXML,
+ &virshEditMetadataNotChanged,
+ &virshEditMetadataDefine,
+ NULL,
+ &editMetadataArgs,
+ };
+ if (!virshEdit(ctl, &editCtl))
+ goto cleanup;
vshPrint("%s\n", _("Metadata modified"));
} else {
char *data;
@@ -11764,6 +11828,40 @@ static const vshCmdOptDef opts_edit[] = {
{.name = NULL}
};
+static char *
+virshEditDomainGetXML(void *args)
+{
+ virshEditDomainUniversalStruct *str = (virshEditDomainUniversalStruct*)args;
+ return virDomainGetXMLDesc(str->dom, str->getxml_flags);
+}
+
+static void
+virshEditDomainNotChanged(void *args)
+{
+ virshEditDomainUniversalStruct *str = (virshEditDomainUniversalStruct*)args;
+ vshPrint(str->ctl, _("Domain %s XML configuration not changed.\n"),
+ virDomainGetName(str->dom));
+ *(str->ret) = true;
+}
+
+static bool
+virshEditDomainDefine(void *args, char *doc_edited, char *doc)
+{
+ if (!doc)
+ return false;
+ virshEditDomainUniversalStruct *str = (virshEditDomainUniversalStruct*)args;
+ return
+ (*(str->dom_edited) = virshDomainDefine(str->priv->conn, doc_edited,
+ *(str->define_flags)));
+}
+
+static void
+virshEditDomainRelax(void *args)
+{
+ virshEditDomainUniversalStruct *str = (virshEditDomainUniversalStruct*)args;
+ *(str->define_flags) &= ~VIR_DOMAIN_DEFINE_VALIDATE;
+}
+
static bool
cmdEdit(vshControl *ctl, const vshCmd *cmd)
{
@@ -11780,24 +11878,21 @@ cmdEdit(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptBool(cmd, "skip-validate"))
define_flags &= ~VIR_DOMAIN_DEFINE_VALIDATE;
-
-#define EDIT_GET_XML virDomainGetXMLDesc(dom, query_flags)
-#define EDIT_NOT_CHANGED \
- do { \
- vshPrint(ctl, _("Domain %s XML configuration not changed.\n"), \
- virDomainGetName(dom)); \
- ret = true; \
- goto edit_cleanup; \
- } while (0)
-#define EDIT_DEFINE \
- (dom_edited = virshDomainDefine(priv->conn, doc_edited, define_flags))
-#define EDIT_RELAX \
- do { \
- define_flags &= ~VIR_DOMAIN_DEFINE_VALIDATE; \
- } while (0);
-
-#include "virsh-edit.c"
-#undef EDIT_RELAX
+ {
+ virshEditDomainUniversalStruct editDomainArgs = {
+ ctl, priv, NULL, dom,
+ query_flags, &ret, &define_flags, NULL, &dom_edited
+ };
+ virshEditControl editCtl = {
+ &virshEditDomainGetXML,
+ &virshEditDomainNotChanged,
+ &virshEditDomainDefine,
+ &virshEditDomainRelax,
+ &editDomainArgs,
+ };
+ if (!virshEdit(ctl, &editCtl))
+ goto cleanup;
+ }
vshPrint(ctl, _("Domain %s XML configuration edited.\n"),
virDomainGetName(dom_edited));
diff --git a/tools/virsh-edit.c b/tools/virsh-edit.c
index 1b39cb7..fdc2842 100644
--- a/tools/virsh-edit.c
+++ b/tools/virsh-edit.c
@@ -1,7 +1,7 @@
/*
- * virsh-edit.c: Implementation of generic virsh *-edit intelligence
+ * virsh-edit.c: Main function to edit in virsh
*
- * Copyright (C) 2012, 2015 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,45 +17,17 @@
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
- * Usage:
- * Define macros:
- * EDIT_GET_XML - expression which produces a pointer to XML string, e.g:
- * #define EDIT_GET_XML virDomainGetXMLDesc(dom, flags)
- *
- * EDIT_NOT_CHANGED - this action is taken if the XML wasn't changed.
- * Note, that you don't want to jump to cleanup but edit_cleanup label
- * where temporary variables are free()-d and temporary file is deleted:
- * #define EDIT_NOT_CHANGED vshPrint(ctl, _("Domain %s XML not changed"), \
- * virDomainGetName(dom)); \
- * ret = true; goto edit_cleanup;
- * Note that this is a statement.
- *
- * EDIT_DEFINE - expression which redefines the object. The edited XML from
- * user is in 'doc_edited' variable. Don't overwrite the pointer to the
- * object, as we may iterate once more over and therefore the pointer
- * would be invalid. Hence assign object to a different variable.
- * Moreover, this needs to be an expression where:
- * - 0 is taken as error (our virDefine* APIs often return NULL on error)
- * - everything else is taken as success
- * For example:
- * #define EDIT_DEFINE (dom_edited = virDomainDefineXML(ctl->conn, doc_edited))
- *
- * Michal Privoznik <mprivozn(a)redhat.com>
*/
-#ifndef EDIT_GET_XML
-# error Missing EDIT_GET_XML definition
-#endif
+#include <config.h>
+#include "internal.h"
-#ifndef EDIT_NOT_CHANGED
-# error Missing EDIT_NOT_CHANGED definition
-#endif
+#include "virsh-edit.h"
+#include "viralloc.h"
-#ifndef EDIT_DEFINE
-# error Missing EDIT_DEFINE definition
-#endif
-
-do {
+bool
+virshEdit(vshControl *ctl, virshEditControl *editCtl)
+{
char *tmp = NULL;
char *doc = NULL;
char *doc_edited = NULL;
@@ -65,7 +37,7 @@ do {
bool relax_avail = false;
/* Get the XML configuration of the object. */
- doc = (EDIT_GET_XML);
+ doc = (*editCtl->virshEditGetXML)(editCtl->virshEditArgs);
if (!doc)
goto edit_cleanup;
@@ -75,10 +47,8 @@ do {
goto edit_cleanup;
reedit:
-
-#ifdef EDIT_RELAX
- relax_avail = true;
-#endif
+ if (editCtl->virshEditRelax)
+ relax_avail = true;
/* Start the editor. */
if (vshEditFile(ctl, tmp) == -1)
@@ -91,8 +61,10 @@ do {
goto edit_cleanup;
/* Compare original XML with edited. Has it changed at all? */
- if (STREQ(doc, doc_edited))
- EDIT_NOT_CHANGED;
+ if (STREQ(doc, doc_edited)) {
+ (*editCtl->virshEditNotChanged)(editCtl->virshEditArgs);
+ goto edit_cleanup;
+ }
redefine:
msg = NULL;
@@ -102,7 +74,7 @@ do {
* losing a connection or the object going away.
*/
VIR_FREE(doc_reread);
- doc_reread = (EDIT_GET_XML);
+ doc_reread = (*editCtl->virshEditGetXML)(editCtl->virshEditArgs);
if (!doc_reread)
goto edit_cleanup;
@@ -114,7 +86,7 @@ do {
}
/* Everything checks out, so redefine the object. */
- if (!msg && !(EDIT_DEFINE))
+ if (!msg && !((*editCtl->virshEditDefine)(editCtl->virshEditArgs, doc_edited, doc)))
msg = _("Failed.");
if (msg) {
@@ -132,16 +104,14 @@ do {
goto edit_cleanup;
break;
-#ifdef EDIT_RELAX
case 'i':
if (relax_avail) {
- EDIT_RELAX;
+ (*editCtl->virshEditRelax)(editCtl->virshEditArgs);
relax_avail = false;
goto redefine;
break;
}
/* fall-through */
-#endif
default:
vshError(ctl, "%s", msg);
@@ -161,11 +131,6 @@ do {
}
if (!edit_success)
- goto cleanup;
-
-} while (0);
-
-
-#undef EDIT_GET_XML
-#undef EDIT_NOT_CHANGED
-#undef EDIT_DEFINE
+ return false;
+ return true;
+}
diff --git a/tools/virsh-edit.h b/tools/virsh-edit.h
new file mode 100644
index 0000000..9de3456
--- /dev/null
+++ b/tools/virsh-edit.h
@@ -0,0 +1,42 @@
+/*
+ * virsh-edit.h: Definition of generic virsh *-edit interface
+ *
+ * Copyright (C) 2012, 2015 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __VIRSH_EDIT_H_
+#define __VIRSH_EDIT_H_
+
+#include "vsh.h"
+
+typedef char *(virshEditGetXMLCallback)(void *args);
+typedef void (virshEditNotChangedCallback)(void *args);
+typedef bool (virshEditDefineCallback)(void *args, char *doc_edited, char *doc);
+typedef void (virshEditRelaxCallback)(void *args);
+
+typedef struct virshEditControl {
+ virshEditGetXMLCallback *virshEditGetXML;
+ virshEditNotChangedCallback *virshEditNotChanged;
+ virshEditDefineCallback *virshEditDefine;
+ virshEditRelaxCallback *virshEditRelax;
+ void *virshEditArgs;
+} virshEditControl;
+
+bool virshEdit(vshControl *ctl, virshEditControl *editCtl);
+
+#endif // __VIRSH_EDIT_H_
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index b69c685..28b15c4 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -39,6 +39,7 @@
#include "virutil.h"
#include "virxml.h"
#include "virstring.h"
+#include "virsh-edit.h"
virInterfacePtr
virshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
@@ -108,6 +109,42 @@ static const vshCmdOptDef opts_interface_edit[] = {
{.name = NULL}
};
+typedef struct virshEditInterfaceStruct
+{
+ vshControl *ctl;
+ virshControlPtr priv;
+ virInterfacePtr iface;
+ virInterfacePtr *iface_edited;
+ unsigned int flags;
+ bool *ret;
+} virshEditInterfaceStruct;
+
+static char *
+virshEditInterfaceGetXML(void *args)
+{
+ virshEditInterfaceStruct *str = (virshEditInterfaceStruct*)args;
+ return virInterfaceGetXMLDesc(str->iface, str->flags);
+}
+
+static void
+virshEditInterfaceNotChanged(void *args)
+{
+ virshEditInterfaceStruct *str = (virshEditInterfaceStruct*)args;
+ vshPrint(str->ctl, _("Interface %s XML configuration not changed.\n"),
+ virInterfaceGetName(str->iface));
+ *(str->ret) = true;
+}
+
+static bool
+virshEditInterfaceDefine(void *args, char *doc_edited, char *doc)
+{
+ if (!doc)
+ return false;
+ virshEditInterfaceStruct *str = (virshEditInterfaceStruct*)args;
+ return (*(str->iface_edited) = virInterfaceDefineXML(str->priv->conn,
+ doc_edited, 0));
+}
+
static bool
cmdInterfaceEdit(vshControl *ctl, const vshCmd *cmd)
{
@@ -120,19 +157,20 @@ cmdInterfaceEdit(vshControl *ctl, const vshCmd *cmd)
iface = virshCommandOptInterface(ctl, cmd, NULL);
if (iface == NULL)
goto cleanup;
-
-#define EDIT_GET_XML virInterfaceGetXMLDesc(iface, flags)
-#define EDIT_NOT_CHANGED \
- do { \
- vshPrint(ctl, _("Interface %s XML configuration not changed.\n"), \
- virInterfaceGetName(iface)); \
- ret = true; \
- goto edit_cleanup; \
- } while (0)
-#define EDIT_DEFINE \
- (iface_edited = virInterfaceDefineXML(priv->conn, doc_edited, 0))
-#include "virsh-edit.c"
-
+ {
+ virshEditInterfaceStruct editInterfaceArgs = {
+ ctl, priv, iface, &iface_edited, flags, &ret
+ };
+ virshEditControl editCtl = {
+ &virshEditInterfaceGetXML,
+ &virshEditInterfaceNotChanged,
+ &virshEditInterfaceDefine,
+ NULL,
+ &editInterfaceArgs,
+ };
+ if (!virshEdit(ctl, &editCtl))
+ goto cleanup;
+ }
vshPrint(ctl, _("Interface %s XML configuration edited.\n"),
virInterfaceGetName(iface_edited));
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index a0f7707..0118adc 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -32,6 +32,7 @@
#include "virfile.h"
#include "virstring.h"
#include "conf/network_conf.h"
+#include "virsh-edit.h"
virNetworkPtr
virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
@@ -1121,6 +1122,41 @@ static char *virshNetworkGetXMLDesc(virNetworkPtr network)
return doc;
}
+typedef struct virshEditNetworkStruct
+{
+ vshControl *ctl;
+ virNetworkPtr network;
+ virNetworkPtr *network_edited;
+ virshControlPtr priv;
+ bool *ret;
+} virshEditNetworkStruct;
+
+static char *
+virshEditNetworkGetXML(void *args)
+{
+ virshEditNetworkStruct *str = (virshEditNetworkStruct*)args;
+ return virshNetworkGetXMLDesc(str->network);
+}
+
+static void
+virshEditNetworkNotChanged(void *args)
+{
+ virshEditNetworkStruct *str = (virshEditNetworkStruct*)args;
+ vshPrint(str->ctl, _("Network %s XML configuration not changed.\n"),
+ virNetworkGetName(str->network));
+ *(str->ret) = true;
+}
+
+static bool
+virshEditNetworkDefine(void *args, char *doc_edited, char *doc)
+{
+ if (!doc)
+ return false;
+ virshEditNetworkStruct *str = (virshEditNetworkStruct*)args;
+ *(str->network_edited) = virNetworkDefineXML(str->priv->conn, doc_edited);
+ return *(str->network_edited);
+}
+
static bool
cmdNetworkEdit(vshControl *ctl, const vshCmd *cmd)
{
@@ -1133,18 +1169,20 @@ cmdNetworkEdit(vshControl *ctl, const vshCmd *cmd)
if (network == NULL)
goto cleanup;
-#define EDIT_GET_XML virshNetworkGetXMLDesc(network)
-#define EDIT_NOT_CHANGED \
- do { \
- vshPrint(ctl, _("Network %s XML configuration not changed.\n"), \
- virNetworkGetName(network)); \
- ret = true; \
- goto edit_cleanup; \
- } while (0)
-#define EDIT_DEFINE \
- (network_edited = virNetworkDefineXML(priv->conn, doc_edited))
-#include "virsh-edit.c"
-
+ {
+ virshEditNetworkStruct editNetworkArgs = {
+ ctl, network, &network_edited, priv, &ret
+ };
+ virshEditControl editCtl = {
+ &virshEditNetworkGetXML,
+ &virshEditNetworkNotChanged,
+ &virshEditNetworkDefine,
+ NULL,
+ &editNetworkArgs,
+ };
+ if (!virshEdit(ctl, &editCtl))
+ goto cleanup;
+ }
vshPrint(ctl, _("Network %s XML configuration edited.\n"),
virNetworkGetName(network_edited));
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index 7732da8..36677ca 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -31,6 +31,7 @@
#include "viralloc.h"
#include "virfile.h"
#include "virutil.h"
+#include "virsh-edit.h"
virNWFilterPtr
virshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd,
@@ -404,6 +405,41 @@ static const vshCmdOptDef opts_nwfilter_edit[] = {
{.name = NULL}
};
+typedef struct virshEditNWFilterStruct
+{
+ vshControl *ctl;
+ virNWFilterPtr nwfilter;
+ virNWFilterPtr *nwfilter_edited;
+ virshControlPtr priv;
+ bool *ret;
+} virshEditNWFilterStruct;
+
+static char *
+virshEditNWFilterGetXML(void *args)
+{
+ virshEditNWFilterStruct *str = (virshEditNWFilterStruct*)args;
+ return virNWFilterGetXMLDesc(str->nwfilter, 0);
+}
+
+static void
+virshEditNWFilterNotChanged(void *args)
+{
+ virshEditNWFilterStruct *str = (virshEditNWFilterStruct*)args;
+ vshPrint(str->ctl, _("Network filter %s XML configuration not changed.\n"),
+ virNWFilterGetName(str->nwfilter));
+ *(str->ret) = true;
+}
+
+static bool
+virshEditNWFilterDefine(void *args, char *doc_edited, char *doc)
+{
+ if (!doc)
+ return false;
+ virshEditNWFilterStruct *str = (virshEditNWFilterStruct*)args;
+ *(str->nwfilter_edited) = virNWFilterDefineXML(str->priv->conn, doc_edited);
+ return *(str->nwfilter_edited);
+}
+
static bool
cmdNWFilterEdit(vshControl *ctl, const vshCmd *cmd)
{
@@ -415,20 +451,20 @@ cmdNWFilterEdit(vshControl *ctl, const vshCmd *cmd)
nwfilter = virshCommandOptNWFilter(ctl, cmd, NULL);
if (nwfilter == NULL)
goto cleanup;
-
-#define EDIT_GET_XML virNWFilterGetXMLDesc(nwfilter, 0)
-#define EDIT_NOT_CHANGED \
- do { \
- vshPrint(ctl, _("Network filter %s XML " \
- "configuration not changed.\n"), \
- virNWFilterGetName(nwfilter)); \
- ret = true; \
- goto edit_cleanup; \
- } while (0)
-#define EDIT_DEFINE \
- (nwfilter_edited = virNWFilterDefineXML(priv->conn, doc_edited))
-#include "virsh-edit.c"
-
+ {
+ virshEditNWFilterStruct editNWFilterArgs = {
+ ctl, nwfilter, &nwfilter_edited, priv, &ret
+ };
+ virshEditControl editCtl = {
+ &virshEditNWFilterGetXML,
+ &virshEditNWFilterNotChanged,
+ &virshEditNWFilterDefine,
+ NULL,
+ &editNWFilterArgs,
+ };
+ if (!virshEdit(ctl, &editCtl))
+ goto cleanup;
+ }
vshPrint(ctl, _("Network filter %s XML configuration edited.\n"),
virNWFilterGetName(nwfilter_edited));
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index cf5a8f3..740a130 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -32,6 +32,7 @@
#include "virfile.h"
#include "conf/storage_conf.h"
#include "virstring.h"
+#include "virsh-edit.h"
virStoragePoolPtr
virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
@@ -1791,6 +1792,42 @@ static const vshCmdOptDef opts_pool_edit[] = {
{.name = NULL}
};
+typedef struct virshEditStoragePoolStruct
+{
+ vshControl *ctl;
+ virStoragePoolPtr pool;
+ virStoragePoolPtr *pool_edited;
+ virshControlPtr priv;
+ bool *ret;
+ unsigned int flags;
+} virshEditStoragePoolStruct;
+
+static char *
+virshEditStoragePoolGetXML(void *args)
+{
+ virshEditStoragePoolStruct *str = (virshEditStoragePoolStruct*)args;
+ return virStoragePoolGetXMLDesc(str->pool, str->flags);
+}
+
+static void
+virshEditStoragePoolNotChanged(void *args)
+{
+ virshEditStoragePoolStruct *str = (virshEditStoragePoolStruct*)args;
+ vshPrint(str->ctl, _("Pool %s XML configuration not changed.\n"),
+ virStoragePoolGetName(str->pool));
+ *(str->ret) = true;
+}
+
+static bool
+virshEditStoragePoolDefine(void *args, char *doc_edited, char *doc)
+{
+ if (!doc)
+ return false;
+ virshEditStoragePoolStruct *str = (virshEditStoragePoolStruct*)args;
+ return (*(str->pool_edited) =
+ virStoragePoolDefineXML(str->priv->conn, doc_edited, 0));
+}
+
static bool
cmdPoolEdit(vshControl *ctl, const vshCmd *cmd)
{
@@ -1816,19 +1853,20 @@ cmdPoolEdit(vshControl *ctl, const vshCmd *cmd)
} else {
VIR_FREE(tmp_desc);
}
-
-#define EDIT_GET_XML virStoragePoolGetXMLDesc(pool, flags)
-#define EDIT_NOT_CHANGED \
- do { \
- vshPrint(ctl, _("Pool %s XML configuration not changed.\n"), \
- virStoragePoolGetName(pool)); \
- ret = true; \
- goto edit_cleanup; \
- } while (0)
-#define EDIT_DEFINE \
- (pool_edited = virStoragePoolDefineXML(priv->conn, doc_edited, 0))
-#include "virsh-edit.c"
-
+ {
+ virshEditStoragePoolStruct editStoragePoolArgs = {
+ ctl, pool, &pool_edited, priv, &ret, flags
+ };
+ virshEditControl editCtl = {
+ &virshEditStoragePoolGetXML,
+ &virshEditStoragePoolNotChanged,
+ &virshEditStoragePoolDefine,
+ NULL,
+ &editStoragePoolArgs,
+ };
+ if (!virshEdit(ctl, &editCtl))
+ goto cleanup;
+ }
vshPrint(ctl, _("Pool %s XML configuration edited.\n"),
virStoragePoolGetName(pool_edited));
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 3ab2104..908dcfd 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -41,6 +41,7 @@
#include "virstring.h"
#include "virxml.h"
#include "conf/snapshot_conf.h"
+#include "virsh-edit.h"
/* Helper for snapshot-create and snapshot-create-as */
static bool
@@ -548,6 +549,47 @@ static const vshCmdOptDef opts_snapshot_edit[] = {
{.name = NULL}
};
+typedef struct virshEditSnapshotStruct
+{
+ vshControl *ctl;
+ virDomainSnapshotPtr snapshot;
+ virDomainSnapshotPtr *edited;
+ virDomainPtr dom;
+ bool *ret;
+ unsigned int getxml_flags;
+ unsigned int *define_flags;
+ const char *name;
+} virshEditSnapshotStruct;
+
+static char *
+virshEditSnapshotGetXML(void *args)
+{
+ virshEditSnapshotStruct *str = (virshEditSnapshotStruct*)args;
+ return virDomainSnapshotGetXMLDesc(str->snapshot, str->getxml_flags);
+}
+
+static void
+virshEditSnapshotNotChanged(void *args)
+{
+ virshEditSnapshotStruct *str = (virshEditSnapshotStruct*)args;
+ /* Depending on flags, we re-edit even if XML is unchanged. */
+ if (!(*(str->define_flags) & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) {
+ vshPrint(str->ctl, _("Snapshot %s XML configuration not changed.\n"),
+ str->name);
+ *(str->ret) = true;
+ }
+}
+
+static bool
+virshEditSnapshotDefine(void *args, char *doc_edited, char *doc)
+{
+ virshEditSnapshotStruct *str = (virshEditSnapshotStruct*)args;
+ (strstr(doc, "<state>disk-snapshot</state>") ?
+ *(str->define_flags) |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY : 0);
+ return (*(str->edited) = virDomainSnapshotCreateXML(str->dom, doc_edited,
+ *(str->define_flags)));
+}
+
static bool
cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
{
@@ -574,26 +616,20 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
if (virshLookupSnapshot(ctl, cmd, "snapshotname", false, dom,
&snapshot, &name) < 0)
goto cleanup;
-
-#define EDIT_GET_XML \
- virDomainSnapshotGetXMLDesc(snapshot, getxml_flags)
-#define EDIT_NOT_CHANGED \
- do { \
- /* Depending on flags, we re-edit even if XML is unchanged. */ \
- if (!(define_flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) { \
- vshPrint(ctl, \
- _("Snapshot %s XML configuration not changed.\n"), \
- name); \
- ret = true; \
- goto edit_cleanup; \
- } \
- } while (0)
-#define EDIT_DEFINE \
- (strstr(doc, "<state>disk-snapshot</state>") ? \
- define_flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY : 0), \
- edited = virDomainSnapshotCreateXML(dom, doc_edited, define_flags)
-#include "virsh-edit.c"
-
+ {
+ virshEditSnapshotStruct editSnapshotArgs = {
+ ctl, snapshot, &edited, dom, &ret, getxml_flags, &define_flags, name
+ };
+ virshEditControl editCtl = {
+ &virshEditSnapshotGetXML,
+ &virshEditSnapshotNotChanged,
+ &virshEditSnapshotDefine,
+ NULL,
+ &editSnapshotArgs,
+ };
+ if (!virshEdit(ctl, &editCtl))
+ goto cleanup;
+ }
edited_name = virDomainSnapshotGetName(edited);
if (STREQ(name, edited_name)) {
vshPrint(ctl, _("Snapshot %s edited.\n"), name);
--
2.1.4
8 years, 11 months
[libvirt] [PATCHv2 0/4] Implement shared memory device (cold) hot-plug/unplug
by Luyao Huang
v1:
https://www.redhat.com/archives/libvir-list/2015-June/msg00830.html
These patches implement the hot-plug/hot-unplug
and cold-plug/cold-unplug for Inter-VM Shared Memory PCI device.
Luyao Huang (4):
conf: Add helpers to insert/remove/find shmem devices in domain def
qemu: Implement shared memory device cold (un)plug
qemu: Implement share memory device hot-plug
qemu: Implement shared memory device hot-unplug
src/conf/domain_conf.c | 66 ++++++++++++++++++++
src/conf/domain_conf.h | 7 +++
src/libvirt_private.syms | 4 ++
src/qemu/qemu_driver.c | 35 +++++++++--
src/qemu/qemu_hotplug.c | 152 ++++++++++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_hotplug.h | 6 ++
6 files changed, 265 insertions(+), 5 deletions(-)
--
1.8.3.1
9 years
[libvirt] [PATCH v2] Allow building lxc without virt-login-shell
by Cédric Bosdonnat
Add a configure option to disable virt-login-shell build even if lxc is
enabled.
---
Diff to V1:
* moved the configure.ac code into m4/virt-login-shell.m4
* allow building virt-login-shell without lxc
* Introduce WITH_SETUID_RPC_CLIENT to have it built if
either lxc or virt-login-shell is built.
configure.ac | 9 +++++++++
m4/virt-login-shell.m4 | 27 +++++++++++++++++++++++++++
src/Makefile.am | 4 ++--
tools/Makefile.am | 12 ++++++------
4 files changed, 44 insertions(+), 8 deletions(-)
create mode 100644 m4/virt-login-shell.m4
diff --git a/configure.ac b/configure.ac
index f481c50..6fef728 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1075,6 +1075,14 @@ fi
AM_CONDITIONAL([WITH_LXC], [test "$with_lxc" = "yes"])
dnl
+dnl Check for virt-login-shell
+dnl
+
+LIBVIRT_CHECK_LOGIN_SHELL
+
+AM_CONDITIONAL([WITH_SETUID_RPC_CLIENT], [test "$with_lxc$with_login_shell" != "nono"])
+
+dnl
dnl Checks for the Parallels driver
dnl
@@ -2974,6 +2982,7 @@ AC_MSG_NOTICE([ Init script: $with_init_script])
AC_MSG_NOTICE([Char device locks: $with_chrdev_lock_files])
AC_MSG_NOTICE([ Default Editor: $DEFAULT_EDITOR])
AC_MSG_NOTICE([ Loader/NVRAM: $with_loader_nvram])
+AC_MSG_NOTICE([ virt-login-shell: $with_login_shell])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Developer Tools])
AC_MSG_NOTICE([])
diff --git a/m4/virt-login-shell.m4 b/m4/virt-login-shell.m4
new file mode 100644
index 0000000..0701054
--- /dev/null
+++ b/m4/virt-login-shell.m4
@@ -0,0 +1,27 @@
+dnl Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library. If not, see
+dnl <http://www.gnu.org/licenses/>.
+
+AC_DEFUN([LIBVIRT_CHECK_LOGIN_SHELL], [
+ AC_ARG_WITH([login_shell],
+ [AS_HELP_STRING([--with-login-shell],
+ [build virt-login-shell @<:@default=yes@:>@])])
+ m4_divert_text([DEFAULTS], [with_login_shell=yes])
+
+ if test "$with_login_shell" ; then
+ AC_DEFINE_UNQUOTED([WITH_LOGIN_SHELL], 1, [whether virt-login-shell is built])
+ fi
+ AM_CONDITIONAL([WITH_LOGIN_SHELL], [test "$with_login_shell" = "yes"])
+])
diff --git a/src/Makefile.am b/src/Makefile.am
index 99b4993..2f40910 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2225,7 +2225,7 @@ libvirt_lxc_la_LIBADD = libvirt.la $(CYGWIN_EXTRA_LIBADD)
# have a RPC client for local UNIX socket access only. We use
# the ../config-post.h header to disable all external deps that
# we don't want
-if WITH_LXC
+if WITH_SETUID_RPC_CLIENT
noinst_LTLIBRARIES += libvirt-setuid-rpc-client.la
libvirt_setuid_rpc_client_la_SOURCES = \
@@ -2302,7 +2302,7 @@ libvirt_setuid_rpc_client_la_CFLAGS = \
$(SECDRIVER_CFLAGS) \
$(XDR_CFLAGS) \
$(NULL)
-endif WITH_LXC
+endif WITH_SETUID_RPC_CLIENT
lockdriverdir = $(libdir)/libvirt/lock-driver
lockdriver_LTLIBRARIES =
diff --git a/tools/Makefile.am b/tools/Makefile.am
index d5638d9..d005035 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -71,12 +71,12 @@ sbin_SCRIPTS = virt-sanlock-cleanup
DISTCLEANFILES += virt-sanlock-cleanup
endif WITH_SANLOCK
-if WITH_LXC
+if WITH_LOGIN_SHELL
conf_DATA += virt-login-shell.conf
bin_PROGRAMS += virt-login-shell
-else ! WITH_LXC
+else ! WITH_LOGIN_SHELL
EXTRA_DIST += virt-login-shell.conf
-endif ! WITH_LXC
+endif ! WITH_LOGIN_SHELL
dist_man1_MANS = \
@@ -84,11 +84,11 @@ dist_man1_MANS = \
virt-pki-validate.1 \
virt-xml-validate.1 \
virsh.1
-if WITH_LXC
+if WITH_LOGIN_SHELL
dist_man1_MANS += virt-login-shell.1
-else ! WITH_LXC
+else ! WITH_LOGIN_SHELL
EXTRA_DIST += virt-login-shell.1
-endif ! WITH_LXC
+endif ! WITH_LOGIN_SHELL
if WITH_SANLOCK
dist_man8_MANS = virt-sanlock-cleanup.8
endif WITH_SANLOCK
--
2.1.4
9 years
[libvirt] [PATCH] build: disable vbox on cygwin
by Eric Blake
Cygwin cannot build the vbox driver yet:
CC vbox/libvirt_driver_vbox_impl_la-vbox_glue.lo
In file included from vbox/vbox_glue.c:27:0:
vblox/vbox_XPCOMCGlue.c:63:3: error: #error "Port me"
# error "Port me"
^
In file included from vbox/vbox_XPCOMCGlue.c:45:0,
from vbox/vbox_glue.c:27:
vbox/vbox_XPCOMCGlue.c: In function 'tryLoadOne':
vbox/vbox_XPCOMCGlue.c:98:46: error: 'DYNLIB_NAME' undeclared (first use in this function)
if (virAsprintf(&name, "%s/%s", dir, DYNLIB_NAME) < 0)
^
./util/virstring.h:245:31: note: in definition of macro 'virAsprintf'
strp, __VA_ARGS__)
^
Rather than trying to figure out how to get dynamic loading of
vbox to work under cygwin (since I don't even have a working vbox
setup to test whether it works), I'm going to be lazy and just
default to not even trying vbox on cygwin.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Not technically a build-breaker, since I can './configure --without-vbox'
to work around it, so I'll wait for a review.
configure.ac | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 75e95b7..2c34333 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,12 +175,13 @@ dnl are also linux specific. The "network" and storage_fs drivers are known
dnl to not work on MacOS X presently, so we also make a note if compiling
dnl for that
-with_linux=no with_osx=no with_freebsd=no
+with_linux=no with_osx=no with_freebsd=no with_win=no with_cygwin=no
case $host in
*-*-linux*) with_linux=yes ;;
*-*-darwin*) with_osx=yes ;;
*-*-freebsd*) with_freebsd=yes ;;
*-*-mingw* | *-*-msvc* ) with_win=yes ;;
+ *-*-cygwin*) with_cygwin=yes ;;
esac
if test $with_linux = no; then
@@ -192,9 +193,12 @@ if test $with_linux = no; then
fi
if test $with_freebsd = yes; then
- want_ifconfig=yes
+ want_ifconfig=yes
+ with_firewalld=no
+fi
- with_firewalld=no
+if test $with_cygwin = yes; then
+ with_vbox=no
fi
AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
--
2.4.3
9 years
[libvirt] [PATCH v3 0/8] libxl: domain statistics support
by Joao Martins
Hey,
[ Apologies for resending this series before receiving comments, but I
found two issues (namely on patch 3 and 4) and thus I am reposting it
as v3 having those fixed. ]
This series bring support for various statistics about domains
regarding CPU, Memory, Network Interfaces, Block and Jobs. Not all of
the statistics are implemented: qdisk support is missing in this series
and some of the memory statistics aren't available.
With this series we further implement 7 more functions of libvirt APIs.
It is organized as follows:
* Patch 1, 2: implements cpu/memory statistics.
* Patch 3: implements network statistics
* Patch 4: adds helper method virDiskNameParse as an extension
to virDiskNameToIndex (New)
* Patch 5: VBD block statistics. QDisk will follow up in a separate
series regarding QEMU monitor integration.
* Patch 6: implement fetching all domain statistics
* Patch 7, 8: implements Job information statistics.
Overall it looks big but 70% of the patch is due to #5 and #6 but doesn't
add necessarily more complexity to the driver I believe. Patch #7 and #8
are of special importance because GetJobInfo and GetJobStats are now used
in Openstack Kilo to monitor live-migration progress. These two patches
together with the p2p migration I sent earlier let us sucessfully
live-migrate with Openstack Kilo. Furthermore with this series we get to
support nova diagnostics.
Tested this series on 4.4.3 and 4.5 setups plus Openstack Kilo.
Individual patches contain the changelog and comments addressed since v1.
Thanks!
Joao Martins (8):
libxl: implement virDomainGetCPUStats
libxl: implement virDomainMemorystats
libxl: implement virDomainInterfaceStats
util: add virDiskNameParse to handle disk and partition idx
libxl: implement virDomainBlockStats
libxl: implement virConnectGetAllDomainStats
libxl: implement virDomainGetJobInfo
libxl: implement virDomainGetJobStats
configure.ac | 2 +-
src/libvirt_private.syms | 1 +
src/libxl/libxl_domain.c | 54 +++
src/libxl/libxl_domain.h | 6 +
src/libxl/libxl_driver.c | 960 +++++++++++++++++++++++++++++++++++++++++++++++
src/util/virutil.c | 41 +-
src/util/virutil.h | 1 +
tests/utiltest.c | 56 +++
8 files changed, 1116 insertions(+), 5 deletions(-)
--
2.1.4
9 years
[libvirt] [PATCH] qemu_agent: fix deadlock in qemuProcessHandleAgentEOF
by Wang Yufei
We shutdown a VM A by qemu agent,meanwhile an agent EOF
of VM A happened, there's a chance that deadlock occurred:
qemuProcessHandleAgentEOF in main thread
A) priv->agent = NULL; //A happened before B
//deadlock when we get agent lock which's held by worker thread
qemuAgentClose(agent);
qemuDomainObjExitAgent called by qemuDomainShutdownFlags in worker thread
B) hasRefs = virObjectUnref(priv->agent); //priv->agent is NULL, return false
if (hasRefs)
virObjectUnlock(priv->agent); //agent lock will not be released here
So I close agent first, then set priv->agent NULL to fix the deadlock.
Signed-off-by: Wang Yufei <james.wangyufei(a)huawei.com>
Reviewed-by: Ren Guannan <renguannan(a)huawei.com>
---
src/qemu/qemu_process.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f2586a1..8c9622e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -150,11 +150,10 @@ qemuProcessHandleAgentEOF(qemuAgentPtr agent,
goto unlock;
}
+ qemuAgentClose(agent);
priv->agent = NULL;
virObjectUnlock(vm);
-
- qemuAgentClose(agent);
return;
unlock:
--
1.8.3.4
9 years
[libvirt] [PATCH 0/6] Memory locking limit improvements
by Andrea Bolognani
As noticed by Peter[1], the memory locking limit for the
QEMU process is increased before assigning a VFIO device to
a guest, but it might not be decreased when returning said
device to the host.
This series fixes this inconsistent behaviour and cleans up
the code a little bit along the way.
The idea is to introduce a new, smarter function called
qemuDomainAdjustMaxMemLock() that does The Right Thing™ and
increases the limit when required, while at the same time
storing the original value. This way, when memory locking
is no longer needed, it can restore it.
I've tested this both on x86 and ppc64, both by removing
devices that were assigned in the domain XML and devices
that I had hotplugged.
Patches 1-2 lay some groundwork by allowing retrieval of
the memory locking limit for a process.
Patches 3-4 add qemuDomainAdjustMaxMemLock() and use it
where appropriate in the existing code.
Patch 5 adds one more use of the function, after a PCI
hostdev has been detached from the guest.
Patch 6 replaces the use of Mlock with MemLock. Suggestions
on how to further improve the names of those functions is
very welcome, this is just a first step in the right
direction.
Cheers.
[1] https://www.redhat.com/archives/libvir-list/2015-November/msg00642.html
Andrea Bolognani (6):
process: Allow virProcessPrLimit() to get current limit
process: Add virProcessGetMaxMemLock()
qemu: Add qemuDomainAdjustMaxMemLock()
qemu: Use qemuDomainAdjustMaxMemLock()
qemu: Reduce memlock limit after detaching hostdev
qemu: Replace Mlock with MemLock in function names
configure.ac | 2 +-
src/conf/domain_conf.h | 3 +++
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 4 ++--
src/qemu/qemu_domain.c | 56 +++++++++++++++++++++++++++++++++++++++++++---
src/qemu/qemu_domain.h | 5 +++--
src/qemu/qemu_hotplug.c | 46 ++++++++++++++++----------------------
src/util/virprocess.c | 58 +++++++++++++++++++++++++++++++++++++++++++-----
src/util/virprocess.h | 2 ++
9 files changed, 136 insertions(+), 41 deletions(-)
--
2.5.0
9 years