[libvirt] Clock problems with Windows guests and Xen
by Matthew Donovan
When I start Windows guests with libvirt my clocks are 5 hours off. When I
use a Xen configuration file, I can specify an offset (rtc_timeoffset =
-18000) to get my clock to sync with the host. Is there a way to do specify
this offset in XML with libvirt?
Right now, I'm using version 0.4.4 but I downloaded the source for 0.5.1 and
it looks like that part of domain_conf.c hasn't changed.
Thanks for any help!
-matthew
15 years, 11 months
[libvirt] [PATCH] * POTFILES.in: update: remove src/lxc_conf.c; Add src/bridge.c.
by Jim Meyering
"make syntax-check" broke.
Here's the fix:
>From 5bfc2955253b173e13659104890448d427c5e716 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 27 Jan 2009 16:27:07 +0100
Subject: [PATCH] * POTFILES.in: update: remove src/lxc_conf.c; Add src/bridge.c.
---
po/POTFILES.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 49b72e7..401043a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,13 +1,13 @@
gnulib/lib/gai_strerror.c
qemud/qemud.c
qemud/remote.c
+src/bridge.c
src/conf.c
src/console.c
src/datatypes.c
src/domain_conf.c
src/iptables.c
src/libvirt.c
-src/lxc_conf.c
src/lxc_container.c
src/lxc_controller.c
src/lxc_driver.c
--
1.6.1.1.363.g2a3bd
15 years, 11 months
[libvirt] [PATCH] fix errors in virReportSystemErrorFull
by Jim Meyering
While looking at removing most of the remaining uses of strerror,
I spotted problems in virReportSystemErrorFull.
1) it would leak "combined"
2) that allocated, written-into buffer wasn't even used
So, since we'd rather avoid having to allocate at all in the
error-reporting path (esp for OOM errors), I've made it automatic.
>From 8550ec841b4e19049abc4b5e4a2f8a81d1824055 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 26 Jan 2009 14:59:35 +0100
Subject: [PATCH] fix errors in virReportSystemErrorFull
* src/virterror.c (virReportSystemErrorFull): Don't leak "combined".
In fact, don't even attempt allocation.
Do include the result of formatted print in final diagnostic.
---
src/virterror.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/virterror.c b/src/virterror.c
index 0c66781..cfde1dc 100644
--- a/src/virterror.c
+++ b/src/virterror.c
@@ -1019,7 +1019,7 @@ void virReportSystemErrorFull(virConnectPtr conn,
char systemError[1024];
char *theerrnostr;
const char *virerr;
- char *combined = NULL;
+ char combined[2048];
#ifdef HAVE_STRERROR_R
#ifdef __USE_GNU
@@ -1047,10 +1047,15 @@ void virReportSystemErrorFull(virConnectPtr conn,
errorMessage[0] = '\0';
}
- if (virAsprintf(&combined, "%s: %s", errorMessage, theerrnostr) < 0)
- combined = theerrnostr; /* OOM, so lets just pass the strerror info as best effort */
+ char *err_str;
+ int n = snprintf(combined, sizeof combined, "%s: %s",
+ errorMessage, theerrnostr);
+ err_str = (0 < n && n < sizeof(combined)
+ ? combined
+ /* use the strerror info as best effort */
+ : theerrnostr);
- virerr = virErrorMsg(VIR_ERR_SYSTEM_ERROR, (errorMessage[0] ? errorMessage : NULL));
+ virerr = virErrorMsg(VIR_ERR_SYSTEM_ERROR, (err_str[0] ? err_str : NULL));
virRaiseError(conn, NULL, NULL, domcode, VIR_ERR_SYSTEM_ERROR, VIR_ERR_ERROR,
virerr, errorMessage, NULL, -1, -1, virerr, errorMessage);
}
--
1.6.1.1.347.g3f81d
15 years, 11 months
[libvirt] [PATCH] kvm/virtio: Set IFF_VNET_HDR when setting up tap fds
by Mark McLoughlin
IFF_VNET_HDR is a tun/tap flag that allows you to send and receive
large (i.e. GSO) packets and packets with partial checksums. Setting
the flag means that every packet is proceeded by the same header which
virtio uses to communicate GSO/csum metadata.
By enabling this flag on the tap fds we create, we greatly increase
the achievable throughput with virtio_net.
However, we need to be careful to only set the flag when a) QEMU has
support for this ABI and b) the value of the flag is queryable using
the TUNGETIFF ioctl.
It's nearly five months since kvm-74 - the first KVM release with this
feature - was released. Up until now, we've not added libvirt support
because there is no clean way to detect support for this in QEMU at
runtime. A brief attempt to add a "info capabilities" monitor command
to QEMU floundered. Perfect is the enemy of good enough. Probing the
KVM version will suffice for now.
Signed-off-by: Mark McLoughlin <markmc(a)redhat.com>
---
src/bridge.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/bridge.h | 1 +
src/qemu_conf.c | 33 +++++++++++++++++++-------
src/qemu_conf.h | 1 +
4 files changed, 93 insertions(+), 9 deletions(-)
diff --git a/src/bridge.c b/src/bridge.c
index 30afa6d..9c4ca74 100644
--- a/src/bridge.c
+++ b/src/bridge.c
@@ -47,6 +47,7 @@
#include "internal.h"
#include "memory.h"
#include "util.h"
+#include "logging.h"
#define MAX_BRIDGE_ID 256
@@ -403,10 +404,67 @@ static int brSetInterfaceMtu(brControl *ctl,
}
/**
+ * brProbeVnetHdr:
+ * @tapfd: a tun/tap file descriptor
+ *
+ * Check whether it is safe to enable the IFF_VNET_HDR flag on the
+ * tap interface.
+ *
+ * Setting IFF_VNET_HDR enables QEMU's virtio_net driver to allow
+ * guests to pass larger (GSO) packets, with partial checksums, to
+ * the host. This greatly increases the achievable throughput.
+ *
+ * It is only useful to enable this when we're setting up a virtio
+ * interface. And it is only *safe* to enable it when we know for
+ * sure that a) qemu has support for IFF_VNET_HDR and b) the running
+ * kernel implements the TUNGETIFF ioctl(), which qemu needs to query
+ * the supplied tapfd.
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
+static int
+brProbeVnetHdr(int tapfd)
+{
+#if defined(IFF_VNET_HDR) && defined(TUNGETFEATURES) && defined(TUNGETIFF)
+ unsigned int features;
+ struct ifreq dummy;
+
+ if (ioctl(tapfd, TUNGETFEATURES, &features) != 0) {
+ VIR_INFO0(_("Not enabling IFF_VNET_HDR; "
+ "TUNGETFEATURES ioctl() not implemented"));
+ return 0;
+ }
+
+ if (!(features & IFF_VNET_HDR)) {
+ VIR_INFO0(_("Not enabling IFF_VNET_HDR; "
+ "TUNGETFEATURES ioctl() reports no IFF_VNET_HDR"));
+ return 0;
+ }
+
+ /* The kernel will always return -1 at this point.
+ * If TUNGETIFF is not implemented then errno == EBADFD.
+ */
+ if (ioctl(tapfd, TUNGETIFF, &dummy) != -1 || errno != EBADFD) {
+ VIR_INFO0(_("Not enabling IFF_VNET_HDR; "
+ "TUNGETIFF ioctl() not implemented"));
+ return 0;
+ }
+
+ VIR_INFO0(_("Enabling IFF_VNET_HDR"));
+
+ return 1;
+#else
+ VIR_INFO0(_("Not enabling IFF_VNET_HDR; disabled at build time"));
+ return 0;
+#endif
+}
+
+/**
* brAddTap:
* @ctl: bridge control pointer
* @bridge: the bridge name
* @ifname: the interface name (or name template)
+ * @vnet_hdr: whether to try enabling IFF_VNET_HDR
* @tapfd: file descriptor return value for the new tap device
*
* This function creates a new tap device on a bridge. @ifname can be either
@@ -420,6 +478,7 @@ int
brAddTap(brControl *ctl,
const char *bridge,
char **ifname,
+ int vnet_hdr,
int *tapfd)
{
int id, subst, fd;
@@ -435,6 +494,9 @@ brAddTap(brControl *ctl,
if ((fd = open("/dev/net/tun", O_RDWR)) < 0)
return errno;
+ if (vnet_hdr)
+ vnet_hdr = brProbeVnetHdr(fd);
+
do {
struct ifreq try;
int len;
@@ -443,6 +505,11 @@ brAddTap(brControl *ctl,
try.ifr_flags = IFF_TAP|IFF_NO_PI;
+#ifdef IFF_VNET_HDR
+ if (vnet_hdr)
+ try.ifr_flags |= IFF_VNET_HDR;
+#endif
+
if (subst) {
len = snprintf(try.ifr_name, BR_IFNAME_MAXLEN, *ifname, id);
if (len >= BR_IFNAME_MAXLEN) {
diff --git a/src/bridge.h b/src/bridge.h
index 2172b92..2491123 100644
--- a/src/bridge.h
+++ b/src/bridge.h
@@ -63,6 +63,7 @@ int brDeleteInterface (brControl *ctl,
int brAddTap (brControl *ctl,
const char *bridge,
char **ifname,
+ int vnet_hdr,
int *tapfd);
int brSetInterfaceUp (brControl *ctl,
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index ee5cf62..bd5d414 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -353,7 +353,7 @@ int qemudExtractVersionInfo(const char *qemu,
int newstdout = -1;
int ret = -1, status;
unsigned int major, minor, micro;
- unsigned int version;
+ unsigned int version, kvm_version;
unsigned int flags = 0;
if (retflags)
@@ -371,10 +371,13 @@ int qemudExtractVersionInfo(const char *qemu,
if (len < 0)
goto cleanup2;
- if (sscanf(help, "QEMU PC emulator version %u.%u.%u",
- &major, &minor, µ) != 3) {
+ if (sscanf(help, "QEMU PC emulator version %u.%u.%u (kvm-%u)",
+ &major, &minor, µ, &kvm_version) != 4)
+ kvm_version = 0;
+
+ if (!kvm_version && sscanf(help, "QEMU PC emulator version %u.%u.%u",
+ &major, &minor, µ) != 3)
goto cleanup2;
- }
version = (major * 1000 * 1000) + (minor * 1000) + micro;
@@ -394,6 +397,8 @@ int qemudExtractVersionInfo(const char *qemu,
flags |= QEMUD_CMD_FLAG_DRIVE_BOOT;
if (version >= 9000)
flags |= QEMUD_CMD_FLAG_VNC_COLON;
+ if (kvm_version >= 74)
+ flags |= QEMUD_CMD_FLAG_VNET_HDR;
if (retversion)
*retversion = version;
@@ -404,6 +409,8 @@ int qemudExtractVersionInfo(const char *qemu,
qemudDebug("Version %d %d %d Cooked version: %d, with flags ? %d",
major, minor, micro, version, flags);
+ if (kvm_version)
+ qemudDebug("KVM version %d detected", kvm_version);
cleanup2:
VIR_FREE(help);
@@ -467,7 +474,8 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
int **tapfds,
int *ntapfds,
virDomainNetDefPtr net,
- int vlan)
+ int vlan,
+ int vnet_hdr)
{
char *brname;
char tapfdstr[4+3+32+7];
@@ -517,7 +525,7 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
}
if ((err = brAddTap(driver->brctl, brname,
- &net->ifname, &tapfd))) {
+ &net->ifname, vnet_hdr, &tapfd))) {
if (errno == ENOTSUP) {
/* In this particular case, give a better diagnostic. */
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
@@ -1029,9 +1037,16 @@ int qemudBuildCommandLine(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_BRIDGE:
{
- char *tap = qemudNetworkIfaceConnect(conn, driver,
- tapfds, ntapfds,
- net, vlan);
+ char *tap;
+ int vnet_hdr = 0;
+
+ if (qemuCmdFlags & QEMUD_CMD_FLAG_VNET_HDR &&
+ net->model && STREQ(net->model, "virtio"))
+ vnet_hdr = 1;
+
+ tap = qemudNetworkIfaceConnect(conn, driver,
+ tapfds, ntapfds,
+ net, vlan, vnet_hdr);
if (tap == NULL)
goto error;
ADD_ARG(tap);
diff --git a/src/qemu_conf.h b/src/qemu_conf.h
index db2491c..65b08ac 100644
--- a/src/qemu_conf.h
+++ b/src/qemu_conf.h
@@ -48,6 +48,7 @@ enum qemud_cmd_flags {
QEMUD_CMD_FLAG_NAME = (1 << 5),
QEMUD_CMD_FLAG_UUID = (1 << 6),
QEMUD_CMD_FLAG_DOMID = (1 << 7), /* Xenner only */
+ QEMUD_CMD_FLAG_VNET_HDR = (1 << 8),
};
/* Main driver state */
--
1.6.0.6
15 years, 11 months
[libvirt] [PATCH] mark a few diagnostics for translation
by Jim Meyering
Avoid compile-time warnings:
>From 4597152e0c4a1e4a5ee85156496a8625b5cc4f42 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 26 Jan 2009 14:54:21 +0100
Subject: [PATCH 2/3] mark a few diagnostics for translation
* src/proxy_internal.c (xenProxyCommand): Mark a diagnostic.
* src/xen_unified.c (xenUnifiedOpen, xenUnifiedAddDomainInfo): Likewise.
---
src/proxy_internal.c | 6 ++----
src/xen_unified.c | 11 +++++++----
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/proxy_internal.c b/src/proxy_internal.c
index 4d8be3a..d1255ae 100644
--- a/src/proxy_internal.c
+++ b/src/proxy_internal.c
@@ -1,7 +1,7 @@
/*
* proxy_client.c: client side of the communication with the libvirt proxy.
*
- * Copyright (C) 2006, 2008 Red Hat, Inc.
+ * Copyright (C) 2006, 2008, 2009 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
@@ -455,7 +455,7 @@ retry:
*/
if ((res == NULL) || (res->version != PROXY_PROTO_VERSION) ||
(res->len < sizeof(virProxyPacket))) {
- virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
+ virProxyError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
_("Communication error with proxy: malformed packet\n"));
goto error;
}
@@ -1058,5 +1058,3 @@ xenProxyDomainGetOSType(virDomainPtr domain)
return(ostype);
}
-
-
diff --git a/src/xen_unified.c b/src/xen_unified.c
index 1a0f007..240b8f5 100644
--- a/src/xen_unified.c
+++ b/src/xen_unified.c
@@ -261,19 +261,21 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
/* Allocate per-connection private data. */
if (VIR_ALLOC(priv) < 0) {
- xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, _("allocating private data"));
+ xenUnifiedError (NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("allocating private data"));
return VIR_DRV_OPEN_ERROR;
}
if (virMutexInit(&priv->lock) < 0) {
xenUnifiedError (NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot initialise mutex"));
+ "%s", _("cannot initialise mutex"));
VIR_FREE(priv);
return VIR_DRV_OPEN_ERROR;
}
/* Allocate callback list */
if (VIR_ALLOC(cbList) < 0) {
- xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, _("allocating callback list"));
+ xenUnifiedError (NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("allocating callback list"));
virMutexDestroy(&priv->lock);
VIR_FREE(priv);
return VIR_DRV_OPEN_ERROR;
@@ -1564,7 +1566,8 @@ xenUnifiedAddDomainInfo(xenUnifiedDomainInfoListPtr list,
list->count++;
return 0;
memory_error:
- xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, _("allocating domain info"));
+ xenUnifiedError (NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("allocating domain info"));
if (info)
VIR_FREE(info->name);
VIR_FREE(info);
--
1.6.1.1.347.g3f81d
15 years, 11 months
[libvirt] [ANNOUNCE] New release virtinst 0.400.1
by Cole Robinson
I'm happy to announce a new virtinst release, version 0.4.1. The release
can be downloaded from:
http://virt-manager.org/download.html
The direct download link is:
http://virt-manager.org/download/sources/virtinst/virtinst-0.400.1.tar.gz
This release includes:
- Add virt-image -> vmx support to virt-convert, replacing virt-pack
(Joey Boggs)
- Add disk checksum support to virt-image (Joey Boggs)
- Enhanced URL install support: Debian Xen paravirt, Ubuntu kernel and
boot.iso, Mandriva kernel, and Solaris Xen Paravirt
(Guido Gunther, John Levon, Cole Robinson)
- Expanded test suite
- Numerous bug fixes, cleanups, and minor improvements
Thanks to everyone who has contributed to this release through testing,
bug reporting, submitting patches, and otherwise sending in feedback!
Thanks,
Cole
15 years, 11 months
[libvirt] [ANNOUNCE] New release virt-manager 0.6.1
by Cole Robinson
I'm happy to announce a new virt-manager release, version 0.6.1. The
release can be downloaded from:
http://virt-manager.org/download.html
The direct download link is:
http://virt-manager.org/download/sources/virt-manager/virt-manager-0.6.1....
This release includes:
- VM disk and network stats reporting (Guido Gunther)
- VM Migration support (Shigeki Sakamoto)
- Support for adding sound devices to an existing VM
- Enumerate host devices attached to an existing VM
- Allow specifying a device model when adding a network device to an
existing VM
- Combine the serial console view with the VM Details window
- Allow connection to multiple VM serial consoles
- Bug fixes and many minor improvements.
Thanks to everyone who has contributed to this release through testing,
bug reporting, submitting patches, and otherwise sending in feedback!
Thanks,
Cole
15 years, 11 months
[libvirt] [PATCH] [VULN] proxy: Avoid use of uninitialized memory
by Anonymous
diff -urp libvirt-0.5.1/proxy/libvirt_proxy.c libvirt-dev/proxy/libvirt_proxy.c
--- libvirt-0.5.1/proxy/libvirt_proxy.c 2008-11-20 08:58:43.000000000 +0100
+++ libvirt-dev/proxy/libvirt_proxy.c 2009-01-25 12:51:33.000000000 +0100
@@ -385,7 +385,8 @@ retry:
fprintf(stderr, "read %d bytes from client %d on socket %d\n",
ret, nr, pollInfos[nr].fd);
- if ((req->version != PROXY_PROTO_VERSION) ||
+ if ((ret != sizeof(virProxyPacket)) ||
+ (req->version != PROXY_PROTO_VERSION) ||
(req->len < sizeof(virProxyPacket)) ||
(req->len > sizeof(virProxyFullPacket)))
goto comm_error;
15 years, 11 months
[libvirt] [PATCH] Fix virsh sched-credit for xend
by john.levon@sun.com
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232675291 28800
# Node ID 415bfd87e0ecd7751ed6df372e82da0e3991d617
# Parent 68e14fe50dfa88a4694bc4c7a68d2f73f41c6171
Fix virsh sched-credit for xend
Need to pass domain in the xend op for shut-down domains.
(This also requires xend fixes, but this patch doesn't make things
worse.)
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/xend_internal.c b/src/xend_internal.c
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -4665,7 +4665,7 @@ xenDaemonSetSchedulerParameters(virDomai
ret = xend_op(domain->conn, domain->name, "op",
"domain_sched_credit_set", "weight", buf_weight,
- "cap", buf_cap, NULL);
+ "cap", buf_cap, "dom", domain->name, NULL);
break;
}
default:
15 years, 11 months