[libvirt] [PATCH 0/2] FreeBSD build fixes
by Andrea Bolognani
Applying these fixes building on FreeBSD, at least on my local
builder (10.3-RELEASE).
Cheers.
Andrea Bolognani (2):
configure: Move check for <gnutls/crypto.h>
netdev: Use the correct pointer type for virSocketAddrFormat()
configure.ac | 10 +++++-----
src/util/virnetdev.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
--
2.5.5
8 years, 7 months
[libvirt] [PATCH] util: netdev: Don't crash in virNetDevSetIPAddress if @peer is NULL
by Peter Krempa
VIR_SOCKET_ADDR_VALID dereferences the pointer, thus if we pass NULL
into virNetDevSetIPAddress it crashes. Regression introduced by
b3d069872ce53eb.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325120
---
src/util/virnetdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 712c3bc..0d030a3 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1129,7 +1129,7 @@ int virNetDevSetIPAddress(const char *ifname,
unsigned int recvbuflen;
/* The caller needs to provide a correct address */
- if (VIR_SOCKET_ADDR_FAMILY(addr) == AF_INET && !VIR_SOCKET_ADDR_VALID(peer)) {
+ if (VIR_SOCKET_ADDR_FAMILY(addr) == AF_INET && peer && !VIR_SOCKET_ADDR_VALID(peer)) {
/* compute a broadcast address if this is IPv4 */
if (VIR_ALLOC(broadcast) < 0)
return -1;
--
2.8.0
8 years, 7 months
[libvirt] [PATCH v3 00/11] Introduce worker tuning APIs
by Erik Skultety
since v2:
- all getters are now protected by threadpool mutex to prevent torn reads in
concurrent execution
- some checks in adminDispatchServerGetThreadpoolParameters were redundant,
thus were optimizes out
- fixed memory leak in adminDispatchServerGetThreadpoolParameters when
allocating a newlist although typed params serialization already does that
- fixed some cosmetic issues like exporting a function prototype one patch
earlier than it should actually be introduced - a mistake that got there by
interactive rebase
Erik Skultety (11):
po: Fix record ordering in POTFILES.in
libvirt-host: Move virTypedParam* to libvirt-common
admin: Enable usage of typed parameters
util: Refactor thread creation by introducing virThreadPoolExpand
util: Report system error when virThreadCreateFull fails
util: Use a mutex when retrieving threadpool data
util: Add more getters to threadpool parameters
admin: Prepare admin protocol for future worker related procedures
admin: Introduce virAdmServerGethreadPoolParameters
admin: Introduce virAdmServerSetThreadPoolParameters
virt-admin: Introduce srv-workertune command
cfg.mk | 2 +-
daemon/admin.c | 88 +++++++++++++
daemon/admin_server.c | 110 +++++++++++++++++
daemon/admin_server.h | 11 ++
include/libvirt/libvirt-admin.h | 71 +++++++++++
include/libvirt/libvirt-common.h.in | 185 ++++++++++++++++++++++++++++
include/libvirt/libvirt-host.h | 186 ----------------------------
po/POTFILES.in | 4 +-
src/admin/admin_protocol.x | 54 +++++++-
src/admin/admin_remote.c | 77 ++++++++++++
src/admin_protocol-structs | 45 +++++++
src/libvirt-admin.c | 83 +++++++++++++
src/libvirt_admin_private.syms | 3 +
src/libvirt_admin_public.syms | 2 +
src/libvirt_private.syms | 4 +
src/rpc/virnetserver.c | 37 ++++++
src/rpc/virnetserver.h | 13 ++
src/util/virthreadpool.c | 238 +++++++++++++++++++++++++-----------
src/util/virthreadpool.h | 8 ++
tools/virt-admin.c | 132 ++++++++++++++++++++
20 files changed, 1096 insertions(+), 257 deletions(-)
--
2.4.11
8 years, 7 months
[libvirt] [PATCH] Add macro for handling exponential backoff loops.
by Richard W.M. Jones
In a few places in libvirt we busy-wait for events, for example qemu
creating a monitor socket. This is problematic because:
- We need to choose a sufficiently small polling period so that
libvirt doesn't add unnecessary delays.
- We need to choose a sufficiently large polling period so that
the effect of busy-waiting doesn't affect the system.
The solution to this conflict is to use an exponential backoff.
This patch adds a macro VIR_WHILE_EXPONENTIAL_BACKOFF to hide the
details, and modifies a few places where we currently busy-wait.
---
src/fdstream.c | 8 ++++----
src/libvirt_private.syms | 2 ++
src/qemu/qemu_agent.c | 8 ++++----
src/qemu/qemu_monitor.c | 8 ++++----
src/util/virtime.c | 42 ++++++++++++++++++++++++++++++++++++++++++
src/util/virtime.h | 39 +++++++++++++++++++++++++++++++++++++++
6 files changed, 95 insertions(+), 12 deletions(-)
diff --git a/src/fdstream.c b/src/fdstream.c
index a85cf9d..7a311f5 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -42,6 +42,7 @@
#include "virfile.h"
#include "configmake.h"
#include "virstring.h"
+#include "virtime.h"
#define VIR_FROM_THIS VIR_FROM_STREAMS
@@ -516,8 +517,7 @@ int virFDStreamConnectUNIX(virStreamPtr st,
bool abstract)
{
struct sockaddr_un sa;
- size_t i = 0;
- int timeout = 3;
+ virTimeBackOffVar timeout;
int ret;
int fd = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -537,7 +537,7 @@ int virFDStreamConnectUNIX(virStreamPtr st,
goto error;
}
- do {
+ VIR_WHILE_EXPONENTIAL_BACKOFF(timeout, 1, 3*1000 /* ms */) {
ret = connect(fd, (struct sockaddr *)&sa, sizeof(sa));
if (ret == 0)
break;
@@ -549,7 +549,7 @@ int virFDStreamConnectUNIX(virStreamPtr st,
}
goto error;
- } while ((++i <= timeout*5) && (usleep(.2 * 1000000) <= 0));
+ }
if (virFDStreamOpenInternal(st, fd, NULL, -1, 0) < 0)
goto error;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 068bc00..b69d2e0 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2360,6 +2360,8 @@ virThreadPoolSendJob;
# util/virtime.h
+virTimeBackOffCondition;
+virTimeBackOffInit;
virTimeFieldsNow;
virTimeFieldsNowRaw;
virTimeFieldsThen;
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index bee8d4c..adf38c5 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -42,6 +42,7 @@
#include "virtime.h"
#include "virobject.h"
#include "virstring.h"
+#include "virtime.h"
#include "base64.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -173,9 +174,8 @@ qemuAgentOpenUnix(const char *monitor, pid_t cpid, bool *inProgress)
{
struct sockaddr_un addr;
int monfd;
- int timeout = 3; /* In seconds */
+ virTimeBackOffVar timeout;
int ret;
- size_t i = 0;
*inProgress = false;
@@ -207,7 +207,7 @@ qemuAgentOpenUnix(const char *monitor, pid_t cpid, bool *inProgress)
goto error;
}
- do {
+ VIR_WHILE_EXPONENTIAL_BACKOFF(timeout, 1, 3*1000 /* ms */) {
ret = connect(monfd, (struct sockaddr *) &addr, sizeof(addr));
if (ret == 0)
@@ -232,7 +232,7 @@ qemuAgentOpenUnix(const char *monitor, pid_t cpid, bool *inProgress)
_("failed to connect to monitor socket"));
goto error;
- } while ((++i <= timeout*5) && (usleep(.2 * 1000000) <= 0));
+ }
if (ret != 0) {
virReportSystemError(errno, "%s",
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 10a6713..52f0d20 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -42,6 +42,7 @@
#include "virobject.h"
#include "virprobe.h"
#include "virstring.h"
+#include "virtime.h"
#ifdef WITH_DTRACE_PROBES
# include "libvirt_qemu_probes.h"
@@ -327,9 +328,8 @@ qemuMonitorOpenUnix(const char *monitor, pid_t cpid)
{
struct sockaddr_un addr;
int monfd;
- int timeout = 30; /* In seconds */
+ virTimeBackOffVar timeout;
int ret;
- size_t i = 0;
if ((monfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
virReportSystemError(errno,
@@ -345,7 +345,7 @@ qemuMonitorOpenUnix(const char *monitor, pid_t cpid)
goto error;
}
- do {
+ VIR_WHILE_EXPONENTIAL_BACKOFF(timeout, 1, 30*1000 /* ms */) {
ret = connect(monfd, (struct sockaddr *) &addr, sizeof(addr));
if (ret == 0)
@@ -362,7 +362,7 @@ qemuMonitorOpenUnix(const char *monitor, pid_t cpid)
_("failed to connect to monitor socket"));
goto error;
- } while ((++i <= timeout*5) && (usleep(.2 * 1000000) <= 0));
+ }
if (ret != 0) {
virReportSystemError(errno, "%s",
diff --git a/src/util/virtime.c b/src/util/virtime.c
index 9d365d5..78622e7 100644
--- a/src/util/virtime.c
+++ b/src/util/virtime.c
@@ -34,14 +34,18 @@
#include <config.h>
#include <stdio.h>
+#include <unistd.h>
#include <sys/time.h>
#include "virtime.h"
#include "viralloc.h"
#include "virerror.h"
+#include "virlog.h"
#define VIR_FROM_THIS VIR_FROM_NONE
+VIR_LOG_INIT("util.time");
+
/* We prefer clock_gettime if available because that is officially
* async signal safe according to POSIX. Many platforms lack it
* though, so fallback to gettimeofday everywhere else
@@ -363,3 +367,41 @@ virTimeLocalOffsetFromUTC(long *offset)
*offset = current - utc;
return 0;
}
+
+void
+virTimeBackOffInit(virTimeBackOffVar *var,
+ unsigned long long first, unsigned long long limit)
+{
+ ignore_value(virTimeMillisNowRaw(&var->start_t));
+ var->next = first;
+ var->limit = var->start_t + limit;
+}
+
+int
+virTimeBackOffCondition(virTimeBackOffVar *var)
+{
+ unsigned long long t, next;
+
+ ignore_value(virTimeMillisNowRaw(&t));
+
+ VIR_DEBUG("t=%llu, limit=%llu", t, var->limit);
+
+ if (t > var->limit)
+ return 0; /* ends the while loop */
+
+ next = var->next;
+ var->next *= 2;
+
+ /* If sleeping would take us beyond the limit, then shorten the
+ * sleep. This is so we always run the body just before the final
+ * timeout.
+ */
+ if (t + next > var->limit) {
+ next = var->limit - t - 2;
+ }
+
+ VIR_DEBUG("sleeping for %llu ms", next);
+
+ usleep(next * 1000);
+ return 1;
+}
diff --git a/src/util/virtime.h b/src/util/virtime.h
index 8ebad38..723a93a 100644
--- a/src/util/virtime.h
+++ b/src/util/virtime.h
@@ -64,4 +64,43 @@ char *virTimeStringThen(unsigned long long when);
int virTimeLocalOffsetFromUTC(long *offset)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+/**
+ * VIR_WHILE_EXPONENTIAL_BACKOFF:
+ * @var: A scratch variable used by the loop (with type virTimeBackOffVar).
+ * @first: First time period to wait, in milliseconds.
+ * @limit: Total time we run before the loop times out, in milliseconds.
+ *
+ * This macro is a while loop that runs the body of the code
+ * repeatedly, with an exponential backoff. It first waits for @first
+ * ms, then runs the body, then waits for 2*@first ms, then runs the
+ * body again. Then 4*@first ms, and so on.
+ *
+ * When @limit ms (total running time) is reached, the while loop
+ * ends.
+ *
+ * The body should use "break" or "goto" when whatever condition it is
+ * testing for succeeds (or there is an unrecoverable error).
+ *
+ * NOTE: VIR_WHILE_EXPONENTIAL_BACKOFF is not a single atomic C
+ * statement (unfortunately), so you will get incorrect code if you
+ * write something like:
+ *
+ * if (foo)
+ * VIR_WHILE_EXPONENTIAL_BACKOFF(...) {
+ * }
+ */
+#define VIR_WHILE_EXPONENTIAL_BACKOFF(var, first, limit) \
+ virTimeBackOffInit(&(var), (first), (limit)); \
+ while (virTimeBackOffCondition(&(var)))
+
+typedef struct {
+ unsigned long long start_t;
+ unsigned long long next;
+ unsigned long long limit;
+} virTimeBackOffVar;
+
+void virTimeBackOffInit(virTimeBackOffVar *var,
+ unsigned long long first, unsigned long long limit);
+int virTimeBackOffCondition(virTimeBackOffVar *var);
+
#endif
--
2.7.4
8 years, 7 months
[libvirt] [PATCH] qemu: support virt-2.6 machine type on arm
by Ján Tomko
Some places already check for "virt-" prefix as well as plain "virt".
virQEMUCapsHasPCIMultiBus did not, resulting in multiple PCI devices
having assigned the same unnumbered "pci" alias.
Add a test for the "virt-2.6" machine type which also omits the
<model type='virtio'/> in <interface>, to check if
qemuDomainDefaultNetModel works too.
https://bugzilla.redhat.com/show_bug.cgi?id=1325085
---
src/qemu/qemu_capabilities.c | 3 +-
src/qemu/qemu_domain.c | 3 +-
...l2argv-aarch64-virt-2.6-virtio-pci-default.args | 37 +++++++++++++++++
...ml2argv-aarch64-virt-2.6-virtio-pci-default.xml | 47 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 6 +++
5 files changed, 94 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 5d09dc8..b73c296 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2174,7 +2174,8 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
/* If 'virt' supports PCI, it supports multibus.
* No extra conditions here for simplicity.
*/
- if (STREQ(def->os.machine, "virt"))
+ if (STREQ(def->os.machine, "virt") ||
+ STRPREFIX(def->os.machine, "virt-"))
return true;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 55dcba8..30dee4d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1730,7 +1730,8 @@ qemuDomainDefaultNetModel(const virDomainDef *def,
if (STREQ(def->os.machine, "versatilepb"))
return "smc91c111";
- if (STREQ(def->os.machine, "virt"))
+ if (STREQ(def->os.machine, "virt") ||
+ STRPREFIX(def->os.machine, "virt-"))
return "virtio";
/* Incomplete. vexpress (and a few others) use this, but not all
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args
new file mode 100644
index 0000000..93c181d
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args
@@ -0,0 +1,37 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 \
+-name aarch64test \
+-S \
+-M virt-2.6 \
+-cpu cortex-a53 \
+-m 1024 \
+-smp 1 \
+-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
+-boot c \
+-kernel /aarch64.kernel \
+-initrd /aarch64.initrd \
+-append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \
+-dtb /aarch64.dtb \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
+-device virtio-serial-device,id=virtio-serial0 \
+-usb \
+-drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \
+-device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \
+-net user,vlan=0,name=hostnet0 \
+-serial pty \
+-chardev pty,id=charconsole1 \
+-device virtconsole,chardev=charconsole1,id=console1 \
+-device virtio-balloon-device,id=balloon0 \
+-object rng-random,id=objrng0,filename=/dev/random \
+-device virtio-rng-device,rng=objrng0,id=rng0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml
new file mode 100644
index 0000000..e745101
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml
@@ -0,0 +1,47 @@
+<domain type="qemu">
+ <name>aarch64test</name>
+ <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch="aarch64" machine="virt-2.6">hvm</type>
+ <kernel>/aarch64.kernel</kernel>
+ <initrd>/aarch64.initrd</initrd>
+ <dtb>/aarch64.dtb</dtb>
+ <cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <cpu match='exact'>
+ <model>cortex-a53</model>
+ </cpu>
+ <clock offset="utc"/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <disk type='file' device='disk'>
+ <source file='/aarch64.raw'/>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:37'/>
+ </interface>
+ <console type='pty'/>
+ <console type='pty'>
+ <target type='virtio' port='0'/>
+ </console>
+ <memballoon model='virtio'/>
+ <!--
+ This actually doesn't work in practice because vexpress only has
+ 4 virtio slots available, rng makes 5 -->
+ <rng model='virtio'>
+ <backend model='random'>/dev/random</backend>
+ </rng>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 5f492cb..df42d9c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1661,6 +1661,12 @@ mymain(void)
QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE);
+ DO_TEST("aarch64-virt-2.6-virtio-pci-default",
+ QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
+ QEMU_CAPS_DEVICE_VIRTIO_MMIO,
+ QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
+ QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE);
/* Example of using virtio-pci with no explicit PCI controller
but with manual PCI addresses */
DO_TEST("aarch64-virtio-pci-manual-addresses",
--
2.7.3
8 years, 7 months
[libvirt] [PATCH v2] util: move ENODATA redefine to internal.h
by Roman Bogorodskiy
FreeBSD lacks ENODATA, and viruuid.c redefines it to EIO, but it's not
actually using it. On the other hand, we have virrandom.c that's using
ENODATA. So make this re-definition common by moving it to internal.h,
so all the current and possible future users don't need to care about
that.
---
src/internal.h | 4 ++++
src/util/viruuid.c | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/internal.h b/src/internal.h
index db26fb0..9ebaf3c 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -517,4 +517,8 @@ enum {
EXIT_ENOENT = 127, /* Could not find program to exec */
};
+# ifndef ENODATA
+# define ENODATA EIO
+# endif
+
#endif /* __VIR_INTERNAL_H__ */
diff --git a/src/util/viruuid.c b/src/util/viruuid.c
index 1fcc954..16e57db 100644
--- a/src/util/viruuid.c
+++ b/src/util/viruuid.c
@@ -46,10 +46,6 @@
VIR_LOG_INIT("util.uuid");
-#ifndef ENODATA
-# define ENODATA EIO
-#endif
-
static unsigned char host_uuid[VIR_UUID_BUFLEN];
static int
--
2.7.4
8 years, 7 months
[libvirt] [PATCH v5 0/5] migration: add multithread compression
by Nikolay Shirokovskiy
Add means to turn multithread compression on during migration.
Add means to pass compression parameters in migration command.
WARNING!
This should be pushed only after
https://www.redhat.com/archives/libvir-list/2016-March/msg01506.html
or virsh domain will break.
Changes from v4
===============
1. Clean up documentation and comments.
2. Stop keeping compression options in flags internally. Move
flags data into generic compression structure.
3. Use existing libvirt enum infrastructure to deal with
compression methods. This makes parse and dump function less
painful.
4. Use booleans for 'set' flags instead of bitsets.
5. Othes minor changes on Jiri comments.
Eli Qiao (1):
qemumonitorjsontest: add test for getting multithread compress params
Nikolay Shirokovskiy (2):
migration: qemu: add option to select compression methods
qemu: migration: support setting compession parameters
ShaoHe Feng (2):
qemu: monitor: add migration parameters accessors
virsh: add compression options for migration
include/libvirt/libvirt-domain.h | 42 +++++++
src/qemu/qemu_driver.c | 40 +++++-
src/qemu/qemu_migration.c | 262 +++++++++++++++++++++++++++++++++++----
src/qemu/qemu_migration.h | 36 ++++++
src/qemu/qemu_monitor.c | 24 +++-
src/qemu/qemu_monitor.h | 18 +++
src/qemu/qemu_monitor_json.c | 110 ++++++++++++++++
src/qemu/qemu_monitor_json.h | 5 +
tests/qemumonitorjsontest.c | 61 +++++++++
tools/virsh-domain.c | 76 ++++++++++++
tools/virsh.pod | 18 ++-
11 files changed, 656 insertions(+), 36 deletions(-)
--
1.8.3.1
8 years, 7 months
[libvirt] [PATCH v2] add func to set shared drivers after libvirtd init
by Mikhail Feoktistov
Diff from v1:
Remove vz prefix from the title of this letter. Because this is the common case
for all drivers in libvirt.
Description:
Built-in drivers in libvirt are initialized before libvirtd initialization.
Libvirt loads shared drivers on libvirtd initialization step.
For built-in drivers we can't set shared drivers, because they are not initialized yet.
This patch adds function to set shared drivers after libvirtd init.
---
daemon/libvirtd.c | 4 ++++
src/libvirt.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/libvirt_internal.h | 1 +
src/libvirt_private.syms | 1 +
4 files changed, 47 insertions(+)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 250094b..aac1826 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -431,6 +431,10 @@ static void daemonInitialize(void)
bhyveRegister();
# endif
#endif
+# ifdef WITH_VZ
+ virAssignSharedDrivers("vz");
+ virAssignSharedDrivers("Parallels");
+# endif
}
diff --git a/src/libvirt.c b/src/libvirt.c
index 25a0040..1763be7 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1433,3 +1433,44 @@ virTypedParameterValidateSet(virConnectPtr conn,
}
return 0;
}
+
+/**
+ * virAssignSharedDrivers:
+ * @name: name of connection driver
+ *
+ * This function fills in any empty pointers for shared drivers
+ * in connect driver structure
+ *
+ * Returns 0 in case of success, -1 in case of error
+*/
+int
+virAssignSharedDrivers(const char *name)
+{
+ size_t i;
+
+ if (name == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Driver name must be specified"));
+ return -1;
+ }
+
+ for (i = 0; i < virConnectDriverTabCount; i++) {
+ if (STREQ(virConnectDriverTab[i]->hypervisorDriver->name, name)) {
+ if (virConnectDriverTab[i]->interfaceDriver == NULL)
+ virConnectDriverTab[i]->interfaceDriver = virSharedInterfaceDriver;
+ if (virConnectDriverTab[i]->networkDriver == NULL)
+ virConnectDriverTab[i]->networkDriver = virSharedNetworkDriver;
+ if (virConnectDriverTab[i]->nodeDeviceDriver == NULL)
+ virConnectDriverTab[i]->nodeDeviceDriver = virSharedNodeDeviceDriver;
+ if (virConnectDriverTab[i]->nwfilterDriver == NULL)
+ virConnectDriverTab[i]->nwfilterDriver = virSharedNWFilterDriver;
+ if (virConnectDriverTab[i]->secretDriver == NULL)
+ virConnectDriverTab[i]->secretDriver = virSharedSecretDriver;
+ if (virConnectDriverTab[i]->storageDriver == NULL)
+ virConnectDriverTab[i]->storageDriver = virSharedStorageDriver;
+ break;
+ }
+ }
+
+ return 0;
+}
diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h
index 1313b58..2a7227b 100644
--- a/src/libvirt_internal.h
+++ b/src/libvirt_internal.h
@@ -289,4 +289,5 @@ virTypedParameterValidateSet(virConnectPtr conn,
virTypedParameterPtr params,
int nparams);
+int virAssignSharedDrivers(const char *name);
#endif
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a835f18..a0fcdf5 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -943,6 +943,7 @@ virFDStreamSetInternalCloseCb;
# libvirt_internal.h
+virAssignSharedDrivers;
virConnectSupportsFeature;
virDomainMigrateBegin3;
virDomainMigrateBegin3Params;
--
1.8.3.1
8 years, 7 months
[libvirt] Unsupported network type ethernet
by sonia verma
Hi Team
I need to launch LXC VM using ethernet network type using libvirt.While
trying the same, I'm getting below errors ..
*error: internal error: Unsupported network type ethernet*
Is there any patch available to add ethernet support to Libvirt with LXC VM
?
Please let me know regarding this.
Thanks
Sonia Verma
8 years, 7 months