[libvirt] [PATCH] Include param.h in case of HAVE_BSD_CPU_AFFINITY
by Guido Günther
This fixes compilation on kFreeBSD which otherwise fails like
CC util/libvirt_util_la-virprocess.lo
In file included from /usr/include/sys/cpuset.h:35:0,
from util/virprocess.c:43:
/usr/include/sys/_cpuset.h:49:43: error: 'NBBY' undeclared here (not in
a function)
long __bits[howmany(CPU_SETSIZE, _NCPUBITS)];
^
In file included from util/virprocess.c:43:0:
/usr/include/sys/cpuset.h:215:12: error: unknown type name 'cpusetid_t'
int cpuset(cpusetid_t *);
^
/usr/include/sys/cpuset.h:216:30: error: expected ')' before 'id_t'
int cpuset_setid(cpuwhich_t, id_t, cpusetid_t);
^
/usr/include/sys/cpuset.h:217:42: error: expected ')' before 'id_t'
int cpuset_getid(cpulevel_t, cpuwhich_t, id_t, cpusetid_t *);
^
/usr/include/sys/cpuset.h:218:48: error: expected ')' before 'id_t'
int cpuset_getaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t
*);
^
/usr/include/sys/cpuset.h:219:48: error: expected ')' before 'id_t'
int cpuset_setaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, const
cpuset_t *);
And it's the correct usage as documented in
http://www.freebsd.org/cgi/man.cgi?query=cpuset_setid
---
src/util/virprocess.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 9179d73..4d6c50d 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -40,6 +40,7 @@
#endif
#ifdef HAVE_BSD_CPU_AFFINITY
+# include <sys/param.h>
# include <sys/cpuset.h>
#endif
--
2.0.1
10 years, 3 months
[libvirt] [PATCH 01/24] src/xenxs: Refactor code parsing memory config
by Kiarie Kahurani
introduce function
xenParseXMMem(virConfPtr conf,.........);
which parses memory config instead
signed-off-by: Kiarie Kahurani <davidkiarie4(a)gmail.com>
Signed-off-by: Kiarie Kahurani <davidkiarie4(a)gmail.com>
---
src/xenxs/xen_xm.c | 83 +++++++++++++++++++++++++++++-------------------------
1 file changed, 45 insertions(+), 38 deletions(-)
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 4461654..443e6da 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -40,11 +40,9 @@
#include "virstoragefile.h"
#include "virstring.h"
-/* Convenience method to grab a long int from the config file object */
-static int xenXMConfigGetBool(virConfPtr conf,
- const char *name,
- int *value,
- int def)
+/* Convenience method to grab a int from the config file object */
+static int
+xenXMConfigGetBool(virConfPtr conf, const char *name, int *value, int def)
{
virConfValuePtr val;
@@ -67,11 +65,10 @@ static int xenXMConfigGetBool(virConfPtr conf,
}
-/* Convenience method to grab a int from the config file object */
-static int xenXMConfigGetULong(virConfPtr conf,
- const char *name,
- unsigned long *value,
- unsigned long def)
+/* Convenience method to grab a long int from the config file object */
+static int
+xenXMConfigGetULong(virConfPtr conf, const char *name, unsigned long *value,
+ unsigned long def)
{
virConfValuePtr val;
@@ -99,10 +96,9 @@ static int xenXMConfigGetULong(virConfPtr conf,
/* Convenience method to grab a int from the config file object */
-static int xenXMConfigGetULongLong(virConfPtr conf,
- const char *name,
- unsigned long long *value,
- unsigned long long def)
+static int
+xenXMConfigGetULongLong(virConfPtr conf, const char *name,
+ unsigned long long *value, unsigned long long def)
{
virConfValuePtr val;
@@ -130,10 +126,9 @@ static int xenXMConfigGetULongLong(virConfPtr conf,
/* Convenience method to grab a string from the config file object */
-static int xenXMConfigGetString(virConfPtr conf,
- const char *name,
- const char **value,
- const char *def)
+static int
+xenXMConfigGetString(virConfPtr conf, const char *name, const char **value,
+ const char *def)
{
virConfValuePtr val;
@@ -155,10 +150,10 @@ static int xenXMConfigGetString(virConfPtr conf,
return 0;
}
-static int xenXMConfigCopyStringInternal(virConfPtr conf,
- const char *name,
- char **value,
- int allowMissing)
+
+static int
+xenXMConfigCopyStringInternal(virConfPtr conf, const char *name, char **value,
+ int allowMissing)
{
virConfValuePtr val;
@@ -188,15 +183,16 @@ static int xenXMConfigCopyStringInternal(virConfPtr conf,
}
-static int xenXMConfigCopyString(virConfPtr conf,
- const char *name,
- char **value) {
+static int
+xenXMConfigCopyString(virConfPtr conf, const char *name, char **value)
+{
return xenXMConfigCopyStringInternal(conf, name, value, 0);
}
-static int xenXMConfigCopyStringOpt(virConfPtr conf,
- const char *name,
- char **value) {
+
+static int
+xenXMConfigCopyStringOpt(virConfPtr conf, const char *name, char **value)
+{
return xenXMConfigCopyStringInternal(conf, name, value, 1);
}
@@ -244,6 +240,25 @@ xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char *uuid)
return 0;
}
+
+static int
+xenParseXMMem(virConfPtr conf, virDomainDefPtr def)
+{
+ if (xenXMConfigGetULongLong(conf, "memory", &def->mem.cur_balloon,
+ MIN_XEN_GUEST_SIZE * 2) < 0)
+ return -1;
+
+ if (xenXMConfigGetULongLong(conf, "maxmem", &def->mem.max_balloon,
+ def->mem.cur_balloon) < 0)
+ return -1;
+
+ def->mem.cur_balloon *= 1024;
+ def->mem.max_balloon *= 1024;
+
+ return 0;
+}
+
+
#define MAX_VFB 1024
/*
* Turn a config record into a lump of XML describing the
@@ -251,7 +266,7 @@ xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char *uuid)
*/
virDomainDefPtr
xenParseXM(virConfPtr conf, int xendConfigVersion,
- virCapsPtr caps)
+ virCapsPtr caps)
{
const char *str;
int hvm = 0;
@@ -360,17 +375,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
}
}
- if (xenXMConfigGetULongLong(conf, "memory", &def->mem.cur_balloon,
- MIN_XEN_GUEST_SIZE * 2) < 0)
- goto cleanup;
-
- if (xenXMConfigGetULongLong(conf, "maxmem", &def->mem.max_balloon,
- def->mem.cur_balloon) < 0)
+ if (xenParseXMMem(conf, def) < 0)
goto cleanup;
- def->mem.cur_balloon *= 1024;
- def->mem.max_balloon *= 1024;
-
if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
MAX_VIRT_CPUS < count)
goto cleanup;
--
1.8.4.5
10 years, 3 months
[libvirt] [PATCH v2 0/2] Add machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm
by Alex Bligh
This patch series adds inbound migrate capability from qemu-kvm version
1.0. The main ideas are those set out in Cole Robinson's patch here:
http://pkgs.fedoraproject.org/cgit/qemu.git/tree/0001-Fix-migration-from-...
however, rather than patching statically (and breaking inbound
migration on existing machine types), I have added a new machine
type (pc-1.0-qemu-kvm) without affecting any other machine types.
The existing pc-1.0 machine type is renamed to pc-1.0-qemu-git,
with pc-1.0 becoming an alias for one or another, as selected
by a configure option (defaulting to pc-1.0-qemu-git, IE no
change).
This requires 'hot patching' the VMStateDescription in a couple of
places, which in turn is less than obvious as there may be (indeed
are for i8259) derived classes. Whilst pretty nausea-inducing, this
approach has the benefit of being entirely self-contained.
I developed this on qemu 2.0 but have forward ported it (trivially)
to master. My testing has been on a VM live-migrated-to-file from
Ubuntu Precise qemu-kvm 1.0.
I have given this a moderate degree of testing but it could do
with more.
Note that certain hardware devices (including QXL) will not
migrate properly due to a fundamental difference in their internal
state between versions.
Also note that (as expected) migratino from qemu-2.x to qemu-1.0
will not work, even if the machine types are the same.
Alex Bligh (2):
Add machine type pc-1.0-qemu-kvm for live migrate compatibility with
qemu-kvm
Add configure option --enable-pc-1-0-qemu-kvm
configure | 12 ++++++++++++
hw/acpi/piix4.c | 49 ++++++++++++++++++++++++++++++++++++++++++++--
hw/i386/pc_piix.c | 39 +++++++++++++++++++++++++++++++++++-
hw/timer/i8254_common.c | 41 ++++++++++++++++++++++++++++++++++++++
include/hw/acpi/piix4.h | 1 +
include/hw/timer/i8254.h | 2 ++
6 files changed, 141 insertions(+), 3 deletions(-)
--
1.7.9.5
10 years, 3 months
[libvirt] [libvirt-glib] [PATCH v2 1/4] GVirDomainSnapshot: Add _get_is_current
by Timm Bäder
Add a way to determine if the given GVirDomainSnapshot is the current
snapshot of its GVirDomain.
---
libvirt-gobject/libvirt-gobject-domain-snapshot.c | 33 +++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain-snapshot.h | 4 +++
libvirt-gobject/libvirt-gobject.sym | 1 +
3 files changed, 38 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
index 7bb89f1..c53e877 100644
--- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
+++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
@@ -235,3 +235,36 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot,
}
return TRUE;
}
+
+
+/**
+ * gvir_domain_snapshot_get_is_current:
+ * @snapshot: The domain snapshot
+ * @flags: Currently unused, pass 0
+ * @is_current: (out): %TRUE if the given snapshot is the current snapshot
+ * of its domain, %FALSE otherwise.
+ * @error: (allow-none): Place-holder for error or %NULL
+ *
+ * Returns: %TRUE on success, %FALSE otherwise.
+ */
+gboolean gvir_domain_snapshot_get_is_current(GVirDomainSnapshot *snapshot,
+ guint flags,
+ gboolean *is_current,
+ GError **error) {
+ gint status;
+
+ g_return_val_if_fail(GVIR_IS_DOMAIN_SNAPSHOT(snapshot), FALSE);
+ g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
+
+ status = virDomainSnapshotIsCurrent(snapshot->priv->handle, flags);
+ if (status == -1) {
+ gvir_set_error(error, GVIR_DOMAIN_SNAPSHOT_ERROR, 0,
+ "Could not determine if `%s' is the current snapshot",
+ gvir_domain_snapshot_get_name(snapshot));
+ return FALSE;
+ }
+
+ *is_current = status;
+
+ return TRUE;
+}
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.h b/libvirt-gobject/libvirt-gobject-domain-snapshot.h
index b3ebe7f..0a0bb96 100644
--- a/libvirt-gobject/libvirt-gobject-domain-snapshot.h
+++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.h
@@ -85,6 +85,10 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot,
guint flags,
GError **error);
+gboolean gvir_domain_snapshot_get_is_current(GVirDomainSnapshot *snapshot,
+ guint flags,
+ gboolean *is_current,
+ GError **error);
G_END_DECLS
#endif /* __LIBVIRT_GOBJECT_DOMAIN_SNAPSHOT_H__ */
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index b0c55b5..c740f88 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -242,6 +242,7 @@ LIBVIRT_GOBJECT_0.1.9 {
gvir_domain_get_snapshots;
gvir_domain_snapshot_delete;
gvir_domain_snapshot_delete_flags_get_type;
+ gvir_domain_snapshot_get_is_current;
gvir_domain_snapshot_list_flags_get_type;
gvir_storage_pool_state_get_type;
gvir_storage_vol_resize_flags_get_type;
--
2.0.4
10 years, 3 months
[libvirt] [PATCHv3] conf: Add USB sound card support and implement it for qemu
by Peter Krempa
---
Notes:
Version 3:
- rebased after recent additions
Version 2:
- added docs
docs/formatdomain.html.in | 5 +++--
src/conf/domain_conf.c | 3 ++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 14 ++++++++++++--
tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 +
tests/qemuhelptest.c | 9 ++++++---
13 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index e5b1adb..409a76e 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4981,9 +4981,10 @@ qemu-kvm -net nic,model=? /dev/null
The <code>sound</code> element has one mandatory attribute,
<code>model</code>, which specifies what real sound device is emulated.
Valid values are specific to the underlying hypervisor, though typical
- choices are 'es1370', 'sb16', 'ac97', and 'ich6'
+ choices are 'es1370', 'sb16', 'ac97', 'ich6' and 'usb'.
(<span class="since">
- 'ac97' only since 0.6.0, 'ich6' only since 0.8.8</span>)
+ 'ac97' only since 0.6.0, 'ich6' only since 0.8.8,
+ 'usb' only since 1.2.7</span>)
</dd>
</dl>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c25c74b..e4c6218 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -458,7 +458,8 @@ VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MODEL_LAST,
"pcspk",
"ac97",
"ich6",
- "ich9")
+ "ich9",
+ "usb")
VIR_ENUM_IMPL(virDomainMemballoonModel, VIR_DOMAIN_MEMBALLOON_MODEL_LAST,
"virtio",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index bffc0a5..ff7d640 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1177,6 +1177,7 @@ typedef enum {
VIR_DOMAIN_SOUND_MODEL_AC97,
VIR_DOMAIN_SOUND_MODEL_ICH6,
VIR_DOMAIN_SOUND_MODEL_ICH9,
+ VIR_DOMAIN_SOUND_MODEL_USB,
VIR_DOMAIN_SOUND_MODEL_LAST
} virDomainSoundModel;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f69c4d0..360cc67 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -264,6 +264,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"memory-backend-ram", /* 170 */
"numa",
"memory-backend-file",
+ "usb-audio",
);
@@ -1483,6 +1484,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "usb-kbd", QEMU_CAPS_DEVICE_USB_KBD },
{ "memory-backend-ram", QEMU_CAPS_OBJECT_MEMORY_RAM },
{ "memory-backend-file", QEMU_CAPS_OBJECT_MEMORY_FILE },
+ { "usb-audio", QEMU_CAPS_OBJECT_USB_AUDIO },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index e80a377..6342f81 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -212,6 +212,7 @@ typedef enum {
QEMU_CAPS_OBJECT_MEMORY_RAM = 170, /* -object memory-backend-ram */
QEMU_CAPS_NUMA = 171, /* newer -numa handling with disjoint cpu ranges */
QEMU_CAPS_OBJECT_MEMORY_FILE = 172, /* -object memory-backend-file */
+ QEMU_CAPS_OBJECT_USB_AUDIO = 173, /* usb-audio device support */
QEMU_CAPS_LAST, /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4e074e5..eb3f392 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2090,9 +2090,10 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
for (i = 0; i < def->nsounds; i++) {
if (def->sounds[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
continue;
- /* Skip ISA sound card, and PCSPK */
+ /* Skip ISA sound card, PCSPK and usb-audio */
if (def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_SB16 ||
- def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_PCSPK)
+ def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_PCSPK ||
+ def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_USB)
continue;
if (virDomainPCIAddressReserveNextSlot(addrs, &def->sounds[i]->info,
@@ -4687,6 +4688,15 @@ qemuBuildSoundDevStr(virDomainDefPtr def,
case VIR_DOMAIN_SOUND_MODEL_ICH6:
model = "intel-hda";
break;
+ case VIR_DOMAIN_SOUND_MODEL_USB:
+ model = "usb-audio";
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_USB_AUDIO)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("usb-audio controller is not supported "
+ "by this QEMU binary"));
+ goto error;
+ }
+ break;
case VIR_DOMAIN_SOUND_MODEL_ICH9:
model = "ich9-intel-hda";
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ICH9_INTEL_HDA)) {
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
index ebbfb82..c8a379a 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
@@ -115,4 +115,5 @@
<flag name='enable-fips'/>
<flag name='usb-kbd'/>
<flag name='host-pci-multidomain'/>
+ <flag name='usb-audio'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
index ab631a2..4b7651e 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
@@ -128,4 +128,5 @@
<flag name='kvm-pit-lost-tick-policy'/>
<flag name='usb-kbd'/>
<flag name='host-pci-multidomain'/>
+ <flag name='usb-audio'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
index e710b60..d146bf9 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
@@ -129,4 +129,5 @@
<flag name='kvm-pit-lost-tick-policy'/>
<flag name='usb-kbd'/>
<flag name='host-pci-multidomain'/>
+ <flag name='usb-audio'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
index 36758c8..5fa30aa 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
@@ -137,4 +137,5 @@
<flag name='spiceport'/>
<flag name='usb-kbd'/>
<flag name='host-pci-multidomain'/>
+ <flag name='usb-audio'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
index ca2c236..f364bbf 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
@@ -144,4 +144,5 @@
<flag name='usb-kbd'/>
<flag name='host-pci-multidomain'/>
<flag name='msg-timestamp'/>
+ <flag name='usb-audio'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
index 4b9f693..10ce1b5 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
@@ -143,4 +143,5 @@
<flag name='host-pci-multidomain'/>
<flag name='msg-timestamp'/>
<flag name='numa'/>
+ <flag name='usb-audio'/>
</qemuCaps>
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 105a563..366e36d 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -842,7 +842,8 @@ mymain(void)
QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX,
QEMU_CAPS_VNC_SHARE_POLICY,
QEMU_CAPS_DEVICE_USB_KBD,
- QEMU_CAPS_DEVICE_USB_STORAGE);
+ QEMU_CAPS_DEVICE_USB_STORAGE,
+ QEMU_CAPS_OBJECT_USB_AUDIO);
DO_TEST("qemu-1.2.0", 1002000, 0, 0,
QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
@@ -951,7 +952,8 @@ mymain(void)
QEMU_CAPS_VNC_SHARE_POLICY,
QEMU_CAPS_DEVICE_USB_STORAGE,
QEMU_CAPS_DEVICE_USB_KBD,
- QEMU_CAPS_USB_STORAGE_REMOVABLE);
+ QEMU_CAPS_USB_STORAGE_REMOVABLE,
+ QEMU_CAPS_OBJECT_USB_AUDIO);
DO_TEST("qemu-kvm-1.2.0", 1002000, 1, 0,
QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
@@ -1065,7 +1067,8 @@ mymain(void)
QEMU_CAPS_VNC_SHARE_POLICY,
QEMU_CAPS_DEVICE_USB_STORAGE,
QEMU_CAPS_DEVICE_USB_KBD,
- QEMU_CAPS_USB_STORAGE_REMOVABLE);
+ QEMU_CAPS_USB_STORAGE_REMOVABLE,
+ QEMU_CAPS_OBJECT_USB_AUDIO);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
2.0.2
10 years, 3 months
[libvirt] [BUG] Two different connections to the same host through different transport
by Емил Гелев
Hi. I am using libvirt for some time and I have found the following problem.
When I try opening two connections with the same credentials to the same
host but using different transport(TCP and TLS) I get the following error
when trying to free the TLS one:
"*** Error in `./test': double free or corruption (!prev):
0x00000000014a7a60 ***
Aborted (core dumped)"
Example code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libvirt/libvirt.h>
struct CredentialsPack {
const char* username;
const char* password;
};
struct CredentialsPack* newCredentialsPack(const char* username,
const char* password) {
struct CredentialsPack* ptr = malloc(sizeof(struct CredentialsPack));
ptr->username = username;
ptr->password = password;
return ptr;
}
static int authCredTypes[] = { VIR_CRED_AUTHNAME, VIR_CRED_PASSPHRASE, };
static int authCb(virConnectCredentialPtr cred, unsigned int ncred,
void* cbdata) {
struct CredentialsPack* inputCreds = (struct CredentialsPack*) cbdata;
int i;
for (i = 0; i < ncred; ++i) {
if (cred[i].type == VIR_CRED_AUTHNAME) {
cred[i].result = strdup(inputCreds->username);
if (cred[i].result == NULL) {
return -1;
}
cred[i].resultlen = strlen(cred[i].result);
} else if (cred[i].type == VIR_CRED_PASSPHRASE) {
cred[i].result = strdup(inputCreds->password);
if (cred[i].result == NULL) {
return -1;
}
cred[i].resultlen = strlen(cred[i].result);
}
}
return 0;
}
int main(){
struct CredentialsPack* credentials = newCredentialsPack("user",
"pass");
virConnectAuth auth;
auth.credtype = authCredTypes;
auth.ncredtype = sizeof(authCredTypes) / sizeof(int);
auth.cb = authCb;
auth.cbdata = credentials;
virConnectPtr conn;
conn = virConnectOpenAuth("qemu+tcp://host1/system", &auth, 0);
struct CredentialsPack* credentials2 = newCredentialsPack("user",
"pass");
virConnectAuth auth2;
auth2.credtype = authCredTypes;
auth2.ncredtype = sizeof(authCredTypes) / sizeof(int);
auth2.cb = authCb;
auth2.cbdata = credentials2;
virConnectPtr conn2;
conn2 = virConnectOpenAuth("qemu://host1/system", &auth2, 0);
// virConnectClose(conn); // this does not change the behaviour
virConnectClose(conn2); // here the error occurs
}
If I try to close "conn" then everything works until I try to close
"conn2". I can even invoke virConnectListAllDomains using "conn2" and use
the domain pointers when "conn" is closed. The problem is when I try to
close "conn2".
The platform running this code is Ubuntu 14.04. The version of libvirt is
1.2.2 (default configuration). The certificate of the CA which signed the
server certificate is under /etc/pki/CA/cacert.pem
The target machine is RHEL 6.5. The version of libvirt is 0.10.2. It is
configured this way:
listen_tls = 1
listen_tcp = 1
auth_tcp = sasl
auth_tls = sasl
tls_no_verify_certificate = 1
Everything else is set to default.
The certificate of the CA which signed the server certificate is under
/etc/pki/CA/cacert.pem
The user "user" is added to the DB( using $ saslpasswd2 -a libvirt user). I
can successfully execute the following on the command line using the
"user"/"pass" credentials:
virsh -c qemu://host1/system list
virsh -c qemu+tcp://host1/system list
I hope this will be useful.
Thank you.
10 years, 3 months
[libvirt] virsh migrate: sometimes command line cannot exit until manually press "ENTER" key
by Chun Yan Liu
Hi, List,
Do you meet the same problem? Host is kvm, doing: (e.g.)
#virsh migrate sles11 qemu+ssh://147.2.207.55/system --live --unsafe
password:
Sometimes, VM is already running on the target host and disappears
from source host, but the command line still hangs there, if pressing
"ENTER", it will exit.
I debugged the code, but found the result is weird. The code hangs at
tools/virsh-domain.c -> cmdMigrate ->vshWatchJob->poll():
poll() is trying to select pipe_fd, which is used to receive message from
doMigrate thread. In debugging, found that doMigrate finishes and at
the end it does call safewrite() to write the retval ('0' or '1') to pipe_fd,
and the write is completed. But cmdMigrate poll() cannot get the event.
Then after pressing "ENTER" key, poll() can get the event and select
pipe_fd, then command line can exit.
Any ideas about the possible reason?
Thanks,
Chunyan
10 years, 3 months
[libvirt] [PATCH 0/2] active commit fixes
by Eric Blake
In response to the valgrind trace I posted to the list last night.
Valgrind is awesome :) I had a very hard time reproducing the race
when run under gdb or at normal speeds, but valgrind was slow enough
that I was hitting it more frequently, as well as getting information
about the bug and where to go to fix it.
Eric Blake (2):
blockjob: avoid memory leak during block pivot
blockjob: fix use-after-free in blockcopy
src/qemu/qemu_driver.c | 40 +++++++++++++++++++++++++---------------
src/util/virstoragefile.c | 1 +
2 files changed, 26 insertions(+), 15 deletions(-)
--
1.9.3
10 years, 3 months
Re: [libvirt] [PATCH] audit: Fix some comments
by Wang Rui
On 2014/8/7 17:07, Ján Tomko wrote:
> On 08/07/2014 10:12 AM, Wang Rui wrote:
>> Fix a comment in virDomainAuditNetDevice.
>> Fix a typo in comment of qemuPhysIfaceConnect which is
>> the caller of virDomainAuditNetDevice.
>>
>> Signed-off-by: Wang Rui <moon.wangrui(a)huawei.com>
>> ---
>> src/conf/domain_audit.c | 4 ++--
>> src/qemu/qemu_command.c | 2 +-
>> 2 files changed, 3 insertions(+), 3 deletions(-)
>>
>
> ACK and pushed.
Thanks.
I have a question about comment style.
I see there are two comment styles in our libvirt code.
One is
/* XXXX
* XXXX
*/
The other is
/* XXXX
* XXXX */
Are both of them fine ?
Or which one is recommended ?
(I'm not sure about my comments when coding.)
10 years, 3 months