[libvirt] [PATCH] Look in /usr/libexec for the qemu-kvm binary.
by Chris Lalancette
On RHEL-5 the qemu-kvm binary is located in /usr/libexec.
To reduce confusion for people trying to run upstream libvirt
on RHEL-5 machines, make the qemu driver look in /usr/libexec
for the qemu-kvm binary.
To make this work, I modified virFindFileInPath to handle an
absolute path correctly. I also ran into an issue where
NULL was sometimes being passed for the file parameter
to virFindFileInPath; it didn't crash prior to this patch
since it was building paths like /usr/bin/(null). This
is non-standard behavior, though, so I added a NULL
check at the beginning.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/qemu/qemu_conf.c | 3 ++-
src/util/util.c | 13 +++++++++++++
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index f4a6c08..d5e38c2 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -804,7 +804,8 @@ qemudCapsInitGuest(virCapsPtr caps,
if (STREQ(info->arch, hostmachine) ||
(STREQ(hostmachine, "x86_64") && STREQ(info->arch, "i686"))) {
if (access("/dev/kvm", F_OK) == 0) {
- const char *const kvmbins[] = { "qemu-kvm", /* Fedora */
+ const char *const kvmbins[] = { "/usr/libexec/qemu-kvm", /* RHEL */
+ "qemu-kvm", /* Fedora */
"kvm" }; /* Upstream .spec */
for (i = 0; i < ARRAY_CARDINALITY(kvmbins); ++i) {
diff --git a/src/util/util.c b/src/util/util.c
index 0ce5026..394ef35 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -1114,6 +1114,19 @@ char *virFindFileInPath(const char *file)
char *pathseg;
char fullpath[PATH_MAX];
+ if (file == NULL)
+ return NULL;
+
+ /* if we are passed an absolute path (starting with /), return a
+ * copy of that path
+ */
+ if (file[0] == '/') {
+ if (virFileExists(file))
+ return strdup(file);
+ else
+ return NULL;
+ }
+
/* copy PATH env so we can tweak it */
if (virStrcpyStatic(pathenv, getenv("PATH")) == NULL)
return NULL;
--
1.6.6
14 years, 11 months
[libvirt] [PATCH] Clarify lack of generated IDE -device string in QEMU driver
by Matthew Booth
The QEMU driver contained code to generate a -device string for piix4-ide, but
wasn't using it. This was intentional. This change removes the string generation
and adds a comment explaining why no -device is necessary.
* src/qemu/qemu_conf.c: Remove VIR_DOMAIN_CONTROLLER_TYPE_IDE handler in
qemuBuildControllerDevStr(). Add comments.
---
src/qemu/qemu_conf.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index f4a6c08..1c4f326 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -2121,11 +2121,8 @@ qemuBuildControllerDevStr(virDomainControllerDefPtr def)
virBufferVSprintf(&buf, ",id=scsi%d", def->idx);
break;
+ /* We always get an IDE controller, whether we want it or not. */
case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
- virBufferAddLit(&buf, "piix4-ide");
- virBufferVSprintf(&buf, ",id=ide%d", def->idx);
- break;
-
default:
goto error;
}
@@ -3141,16 +3138,19 @@ int qemudBuildCommandLine(virConnectPtr conn,
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
for (i = 0 ; i < def->ncontrollers ; i++) {
- char *scsi;
- if (def->controllers[i]->type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
+ /* We don't add an explicit IDE controller because the provided
+ * PIIX4 device already includes one. It isn't possible to remove
+ * the PIIX4. */
+ if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE)
continue;
ADD_ARG_LIT("-device");
- if (!(scsi = qemuBuildControllerDevStr(def->controllers[i])))
+ char *devstr;
+ if (!(devstr = qemuBuildControllerDevStr(def->controllers[i])))
goto no_memory;
- ADD_ARG(scsi);
+ ADD_ARG(devstr);
}
}
--
1.6.6
14 years, 11 months
[libvirt] vshRunConsole:77 : unable to open tty
by Ruben Kerkhof
Hi all,
I'm unable to open a serial console to a kvm virtual machine with
virsh console:
[root@phy003 ~]# virsh console f12
Connected to domain f12
Escape character is ^]
20:43:48.282: error : vshRunConsole:77 : unable to open tty /dev/pts/
1 : No such file or directory
If you look carefully to the message above, there's a space after /dev/
pts/1
I can also see this in the xml:
[root@phy003 ~]# virsh dumpxml f12 > f12.xml
<console type='pty' tty='/dev/pts/1^M'>
<source path='/dev/pts/1^M'/>
<target port='0'/>
</console>
<console type='pty' tty='/dev/pts/1^M'>
<source path='/dev/pts/1^M'/>
<target port='0'/>
</console>
I've run gdb over virsh, and this is what virDomainGetXMLDesc returns:
<console type='pty' tty='/dev/pts/1\r'>
I'm not sure if this has already been fixed, this is
libvirt-0.7.5-3.fc12.x86_64 from the rawhide preview repo on F12, with
qemu-kvm-0.12.2-4.fc12.x86_64
Any help would be appreciated.
Ruben Kerkhof
14 years, 11 months
[libvirt] [PATCH] maint: fix spelling error in hacking
by Eric Blake
* HACKING: STRCASEEQ is case insensitive.
* docs/hacking.html.in: Likewise.
---
HACKING | 4 ++--
docs/hacking.html.in | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/HACKING b/HACKING
index 0c65dad..3844e50 100644
--- a/HACKING
+++ b/HACKING
@@ -222,7 +222,7 @@ one of the following semantically named macros
STREQ(a,b)
STRNEQ(a,b)
- - For case sensitive equality:
+ - For case insensitive equality:
STRCASEEQ(a,b)
STRCASENEQ(a,b)
@@ -231,7 +231,7 @@ one of the following semantically named macros
STREQLEN(a,b,n)
STRNEQLEN(a,b,n)
- - For case sensitive equality of a substring:
+ - For case insensitive equality of a substring:
STRCASEEQLEN(a,b,n)
STRCASENEQLEN(a,b,n)
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index 43a79f7..96f6657 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -256,7 +256,7 @@
</pre>
</li>
- <li><p>For case sensitive equality:</p>
+ <li><p>For case insensitive equality:</p>
<pre>
STRCASEEQ(a,b)
STRCASENEQ(a,b)
@@ -271,7 +271,7 @@
</pre>
</li>
- <li><p>For case sensitive equality of a substring:</p>
+ <li><p>For case insensitive equality of a substring:</p>
<pre>
STRCASEEQLEN(a,b,n)
--
1.6.6
14 years, 11 months
[libvirt] [PATCH] util.c (virGetUserEnt): don't use a negative value as allocation size
by Jim Meyering
Not a big deal, but reporting a failed sysconf call will make
this far easier to diagnose than reporting an unwarranted OOM.
>From 2bf48c9414cac791f03228ff15590414ec617f22 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 28 Jan 2010 13:37:05 +0100
Subject: [PATCH] util.c (virGetUserEnt): don't use a negative value as allocation size
* src/util/util.c (virGetUserEnt): In the unlikely event that
sysconf(_SC_GETPW_R_SIZE_MAX) fails, don't use -1 as the size in
the subsequent allocation.
---
src/util/util.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/util/util.c b/src/util/util.c
index 0ce5026..701581d 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -2317,7 +2317,13 @@ static char *virGetUserEnt(virConnectPtr conn,
char *ret;
struct passwd pwbuf;
struct passwd *pw = NULL;
- size_t strbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ long val = sysconf(_SC_GETPW_R_SIZE_MAX);
+ size_t strbuflen = val;
+
+ if (val < 0) {
+ virReportSystemError(conn, errno, "%s", _("sysconf failed"));
+ return NULL;
+ }
if (VIR_ALLOC_N(strbuf, strbuflen) < 0) {
virReportOOMError(conn);
--
1.7.0.rc0.170.g7207c
14 years, 11 months
[libvirt] libvirt: build error
by Sharadha Prabhakar (3P)
Hi,
I'm getting the following error when I make libvirt version 0.7.4
Make all-recursive
make[1]: Entering directory `/home/sharadhap/libvirt-0.7.4'
Making all in gnulib/lib
make[2]: Entering directory `/home/sharadhap/libvirt-0.7.4/gnulib/lib'
make all-recursive
make[3]: Entering directory `/home/sharadhap/libvirt-0.7.4/gnulib/lib'
make[4]: Entering directory `/home/sharadhap/libvirt-0.7.4/gnulib/lib'
/bin/sh ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../../intl -g -O2 -MT printf-parse.lo -MD -MP -MF .deps/printf-parse.Tpo -c -o printf-parse.lo printf-parse.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -I../../intl -g -O2 -MT printf-parse.lo -MD -MP -MF .deps/printf-parse.Tpo -c printf-parse.c -fPIC -DPIC -o .libs/printf-parse.o
In file included from printf-parse.c:70:
xsize.h: In function 'xsum':
xsize.h:59: error: expected expression before ')' token
xsize.h:59: error: expected expression before ')' token
printf-parse.c: In function 'printf_parse':
printf-parse.c:164: error: expected expression before ')' token
printf-parse.c:164: error: expected expression before ')' token
printf-parse.c:164: error: expected expression before ')' token
printf-parse.c:164: error: expected expression before ')' token
printf-parse.c:168: error: expected expression before ')' token
printf-parse.c:168: error: expected expression before ')' token
printf-parse.c:234: error: expected expression before ')' token
printf-parse.c:234: error: expected expression before ')' token
printf-parse.c:234: error: expected expression before ')' token
printf-parse.c:234: error: expected expression before ')' token
printf-parse.c:238: error: expected expression before ')' token
printf-parse.c:238: error: expected expression before ')' token
printf-parse.c:252: error: expected expression before ')' token
printf-parse.c:252: error: expected expression before ')' token
printf-parse.c:252: error: expected expression before ')' token
printf-parse.c:252: error: expected expression before ')' token
printf-parse.c:252: error: expected expression before ')' token
printf-parse.c:252: error: expected expression before ')' token
printf-parse.c:252: error: expected expression before ')' token
printf-parse.c:252: error: expected expression before ')' token
printf-parse.c:252: error: expected expression before ')' token
printf-parse.c:252: error: expected expression before ')' token
printf-parse.c:291: error: expected expression before ')' token
printf-parse.c:291: error: expected expression before ')' token
printf-parse.c:291: error: expected expression before ')' token
printf-parse.c:291: error: expected expression before ')' token
printf-parse.c:295: error: expected expression before ')' token
printf-parse.c:295: error: expected expression before ')' token
printf-parse.c:310: error: expected expression before ')' token
printf-parse.c:310: error: expected expression before ')' token
printf-parse.c:310: error: expected expression before ')' token
printf-parse.c:310: error: expected expression before ')' token
printf-parse.c:310: error: expected expression before ')' token
printf-parse.c:310: error: expected expression before ')' token
printf-parse.c:310: error: expected expression before ')' token
printf-parse.c:310: error: expected expression before ')' token
printf-parse.c:310: error: expected expression before ')' token
printf-parse.c:310: error: expected expression before ')' token
printf-parse.c:567: error: expected expression before ')' token
printf-parse.c:567: error: expected expression before ')' token
printf-parse.c:567: error: expected expression before ')' token
printf-parse.c:567: error: expected expression before ')' token
printf-parse.c:567: error: expected expression before ')' token
printf-parse.c:567: error: expected expression before ')' token
printf-parse.c:567: error: expected expression before ')' token
printf-parse.c:567: error: expected expression before ')' token
printf-parse.c:567: error: expected expression before ')' token
printf-parse.c:567: error: expected expression before ')' token
printf-parse.c:579: error: expected expression before ')' token
printf-parse.c:579: error: expected expression before ')' token
printf-parse.c:579: error: expected expression before ')' token
printf-parse.c:579: error: expected expression before ')' token
printf-parse.c:580: error: expected expression before ')' token
printf-parse.c:580: error: expected expression before ')' token
printf-parse.c:580: error: expected expression before ')' token
printf-parse.c:580: error: expected expression before ')' token
printf-parse.c:581: error: expected expression before ')' token
printf-parse.c:581: error: expected expression before ')' token
make[4]: *** [printf-parse.lo] Error 1
make[4]: Leaving directory `/home/sharadhap/libvirt-0.7.4/gnulib/lib'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/sharadhap/libvirt-0.7.4/gnulib/lib'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/sharadhap/libvirt-0.7.4/gnulib/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/sharadhap/libvirt-0.7.4'
make: *** [all] Error 2ake libvirt version 0.7.4
I'm using gcc version 4.3.2
Distro : Debian lenny 5
Could someone provide some help here?
-SP
14 years, 11 months