[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.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/qemu/qemu_conf.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index c227fe1..2ba8366 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -797,7 +797,8 @@ qemudCapsInitGuest(virCapsPtr caps,
*/
if (STREQ(info->arch, hostmachine) ||
(STREQ(hostmachine, "x86_64") && STREQ(info->arch, "i686"))) {
- const char *const kvmbins[] = { "/usr/bin/qemu-kvm", /* Fedora */
+ const char *const kvmbins[] = { "/usr/libexec/qemu-kvm", /* RHEL */
+ "/usr/bin/qemu-kvm", /* Fedora */
"/usr/bin/kvm" }; /* Upstream .spec */
for (i = 0; i < ARRAY_CARDINALITY(kvmbins); ++i) {
--
1.6.6
15 years, 2 months
[libvirt] [PATCH] usbGetDevice: don't leak a "usbDevice" buffer on failure path
by Jim Meyering
Here's another leak fix, although this one is only on a failure path:
>From a89551ecfcebfc3d45eff38923824a9590fe9f76 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 25 Jan 2010 16:44:13 +0100
Subject: [PATCH] usbGetDevice: don't leak a "usbDevice" buffer on failure path
* src/util/hostusb.c (usbGetDevice): Free "dev" when returning NULL.
---
src/util/hostusb.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/util/hostusb.c b/src/util/hostusb.c
index 9a37103..f635ce5 100644
--- a/src/util/hostusb.c
+++ b/src/util/hostusb.c
@@ -171,8 +171,10 @@ usbGetDevice(virConnectPtr conn,
if (vendor) {
/* Look up bus.dev by vendor:product */
- if (usbFindBusByVendor(conn, vendor, product, &bus, &devno) < 0)
+ if (usbFindBusByVendor(conn, vendor, product, &bus, &devno) < 0) {
+ VIR_FREE(dev);
return NULL;
+ }
}
dev->bus = bus;
--
1.7.0.rc0.127.gab8271
15 years, 2 months
[libvirt] [PATCH] qemuMonitorTextGetMemoryStats: plug a leak on an error path
by Jim Meyering
Coverity complained about a leak via this return -1
in qemu_monitor_text.c:
int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon,
virDomainMemoryStatPtr stats,
unsigned int nr_stats)
{
char *reply = NULL;
int ret = 0;
char *offset;
if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("could not query memory balloon statistics"));
return -1;
}
That can happen because
qemuMonitorCommand calls
qemuMonitorCommandWithFd which calls
qemuMonitorCommandWithHandler, which does this:
218 ret = qemuMonitorSend(mon, &msg);
...
228 if (msg.rxBuffer) {
229 *reply = msg.rxBuffer;
230 } else {
231 *reply = strdup("");
232 if (!*reply) {
233 virReportOOMError(NULL);
234 return -1;
235 }
236 }
237
238 if (ret < 0)
239 virReportSystemError(NULL, msg.lastErrno,
240 _("cannot send monitor command '%s'"), cmd);
241
242 return ret;
243 }
That function breaks contract by failing to free *reply when it
returns a negative value. Here's the fix:
>From 3b44df075f9d4330ec27d59eddaa0a32c20d7ac1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 20 Jan 2010 18:24:47 +0100
Subject: [PATCH] qemuMonitorTextGetMemoryStats: plug a leak on an error path
* src/qemu/qemu_monitor_text.c (qemuMonitorCommandWithHandler):
Always free *reply, upon failure.
---
src/qemu/qemu_monitor_text.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index c3848b5..d921c7e 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1,7 +1,7 @@
/*
* qemu_monitor_text.c: interaction with QEMU monitor console
*
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -235,9 +235,11 @@ qemuMonitorCommandWithHandler(qemuMonitorPtr mon,
}
}
- if (ret < 0)
+ if (ret < 0) {
virReportSystemError(NULL, msg.lastErrno,
_("cannot send monitor command '%s'"), cmd);
+ VIR_FREE(*reply);
+ }
return ret;
}
--
1.6.6.516.gb72f
15 years, 2 months
[libvirt] [PATCH 1/n] modernizing configure
by Eric Blake
I just built libvirt for the first time today, and noticed that
configure fails on the first missing dependency, rather than trying
harder to make it through and list all missing dependencies at the end.
I ended up restarting configure multiple times. In the process, I also
noticed that configure is somewhat out of date.
So, what is the oldest version of autoconf and automake that libvirt
will insist on supporting? For example, is it time to require automake
1.11.1 (the latest stable release) because of its security patch to
avoid potential problems in 'make dist'? Or is it too soon to expect
all distros to have an automake that new pre-installed, and more effort
be put into supporting automake 1.9.6 and autoconf 2.59 (those being the
implicit minimum requirements due to the use of gnulib)? Or somewhere
in between?
Meanwhile, how about this patch, for me getting my feet wet in helping
to modernize the autotools usage, and hopefully leading up to future
patches to make configure list all missing dependencies at once, rather
than requiring multiple restarts.
15 years, 2 months
[libvirt] [PATCH] Fix libvirtd restart for domains with PCI passthrough devices
by Chris Lalancette
When libvirtd shuts down, it places a <state/> tag in the XML
state file it writes out for guests with PCI passthrough
devices. For devices that are attached at bootup time, the
state tag is empty. However, at libvirtd startup time, it
ignores anything with a <state/> tag in the XML, effectively
hiding the guest.
I can think of at least 3 ways to fix this:
1) Don't throw an error on "unknown" tags in
virDomainHostdevSubsysPciDefParseXML().
2) Have virDomainLoadAllConfigs() pass the
VIR_DOMAIN_XML_INTERNAL_STATUS flag when parsing the domain
XML.
3) Remove the check for VIR_DOMAIN_XML_INTERNAL_STATUS
when parsing the XML.
I chose approach 3). My reasoning for this is that the
<state> tag is a legitimate part of the XML, so we should
always offer to parse it. This fixes the problem with
reconnecting to domains that have PCI passthrough devices.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/conf/domain_conf.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 74c2337..595c46c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2876,7 +2876,7 @@ static int
virDomainHostdevSubsysPciDefParseXML(virConnectPtr conn,
const xmlNodePtr node,
virDomainHostdevDefPtr def,
- int flags) {
+ int flags ATTRIBUTE_UNUSED) {
int ret = -1;
xmlNodePtr cur;
@@ -2890,8 +2890,7 @@ virDomainHostdevSubsysPciDefParseXML(virConnectPtr conn,
if (virDomainDevicePCIAddressParseXML(conn, cur, addr) < 0)
goto out;
- } else if ((flags & VIR_DOMAIN_XML_INTERNAL_STATUS) &&
- xmlStrEqual(cur->name, BAD_CAST "state")) {
+ } else if (xmlStrEqual(cur->name, BAD_CAST "state")) {
/* Legacy back-compat. Don't add any more attributes here */
char *devaddr = virXMLPropString(cur, "devaddr");
if (devaddr &&
--
1.6.6
15 years, 2 months
[libvirt] [PATCH] allow (only) surrounding whitespace in uuid
by Dan Kenigsberg
Please consider something along these lines. Without it, pretty-printed
domxml is rejected due to the whitespace before uuid, and long long
string of hexadecimal digits is accepted.
---
src/util/uuid.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/src/util/uuid.c b/src/util/uuid.c
index 002a64d..0f2ca96 100644
--- a/src/util/uuid.c
+++ b/src/util/uuid.c
@@ -145,9 +145,13 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) {
/*
* do a liberal scan allowing '-' and ' ' anywhere between character
- * pairs as long as there is 32 of them in the end.
+ * pairs, and surrounding whitespace, as long as there are exactly
+ * 32 hexadecimal digits the end.
*/
cur = uuidstr;
+ while (c_isspace(*cur))
+ cur++;
+
for (i = 0;i < VIR_UUID_BUFLEN;) {
uuid[i] = 0;
if (*cur == 0)
@@ -170,6 +174,12 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) {
cur++;
}
+ while (*cur) {
+ if (!c_isspace(*cur))
+ goto error;
+ cur++;
+ }
+
return 0;
error:
--
1.6.5.2
15 years, 2 months
[libvirt] [PATCH] libvirt-publican copyright tags
by David Jorm
I don't have commiter access on this. Can someone else please push it or give me access?
--- a/en-US/Legal_Notice.xml
+++ b/en-US/Legal_Notice.xml
@@ -3,10 +3,10 @@
]>
<legalnotice>
<para>
- Copyright <trademark class="copyright"></trademark> &YEAR; &HOLDER;
+ Copyright <trademark class="copyright"></trademark> &YEAR; &HOLDER;
</para>
<para>
- Copyright © 2009 Red Hat, Inc. and others.
+ Copyright © 2010 Red Hat, Inc. and others.
</para>
<para>
The text of and illustrations in this document are licensed by Red Hat
15 years, 2 months
[libvirt] esx: networkPtr not initialized
by Nimal I
hy,
I'm tring to add a new API for getting the network info from ESX. I found
out that I dont get a valid pointer for the networkPtr while
initializing.(whereas DomainPtr is initialozed and gettting a valid pointer
on a successfull connect itself). Can somebody let me know, what to do to
initialize this pointer and further add a API for a netconfig.
Thanks in Advance,
--
Nimal.I
15 years, 2 months
[libvirt] PCI Passthrough
by Aaron Clausen
I'm trying once again to get PCI passthrough working (KVM 84 on Ubuntu
9.10), and I'm getting this error :
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
/usr/bin/kvm -S -M pc-0.11 -m 4096 -smp 4 -name mailserver -uuid
76a83471-e94a-3658-fa61-8eceaa74ffc2 -monitor
unix:/var/run/libvirt/qemu/mailserver.monitor,server,nowait -localtime
-boot c -drive file=,if=ide,media=cdrom,index=2 -drive
file=/var/lib/libvirt/images/mailserver.img,if=virtio,index=0,boot=on
-drive file=/var/lib/libvirt/images/mailserver-2.img,if=virtio,index=1
-net nic,macaddr=54:52:00:1b:b2:56,vlan=0,model=virtio,name=virtio.0
-net tap,fd=17,vlan=0,name=tap.0 -serial pty -parallel none -usb
-usbdevice tablet -vnc 127.0.0.1:0 -k en-us -vga cirrus -pcidevice
host=0a:01.0
char device redirected to /dev/pts/0
get_real_device: /sys/bus/pci/devices/0000:0a:01.0/config: Permission denied
init_assigned_device: Error: Couldn't get real device (0a:01.0)!
Failed to initialize assigned device host=0a:01.0
Any thoughts?
--
Aaron Clausen
mightymartianca(a)gmail.com
15 years, 2 months