[libvirt] [PATCH 1/3] qemu: migration: Improve p2p error if we can't open conn
by Cole Robinson
By actually showing the Open() error to the user
---
src/qemu/qemu_migration.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 19b1236..9ac9be4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3472,7 +3472,8 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
qemuDomainObjExitRemote(vm);
if (dconn == NULL) {
virReportError(VIR_ERR_OPERATION_FAILED,
- _("Failed to connect to remote libvirt URI %s"), dconnuri);
+ _("Failed to connect to remote libvirt URI %s: %s"),
+ dconnuri, virGetLastErrorMessage());
virObjectUnref(cfg);
return -1;
}
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH] build: work around broken sasl header
by Eric Blake
Compilation on cygwin failed due to a bug in the sasl headers
present on that platform (libsasl2-devel 2.1.26):
In file included from rpc/virnetserverclient.c:27:0:
/usr/include/sasl/sasl.h:230:38: error: expected declaration specifiers or '...' before 'size_t'
* src/rpc/virnetserverclient.c (includes): Ensure size_t is
defined before using sasl.h.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the build-breaker rule.
src/rpc/virnetserverclient.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 0bd88ad..2fc4838 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1,7 +1,7 @@
/*
* virnetserverclient.c: generic network RPC server client
*
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -23,6 +23,7 @@
#include <config.h>
+#include "internal.h"
#if WITH_SASL
# include <sasl/sasl.h>
#endif
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH] build: fix build without libvirtd
by Eric Blake
Building when configured --with-libvirtd=no fails with:
In file included from ../src/qemu/qemu_command.h:30:0,
from testutilsqemu.h:4,
from networkxml2xmltest.c:14:
../src/qemu/qemu_conf.h:175:5: error: expected specifier-qualifier-list before 'virStateInhibitCallback'
* src/libvirt_internal.h (virStateInhibitCallback): Move outside
of conditional.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under build-breaker rule
src/libvirt_internal.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h
index 5c83ffa..29f2043 100644
--- a/src/libvirt_internal.h
+++ b/src/libvirt_internal.h
@@ -1,7 +1,7 @@
/*
- * libvirt.h: publically exported APIs, not for public use
+ * libvirt_internal.h: internally exported APIs, not for public use
*
- * Copyright (C) 2006-2008, 2011 Red Hat, Inc.
+ * Copyright (C) 2006-2013 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
@@ -27,10 +27,10 @@
# include "internal.h"
-# ifdef WITH_LIBVIRTD
typedef void (*virStateInhibitCallback)(bool inhibit,
void *opaque);
+# ifdef WITH_LIBVIRTD
int virStateInitialize(bool privileged,
virStateInhibitCallback inhibit,
void *opaque);
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH] build: fix build with newer gnutls
by Eric Blake
Building with gnutls 3.2.0 (such as shipped with current cygwin) fails
with:
rpc/virnettlscontext.c: In function 'virNetTLSSessionGetKeySize':
rpc/virnettlscontext.c:1358:5: error: implicit declaration of function 'gnutls_cipher_get_key_size' [-Wimplicit-function-declaration]
Yeah, it's stupid that gnutls broke API by moving their declaration
into a new header without including that header from the old one,
but it's easy enough to work around, all without breaking on gnutls
1.4.1 (hello RHEL 5) that lacked the new header.
* src/rpc/virnettlscontext.c (includes): Include additional header.
* configure.ac (gnutls): Check for <gnutls/crypto.h>.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the build-breaker rule, once my testing completes
across multiple systems with various gnutls versions (1.4.1 in
RHEL5, 2.12.23 in Fedora 18, 3.2.0 in Cygwin).
configure.ac | 1 +
src/rpc/virnettlscontext.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/configure.ac b/configure.ac
index 7041710..0b3d028 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1087,6 +1087,7 @@ if test "x$with_gnutls" != "xno"; then
if test "$GNUTLS_FOUND" = "no"; then
fail=0
AC_CHECK_HEADER([gnutls/gnutls.h], [], [fail=1])
+ AC_CHECK_HEADERS([gnutls/crypto.h])
AC_CHECK_LIB([gnutls], [gnutls_handshake],[], [fail=1], [-lgcrypt])
test $fail = 0 && GNUTLS_FOUND=yes
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index e29c439..f2ac551 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -25,6 +25,9 @@
#include <stdlib.h>
#include <gnutls/gnutls.h>
+#if HAVE_GNULTLS_CRYPTO_H
+# include <gnutls/crypto.h>
+#endif
#include <gnutls/x509.h>
#include "gnutls_1_0_compat.h"
--
1.8.1.4
11 years, 5 months
Re: [libvirt] [PATCH] target-i386: Disable CPUID_EXT_MONITOR when KVM is enabled
by Eduardo Habkost
(CCing libvirt people)
On Tue, May 28, 2013 at 06:48:52PM +0200, Andreas Färber wrote:
> Am 28.05.2013 18:46, schrieb Paolo Bonzini:
> > Il 28/05/2013 18:34, Bandan Das ha scritto:
> >> Eduardo Habkost <ehabkost(a)redhat.com> writes:
> >>
> >>> On Mon, May 27, 2013 at 02:21:36PM +0200, Paolo Bonzini wrote:
> >>>> Il 27/05/2013 14:09, Eduardo Habkost ha scritto:
> >>>>> On Sat, May 25, 2013 at 08:25:49AM +0200, Paolo Bonzini wrote:
> >>>>>> Il 25/05/2013 03:21, Bandan Das ha scritto:
> >>>>>>> There is one user-visible effect: "-cpu ...,enforce" will stop failing
> >>>>>>> because of missing KVM support for CPUID_EXT_MONITOR. But that's exactly
> >>>>>>> the point: there's no point in having CPU model definitions that would
> >>>>>>> never work as-is with neither TCG or KVM. This patch is changing the
> >>>>>>> meaning of (e.g.) "-machine ...,accel=kvm -cpu Opteron_G3" to match what
> >>>>>>> was already happening in practice.
> >>>>>>
> >>>>>> But then -cpu Opteron_G3 does not match a "real" Opteron G3. Is it
> >>>>>> worth it?
> >>>>>
> >>>>> No models match a "real" CPU this way, because neither TCG or KVM
> >>>>> support all features supported by a real CPU. I ask the opposite
> >>>>> question: is it worth maintaining an "accurate" CPU model definition
> >>>>> that would never work without feature-bit tweaking in the command-line?
> >>>>
> >>>> It would work with TCG. Changing TCG to KVM should not change hardware
> >>>> if you use "-cpu ...,enforce", so it is right that it fails when
> >>>> starting with KVM.
> >>>>
> >>>
> >>> Changing between KVM and TCG _does_ change hardware, today (with or
> >>> without check/enforce). All CPU models on TCG have features not
> >>> supported by TCG automatically removed. See the "if (!kvm_enabled())"
> >>> block at x86_cpu_realizefn().
> >>
> >> Yes, this is exactly why I was inclined to remove the monitor flag.
> >> We already have uses of kvm_enabled() to set (or remove) kvm specific stuff,
> >> and this change is no different.
> >
> > Do any of these affect something that is part of x86_def_t?
>
> The vendor comes to mind.
I believe we can still consider the "vendor" field a special one: if
other components care about the TCG/KVM difference regarding the
"vendor" field, they can simply set "vendor" explicitly on the
command-line.
> >> I can see Paolo's point though, having
> >> a common definition probably makes sense too.
> >
Paolo is convincing me that keeping the rest of the features exactly the
same on TCG and KVM modes (and making check/enforce work for TCG as
well) would simplify the logic a lot. This will add a little extra work
for libvirt, that will probably need to use "-cpu Opteron_G3,-monitor"
once it implements enforce-mode (to make sure the results really match
existing libvirt assumptions about the Opteron_G* models), but it is
probably worth it.
I will give it a try and send a proposal soon.
> >>> (That's why I argue that we need separate classes/names for TCG and KVM
> >>> modes. Otherwise our predefined models get less useful as they will
> >>> require low-level feature-bit fiddling on the libvirt side to make them
> >>> work as expected.)
> >>
> >> Agreed. From a user's perspective, I think the more a CPU model "just works",
> >> whether it's KVM or TCG, the better.
> >
> > Yes, that's right. But I think extending the same expectation to "-cpu
> > ...,enforce" is not necessary, and perhaps even wrong for "-cpu
> > ...,check" since it's only a warning rather than a fatal error.
> >
> > Paolo
> >
>
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
--
Eduardo
11 years, 5 months
[libvirt] [PATCH] qemu: match vcpu topology to maximum vcpu numbers.
by Guannan Ren
For qemu, if the -smp N or the value of maxcpus is given, it define
the number of vcpu of guest whenever the vcpu topology is defined or
not. But if the -smp N and maxcpus are missing, the topology can
compute and define vcpus for guest automatically by math:
vcpu number = sockets*cores*threads
For libvirt, as <vcpu> is always mandatory, so we can ask topology
to match maximum vcpu numbers.
---
src/conf/domain_conf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a9656af..ffdc6da 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11815,10 +11815,10 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
if (def->cpu->sockets &&
- def->maxvcpus >
+ def->maxvcpus !=
def->cpu->sockets * def->cpu->cores * def->cpu->threads) {
virReportError(VIR_ERR_XML_DETAIL, "%s",
- _("Maximum CPUs greater than topology limit"));
+ _("Topology limit does not match maximum CPUs"));
goto error;
}
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH 00/12 v2] storage_conf: left cleanup/fixes/improvement patches
by Osier Yang
Part of v1 are pushed, the left patches are splitted
Osier Yang (12):
storage_conf: Fix the wrong error message
storage_conf: Don't leak "uuid" in virStoragePoolDefParseAuthCephx
storage_conf: Remove the useless casting
storage_conf: Use xmlStrEqual instead of STREQ
storage_conf: Put "%s" at the same line with error type
storage_conf: Fix the error type
storage_conf: Improve the memory deallocation of pool def parsing
storage_conf: Improve the memory deallocation of
virStorageVolDefParseXML
storage_conf: Use NULLSTR instead
storage_conf: Use VIR_STRDUP instead of strdup
storage_conf: Improve error messages
storage_conf: Use uid_t/gid_t instead of int to cast the value
src/conf/storage_conf.c | 242 ++++++++++++++++++++++++------------------------
1 file changed, 122 insertions(+), 120 deletions(-)
--
1.8.1.4
11 years, 5 months
[libvirt] Put the audio work on Windows 2008 Server 64bits
by Carlos Rodrigues
Hello,
I am trying to put the audio audio work on Windows 2008 Server with
64bits but without success.
I have tested with sound model ac97 and hda, and i always get the same error:
the devices appears on Windows Device Manager with following message -
"Windows cannot load the device driver for this hardware.
The driver may be corrupted or missing. (Code 39)".
I have qemu-kvm 1.2 and libvirt 0.10.2.
I also tried different drivers with different sound model combinations
but no success.
Any suggestion of drivers that can i use and how can i get audio device
working?
Best Regards,
--
Carlos Rodrigues <cmar(a)eurotux.com>
Engenheiro de Software Sénior
Eurotux Informática, S.A. | www.eurotux.com
(t) +351 253 680 300
11 years, 5 months
[libvirt] [PATCH v2] qemuOpenVhostNet: Decrease vhostfdSize on open failure
by Michal Privoznik
Currently, if there's an error opening /dev/vhost-net (e.g. because
it doesn't exist) but it's not required we proceed with vhostfd array
filled with -1 and vhostfdSize unchanged. Later, when constructing
the qemu command line only non-negative items within vhostfd array
are taken into account. This means, vhostfdSize may be greater than
the actual count of non-negative items in vhostfd array. This results
in improper command line arguments being generated, e.g.:
-netdev tap,fd=21,id=hostnet0,vhost=on,vhostfd=(null)
---
src/qemu/qemu_command.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 0373626..c4a162a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -486,6 +486,10 @@ qemuOpenVhostNet(virDomainDefPtr def,
"but is unavailable"));
goto error;
}
+ VIR_WARN("Unable to open vhost-net. Opened so far %d, requested %d",
+ i, *vhostfdSize);
+ *vhostfdSize = i;
+ break;
}
}
virDomainAuditNetDevice(def, net, "/dev/vhost-net", *vhostfdSize);
@@ -6560,12 +6564,10 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
}
for (i = 0; i < vhostfdSize; i++) {
- if (vhostfd[i] >= 0) {
- virCommandTransferFD(cmd, vhostfd[i]);
- if (virAsprintf(&vhostfdName[i], "%d", vhostfd[i]) < 0) {
- virReportOOMError();
- goto cleanup;
- }
+ virCommandTransferFD(cmd, vhostfd[i]);
+ if (virAsprintf(&vhostfdName[i], "%d", vhostfd[i]) < 0) {
+ virReportOOMError();
+ goto cleanup;
}
}
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH] Introduce startupPolicy for chardev to make guest OS bootable when hardware failure happens in log disk
by Seiji Aguchi
[Problem]
Currently, guest OS's messages can be logged to a local disk of host OS
by creating chadevs with options below.
-chardev file,id=charserial0,path=<log file's path> -device isa-serial,chardev=chardevserial0,id=serial0
When a hardware failure happens in the disk, qemu-kvm can't create the chardevs.
In this case, guest OS doesn't boot up.
Actually, there are users who don't desire that guest OS goes down due to a hardware failure
of a log disk only.Therefore, qemu should offer some way to boot guest OS up even if the log
disk is broken.
[Solution]
This patch supports startupPolicy for chardev.
The starupPolicy is introduced just in case where chardev is "file"
because this patch aims for making guest OS boot up when a hardware failure happens.
In other cases ,pty, dev, pipe and unix, it is not introduced
because they don't access to hardware.
The policy works as follows.
- If the value is "optional", guestOS boots up by dropping the chardev.
- If other values are specified, guestOS fails to boot up. (the default)
Description about original startupPolicy attribute:
http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=e5a84d74a2789a917bf3...
Signed-off-by: Seiji Aguchi <seiji.aguchi(a)hds.com>
---
docs/formatdomain.html.in | 9 ++++++++-
docs/schemas/domaincommon.rng | 3 +++
src/conf/domain_conf.c | 8 ++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_process.c | 25 ++++++++++++++++++++++++-
tests/virt-aa-helper-test | 3 +++
6 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f325c3c..1e1bf27 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4044,13 +4044,20 @@ qemu-kvm -net nic,model=? /dev/null
<p>
A file is opened and all data sent to the character
device is written to the file.
+ It is possible to define policy whether guestOS boots up
+ if the file is not accessible. This is done by a startupPolicy
+ attribute:
+ <ul>
+ <li>If the vaule is "optional", guestOS boots up by dropping the file.</li>
+ <li>If other values are specified, guestOS fails to boot up. (the default)</li>
+ </ul>
</p>
<pre>
...
<devices>
<serial type="file">
- <source path="/var/log/vm/vm-serial.log"/>
+ <source path="/var/log/vm/vm-serial.log" startupPolicy="optional"/>
<target port="1"/>
</serial>
</devices>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 10596dc..6fc0a3c 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2706,6 +2706,9 @@
</optional>
<optional>
<attribute name="path"/>
+ <optional>
+ <ref name='startupPolicy'/>
+ </optional>
</optional>
<optional>
<attribute name="host"/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a8b5dfd..6680f15 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6467,6 +6467,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
char *path = NULL;
char *mode = NULL;
char *protocol = NULL;
+ char *startupPolicy = NULL;
int remaining = 0;
while (cur != NULL) {
@@ -6487,6 +6488,9 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
!(flags & VIR_DOMAIN_XML_INACTIVE)))
path = virXMLPropString(cur, "path");
+ if (startupPolicy == NULL &&
+ def->type == VIR_DOMAIN_CHR_TYPE_FILE)
+ startupPolicy = virXMLPropString(cur, "startupPolicy");
break;
case VIR_DOMAIN_CHR_TYPE_UDP:
@@ -6559,6 +6563,10 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
def->data.file.path = path;
path = NULL;
+
+ def->data.file.startupPolicy =
+ virDomainStartupPolicyTypeFromString(startupPolicy);
+ startupPolicy = NULL;
break;
case VIR_DOMAIN_CHR_TYPE_STDIO:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3a0f23a..e709951 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1052,6 +1052,7 @@ struct _virDomainChrSourceDef {
/* no <source> for null, vc, stdio */
struct {
char *path;
+ int startupPolicy; /* enum virDomainStartupPolicy */
} file; /* pty, file, pipe, or device */
struct {
char *host;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e75c8c9..6e2f78e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2442,7 +2442,30 @@ qemuProcessPrepareChardevDevice(virDomainDefPtr def ATTRIBUTE_UNUSED,
virReportSystemError(errno,
_("Unable to pre-create chardev file '%s'"),
dev->source.data.file.path);
- return -1;
+ if (dev->source.data.file.startupPolicy !=
+ VIR_DOMAIN_STARTUP_POLICY_OPTIONAL) {
+ return -1;
+ }
+ VIR_FREE(dev->source.data.file.path);
+ /*
+ * Change a destination to /dev/null to boot guest OS up
+ * even if a log disk is broken.
+ */
+ VIR_WARN("Switch the destination to /dev/null");
+ dev->source.data.file.path = strdup("/dev/null");
+
+ if (!(dev->source.data.file.path)) {
+ virReportOOMError();
+ return -1;
+ }
+
+ if ((fd = open(dev->source.data.file.path,
+ O_CREAT | O_APPEND, S_IRUSR|S_IWUSR)) < 0) {
+ virReportSystemError(errno,
+ _("Unable to pre-create chardev file '%s'"),
+ dev->source.data.file.path);
+ return -1;
+ }
}
VIR_FORCE_CLOSE(fd);
diff --git a/tests/virt-aa-helper-test b/tests/virt-aa-helper-test
index af91c61..7172fd6 100755
--- a/tests/virt-aa-helper-test
+++ b/tests/virt-aa-helper-test
@@ -255,6 +255,9 @@ testme "0" "disk (empty cdrom)" "-r -u $valid_uuid" "$test_xml"
sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,</devices>,<serial type='file'><source path='$tmpdir/serial.log'/><target port='0'/></serial></devices>,g" "$template_xml" > "$test_xml"
testme "0" "serial" "-r -u $valid_uuid" "$test_xml"
+sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,</devices>,<serial type='file'><source path='$tmpdir/serial.log' startupPolicy='optional'/><target port='0'/></serial></devices>,g" "$template_xml" > "$test_xml"
+testme "0" "serial" "-r -u $valid_uuid" "$test_xml"
+
sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,</devices>,<serial type='pty'><target port='0'/></serial></devices>,g" "$template_xml" > "$test_xml"
testme "0" "serial (pty)" "-r -u $valid_uuid" "$test_xml"
--
1.7.1
11 years, 6 months