[libvirt] [PATCH] Add check for poll error events in monitor
by Daniel P. Berrange
Handle poll errors in the same way as hangup event
* src/qemu/qemu_monitor.c: Handle error events
---
src/qemu/qemu_monitor.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 3026733..0c14277 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -550,7 +550,8 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
qemuMonitorUpdateWatch(mon);
- if (events & VIR_EVENT_HANDLE_HANGUP) {
+ if (events & (VIR_EVENT_HANDLE_HANGUP |
+ VIR_EVENT_HANDLE_ERROR)) {
/* If IO process resulted in EOF & we have a message,
* then wakeup that waiter */
if (mon->msg && !mon->msg->finished) {
--
1.7.3.4
13 years, 9 months
[libvirt] [PATCH] Fix setup of lib directory with autogen.sh --system
by Daniel P. Berrange
On x86_64 hosts, /usr/lib64 must be used instead of /usr/lib
Rather than attempt to whitelist architectures, just check
for existance of /usr/lib64
* autogen.sh: Fix to use /usr/lib64 if it exists
---
autogen.sh | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/autogen.sh b/autogen.sh
index 6c2e3bc..4184aa8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -16,7 +16,14 @@ test -f src/libvirt.c || {
EXTRA_ARGS=
if test "x$1" = "x--system"; then
shift
- EXTRA_ARGS="--prefix=/usr --sysconfdir=/etc --localstatedir=/var"
+ prefix=/usr
+ libdir=$prefix/lib
+ sysconfdir=/etc
+ localstatedir=/var
+ if [ -d /usr/lib64 ]; then
+ libdir=$prefix/lib64
+ fi
+ EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
echo "Running ./configure with $EXTRA_ARGS $@"
else
if test -z "$*" && test ! -f "$THEDIR/config.status"; then
--
1.7.3.4
13 years, 9 months
[libvirt] [RFC] libxenlight driver
by Jim Fehlig
I'm looking into creating a driver for the new Xen xl/libxl toolstack
(aka libxenlight [1]), set to become the default in upcoming Xen 4.1.0
release.
My first hurdle is deciding whether this should be a new driver or
integrated with existing xen-unified driver. Initially I thought a new
driver would be a better approach - a clean break from the old code,
similar to the xenapi driver. libxenlight is also stateless (no managed
domains), which seems like another good argument for a new driver. But
libxenlight is really just another interface into the same hypervisor,
so in that regard it should be a xen-unified subdriver.
There are certainly benefits to the xen-unified subdriver approach, e.g.
the existing hypervisor and xenstore subdrivers can be leveraged, the
former providing all the capabilities code. But AFAIK, libxenlight and
xend should not be used together, so I don't think we would want the
xend subdriver activated if libxenlight is detected. Supposedly xl can
be used as a direct replacement for xm, allowing unconditional use of
that subdriver.
BTW, Ian Jackson responded [2] to some of my questions regarding
compatibility between old and new toolstack if you are interested.
I'd like to hear other's opinions on a new driver vs. a xen-unified
subdriver.
Regards,
Jim
[1] http://lists.xensource.com/archives/html/xen-devel/2009-11/msg00436.html
[2]
http://lists.xensource.com/archives/html/xen-devel/2010-11/msg00344.html
13 years, 9 months
[libvirt] [PATCH] maint: support --no-git option during autogen.sh
by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=562743
* .gnulib: Update to latest, for improved bootstrap.
* bootstrap: Resync from gnulib.
* autogen.sh (bootstrap): Add --bootstrap-sync, to make it easier
to keep bootstrap up-to-date. Pass optional --no-git through.
Reported by Aleksey Avdeev.
---
Sorry for the late response (this was first reported months ago!)
I tested this by installing a bogus git at the front of my PATH that
always fails will let ./autogen.sh --no-git work without git (well,
mostly tested it, to the point where it got past the gnulib-tool
invocation, but on Fedora 14, gettext 0.18 also depends on git, so
autogen.sh didn't complete; I suspect that it would completely work on
cygwin which still has gettext 0.17, but that platform takes a lot
longer to run a test on a patch like this).
* .gnulib 45d39ca...18bf850 (19):
> bootstrap: support --no-git option
> update from texinfo
> update from texinfo
> init.sh: insert space between each function name and "()"
> bootstrap: avoid failure when there is no .gitmodules file
> update from texinfo
> mountlist: clean up code formatting
> mountlist: add support for Interix
> maint.mk: improve the public-submodule-commit rule
> include_next: Fix bug introduced on 2011-01-18.
> Allow the user to avoid the GNULIB_TEST_* macros.
> bootstrap: avoid failure when there is no .gitmodules file
> assume <ctype.h>, ..., <time.h> exist
> multiarch: remove AA_APPLE_UNIVERSAL_BUILD
> c-stack: assume stack overflow if SA_SIGINFO unsupported
> stdbool-tests: accomodate Haiku
> binary-io: fix O_TEXT on Haiku
> include_next: do not check for standard headers like stddef.h
> ansi-c++-opt: skip C++ dependency style if C++ is unused
.gnulib | 2 +-
autogen.sh | 9 +++++++--
bootstrap | 50 +++++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 55 insertions(+), 6 deletions(-)
diff --git a/.gnulib b/.gnulib
index 45d39ca..18bf850 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 45d39ca1cae74fcf58ec9911e771bc8baca63f66
+Subproject commit 18bf8501afc50fcf762c3381ffd7af281731d6f7
diff --git a/autogen.sh b/autogen.sh
index 6c2e3bc..323710b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -14,6 +14,11 @@ test -f src/libvirt.c || {
EXTRA_ARGS=
+no_git=
+if test "x$1" = "x--no-git"; then
+ no_git=" $1"
+ shift
+fi
if test "x$1" = "x--system"; then
shift
EXTRA_ARGS="--prefix=/usr --sysconfdir=/etc --localstatedir=/var"
@@ -47,8 +52,8 @@ if test "$t" = "$(cat $curr_status 2>/dev/null)" \
# good, it's up to date, all we need is autoreconf
autoreconf -if
else
- echo running bootstrap...
- ./bootstrap && bootstrap_hash > $curr_status \
+ echo running bootstrap$no_git...
+ ./bootstrap$no_git --bootstrap-sync && bootstrap_hash > $curr_status \
|| { echo "Failed to bootstrap, please investigate."; exit 1; }
fi
diff --git a/bootstrap b/bootstrap
index 12fec20..0d73ffb 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,10 +1,10 @@
#! /bin/sh
# Print a version string.
-scriptversion=2010-11-12.21; # UTC
+scriptversion=2011-01-20.18; # UTC
# Bootstrap this package from checked-out sources.
-# Copyright (C) 2003-2010 Free Software Foundation, Inc.
+# Copyright (C) 2003-2011 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,10 +54,19 @@ Options:
have gnulib sources on your machine, and
do not want to waste your bandwidth downloading
them again. Defaults to \$GNULIB_SRCDIR.
+ --bootstrap-sync If this bootstrap script is not identical to
+ the version in the local gnulib sources,
+ update this script, and then restart it with
+ /bin/sh or the shell \$CONFIG_SHELL if
+ defined.
+ --no-bootstrap-sync Do not check whether bootstrap is out of sync.
--copy Copy files instead of creating symbolic links.
--force Attempt to bootstrap even if the sources seem
not to have been checked out.
--skip-po Do not download po files.
+ --no-git Do not update gnulib using git. Requires that
+ --gnulib-srcdir points to a complete gnulib source
+ tree
If the file $0.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap.
@@ -168,6 +177,13 @@ copy=false
# on which version control system (if any) is used in the source directory.
vc_ignore=auto
+# Set this to true in bootstrap.conf to enable --bootstrap-sync by
+# default.
+bootstrap_sync=false
+
+# Use git to update gnulib sources
+use_git=true
+
# find_tool ENVVAR NAMES...
# -------------------------
# Search for a required program. Use the value of ENVVAR, if set,
@@ -239,12 +255,26 @@ do
checkout_only_file=;;
--copy)
copy=true;;
+ --bootstrap-sync)
+ bootstrap_sync=true;;
+ --no-bootstrap-sync)
+ bootstrap_sync=false;;
+ --no-git)
+ use_git=false;;
*)
echo >&2 "$0: $option: unknown option"
exit 1;;
esac
done
+# --no-git requires --gnulib-srcdir
+if $use_git || test -d "$GNULIB_SRCDIR"; then
+ :
+else
+ echo "Error: --no-git requires --gnulib-srcdir" >&2
+ exit 1
+fi
+
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
exit 1
@@ -370,6 +400,10 @@ check_versions() {
if test "$app" = libtool; then
app=libtoolize
fi
+ # only test for git if not using --no-git
+ if test "$app" = git; then
+ $use_git || continue
+ fi
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
appvar=`echo $app | tr '[a-z]-' '[A-Z]_'`
test "$appvar" = TAR && appvar=AMTAR
@@ -448,7 +482,7 @@ git_modules_config () {
}
gnulib_path=`git_modules_config submodule.gnulib.path`
-: ${gnulib_path=gnulib}
+test -z "$gnulib_path" && gnulib_path=gnulib
# Get gnulib files.
@@ -501,6 +535,16 @@ case ${GNULIB_SRCDIR--} in
;;
esac
+if $bootstrap_sync; then
+ cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
+ echo "$0: updating bootstrap and restarting..."
+ exec sh -c \
+ 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
+ -- "$GNULIB_SRCDIR/build-aux/bootstrap" \
+ "$0" "$@" --no-bootstrap-sync
+ }
+fi
+
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit
--
1.7.3.4
13 years, 9 months
[libvirt] [PATCH] [v2] qemu: Retry JSON monitor cont cmd on MigrationExpected error
by Jim Fehlig
When restoring a saved qemu instance via JSON monitor, the vm is
left in a paused state. Turns out the 'cont' cmd was failing with
"MigrationExpected" error class and "An incoming migration is
expected before this command can be executed" error description
due to migration (restore) not yet complete.
Detect if 'cont' cmd fails with "MigrationExpecte" error class and
retry 'cont' cmd.
V2: Fix potential double-free noted by Laine Stump
---
src/qemu/qemu_monitor_json.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 7387089..35db285 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -702,13 +702,29 @@ qemuMonitorJSONStartCPUs(qemuMonitorPtr mon,
int ret;
virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("cont", NULL);
virJSONValuePtr reply = NULL;
+ int i = 0, timeout = 3;
if (!cmd)
return -1;
- ret = qemuMonitorJSONCommand(mon, cmd, &reply);
+ do {
+ ret = qemuMonitorJSONCommand(mon, cmd, &reply);
- if (ret == 0)
- ret = qemuMonitorJSONCheckError(cmd, reply);
+ if (ret != 0)
+ break;
+
+ /* If no error, we're done */
+ if ((ret = qemuMonitorJSONCheckError(cmd, reply)) == 0)
+ break;
+
+ /* If error class is not MigrationExpected, we're done.
+ * Otherwise try 'cont' cmd again */
+ if (!qemuMonitorJSONHasError(reply, "MigrationExpected"))
+ break;
+
+ virJSONValueFree(reply);
+ reply = NULL;
+ usleep(250000);
+ } while (++i <= timeout);
virJSONValueFree(cmd);
virJSONValueFree(reply);
--
1.7.3.1
13 years, 9 months
[libvirt] [PATCH] qemu: report more proper error for unsupported graphics
by Osier Yang
Report VIR_ERR_CONFIG_UNSUPPORTED instead of VIR_ERR_INTERNAL_ERROR,
as it's valid in our domain schema, just unsupported by hypervisor
here.
* src/qemu/qemu_command.c
---
src/qemu/qemu_command.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 537e537..b969ecc 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3702,9 +3702,9 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=spice");
} else if ((def->ngraphics == 1)) {
- qemuReportError(VIR_ERR_INTERNAL_ERROR,
- _("unsupported graphics type '%s'"),
- virDomainGraphicsTypeToString(def->graphics[0]->type));
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported graphics type '%s'"),
+ virDomainGraphicsTypeToString(def->graphics[0]->type));
goto error;
}
--
1.7.3.2
13 years, 9 months
[libvirt] [PATCH] qemu: Fix a possible deadlock in p2p migration
by Jiri Denemark
Two more calls to remote libvirtd have to be surrounded by
qemuDomainObjEnterRemoteWithDriver() and
qemuDomainObjExitRemoteWithDriver() to prevent possible deadlock between
two communicating libvirt daemons.
See commit f0c8e1cb3774d6f09e2681ca1988bf235a343007 for further details.
---
src/qemu/qemu_driver.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 54e9dcb..bc506c2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11622,24 +11622,38 @@ static int doPeer2PeerMigrate(virDomainPtr dom,
int ret = -1;
virConnectPtr dconn = NULL;
char *dom_xml;
+ bool p2p;
/* the order of operations is important here; we make sure the
* destination side is completely setup before we touch the source
*/
+ qemuDomainObjEnterRemoteWithDriver(driver, vm);
dconn = virConnectOpen(uri);
+ qemuDomainObjExitRemoteWithDriver(driver, vm);
if (dconn == NULL) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("Failed to connect to remote libvirt URI %s"), uri);
return -1;
}
- if (!VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
- VIR_DRV_FEATURE_MIGRATION_P2P)) {
+
+ qemuDomainObjEnterRemoteWithDriver(driver, vm);
+ p2p = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
+ VIR_DRV_FEATURE_MIGRATION_P2P);
+ qemuDomainObjExitRemoteWithDriver(driver, vm);
+ if (!p2p) {
qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Destination libvirt does not support peer-to-peer migration protocol"));
goto cleanup;
}
+ /* domain may have been stopped while we were talking to remote daemon */
+ if (!virDomainObjIsActive(vm)) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("guest unexpectedly quit"));
+ goto cleanup;
+ }
+
dom_xml = qemudVMDumpXML(driver, vm,
VIR_DOMAIN_XML_SECURE |
VIR_DOMAIN_XML_UPDATE_CPU);
--
1.7.3.2
13 years, 9 months
[libvirt] [RFD] Add/Modify some API functions about Host Information
by Minoru Usui
Hi, everyone
In an environment with multiple host machines, I want to select a suitable
host automatically on which I run a VM depending on machine's load.
Libvirt has APIs to get host machine's information,
but I think these APIs aren't enough for above purpose.
So I suggest below changes. What do you think?
* virNodeGetInfo()
This API can get "CPU frequency"(mhz member of virNodeInfo) from
"cpu MHz" of /proc/cpuinfo.
This value isn't constant, because it may be decrease by
power saving feature.(cf. cpuspeed on RHEL)
This value is very useful for getting *present* cpu frequency, but I
want to get Maximum CPU frequency, too.
I want to add max_mhz member in struct virNodeInfo from
/sys/device/system/cpu/cpuXX/cpufreq/cpuinfo_max_freq.
* virNodeGetFreeMemory()
This API returns amount of free memory of the host machine's all
node, but this value doesn't include host's cache/buffer memory.
For above purpose, it would be more suitable to account cache/buffer
as free memory, because most of cache/buffer memory are reclaimable.
But I think virNodeGetFreeMemory()'s ABI should not change easily.
I want to add function virNodeGetCacheBufferMemory(). It returns
amount of cache + buffer memory from /proc/meminfo.
* virSysinfoRead()
This API is completely internal.
But DMI type1 information(dmidecode -t1) is useful for above
purpose, because it's one of the information which suppose to
processing capacity about host machine.
I want to export virSysinfoRead() to user.
--
Minoru Usui <usui(a)mxm.nes.nec.co.jp>
13 years, 9 months
[libvirt] [PATCH] Add support for multiple serial ports to Xen driver
by Michal Novotny
Hi,
this is the patch for to support multiple serial ports
for Xen driver. The definition for Xen has been
introduced in BZ #614004 and this is adding
support to libvirt-based tools.
The patch was originally written for RHEL-5 and libvirt
0.8.2 (RHEL-5.6) where it has been tested using
the virsh command and correct device creation has
been confirmed in the xend.log to have the same data
for serial ports using both `xm create` and `virsh
start` commands. Also, domains with both single and
multiple serial ports has been tested to confirm
it won't introduce any regression and everything
was working fine according to my testing. This patch
is the forward-port of RHEL-5 version of the patch.
Michal
Signed-off-by: Michal Novotny <minovotn(a)redhat.com>
---
src/xen/xend_internal.c | 19 ++++++++++++-
src/xen/xm_internal.c | 66 +++++++++++++++++++++++++++++++++++++++--------
3 files changed, 73 insertions(+), 14 deletions(-)
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 44d5a22..35cdd3c 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -5959,8 +5959,23 @@ xenDaemonFormatSxpr(virConnectPtr conn,
}
if (def->serials) {
virBufferAddLit(&buf, "(serial ");
- if (xenDaemonFormatSxprChr(def->serials[0], &buf) < 0)
- goto error;
+ /*
+ * If domain doesn't have multiple serial ports defined we
+ * keep the old-style formatting not to fail the sexpr tests
+ */
+ if (def->nserials > 1) {
+ for (i = 0; i < def->nserials; i++) {
+ virBufferAddLit(&buf, "(");
+ if (xenDaemonFormatSxprChr(def->serials[i], &buf) < 0)
+ goto error;
+ virBufferAddLit(&buf, ")");
+ }
+ }
+ else {
+ if (xenDaemonFormatSxprChr(def->serials[0], &buf) < 0)
+ goto error;
+ }
+
virBufferAddLit(&buf, ")");
} else {
virBufferAddLit(&buf, "(serial none)");
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index bfb6698..1bb62d7 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -1432,20 +1432,64 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
chr = NULL;
}
- if (xenXMConfigGetString(conf, "serial", &str, NULL) < 0)
- goto cleanup;
- if (str && STRNEQ(str, "none") &&
- !(chr = xenDaemonParseSxprChar(str, NULL)))
- goto cleanup;
+ /* Try to get the list of values to support multiple serial ports */
+ list = virConfGetValue(conf, "serial");
+ if (list && list->type == VIR_CONF_LIST) {
+ list = list->list;
+ while (list) {
+ char *port;
+
+ if ((list->type != VIR_CONF_STRING) || (list->str == NULL))
+ goto skipport;
+
+ port = list->str;
+ if (VIR_ALLOC(chr) < 0)
+ goto no_memory;
- if (chr) {
- if (VIR_ALLOC_N(def->serials, 1) < 0) {
+ if (!(chr = xenDaemonParseSxprChar(port, NULL)))
+ goto skipport;
+
+ if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0)
+ goto no_memory;
+
+ chr->targetType = VIR_DOMAIN_CHR_TARGET_TYPE_SERIAL;
+ chr->type = VIR_DOMAIN_CHR_TYPE_PTY;
+
+ /* Implement device type of serial port when appropriate */
+ if (STRPREFIX(port, "/dev")) {
+ chr->type = VIR_DOMAIN_CHR_TYPE_DEV;
+ chr->target.port = def->nserials;
+ chr->data.file.path = strdup(port);
+
+ if (!chr->data.file.path)
+ goto no_memory;
+ }
+
+ def->serials[def->nserials++] = chr;
+ chr = NULL;
+
+ skipport:
+ list = list->next;
virDomainChrDefFree(chr);
- goto no_memory;
}
- chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
- def->serials[0] = chr;
- def->nserials++;
+ }
+ /* If domain is not using multiple serial ports we parse data old way */
+ else {
+ if (xenXMConfigGetString(conf, "serial", &str, NULL) < 0)
+ goto cleanup;
+ if (str && STRNEQ(str, "none") &&
+ !(chr = xenDaemonParseSxprChar(str, NULL)))
+ goto cleanup;
+
+ if (chr) {
+ if (VIR_ALLOC_N(def->serials, 1) < 0) {
+ virDomainChrDefFree(chr);
+ goto no_memory;
+ }
+ chr->targetType = VIR_DOMAIN_CHR_TARGET_TYPE_SERIAL;
+ def->serials[0] = chr;
+ def->nserials++;
+ }
}
} else {
if (!(def->console = xenDaemonParseSxprChar("pty", NULL)))
--
1.7.3.2
13 years, 9 months
[libvirt] How can I improve the performance of libvirt when running many virtual machines on same host
by Diego Dias
Hi,
I am using Xen 4 as hypervisor and using libvirt 0.8.4 to
communicate with it.
When I run more than 35 virtual machines on the host, Libvirt starts
to run extremely slow and I cant even execute a /"virsh list/". The
memory usage of libvirtd is around 468288K.
Is there any way to improve the performance of libvirt? Is there any
maximum number of virtual machines libvirt can manage without having a
poor performace?
Best Regards,
Diego Dias
13 years, 9 months