Fix nodedev XML conversion errors (bz 591262)
Fix PCI xml decimal parsing (bz 582752) Fix CDROM media connect/eject (bz 582005) Always report qemu startup output on error (bz 581381) Fix crash from 'virsh dominfo' if secdriver disabled (bz 581166)
This commit is contained in:
parent
09a86187e8
commit
5c3e8a7ac0
|
@ -0,0 +1,132 @@
|
|||
commit c4896d378b921ba6471562d7b17641be121c19d6
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Thu Apr 15 11:35:07 2010 +0100
|
||||
|
||||
Fix CDROM media change for QEMU when using -device syntax
|
||||
|
||||
Disk devices in QEMU have two parts, the guest device and the host
|
||||
backend driver. Historically these two parts have had the same
|
||||
"unique" name. With the switch to using -device though, they now
|
||||
have separate names. Thus when changing CDROM media, for guests
|
||||
using -device syntax, we need to prepend the QEMU_DRIVE_HOST_PREFIX
|
||||
constant
|
||||
|
||||
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add helper function
|
||||
qemuDeviceDriveHostAlias() for building a host backend alias
|
||||
* src/qemu/qemu_driver.c: Use qemuDeviceDriveHostAlias() to determine
|
||||
the host backend alias for performing eject/change commands in the
|
||||
monitor
|
||||
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index 1a8b4aa..0cbedf2 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -1699,6 +1699,26 @@ static int qemuAssignDeviceDiskAliasLegacy(virDomainDiskDefPtr disk)
|
||||
}
|
||||
|
||||
|
||||
+char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
|
||||
+ unsigned long long qemudCmdFlags)
|
||||
+{
|
||||
+ char *ret;
|
||||
+
|
||||
+ if (qemudCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
|
||||
+ if (virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) {
|
||||
+ virReportOOMError();
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (!(ret = strdup(disk->info.alias))) {
|
||||
+ virReportOOMError();
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* Names used before -drive supported the id= option */
|
||||
static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
|
||||
{
|
||||
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
|
||||
index 574709e..b2820f0 100644
|
||||
--- a/src/qemu/qemu_conf.h
|
||||
+++ b/src/qemu/qemu_conf.h
|
||||
@@ -220,6 +220,9 @@ char * qemuBuildNicStr(virDomainNetDefPtr net,
|
||||
char * qemuBuildNicDevStr(virDomainNetDefPtr net,
|
||||
int vlan);
|
||||
|
||||
+char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
|
||||
+ unsigned long long qemudCmdFlags);
|
||||
+
|
||||
/* Both legacy & current support */
|
||||
char *qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
||||
int bootable,
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index 0189dcf..7d2f3ef 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -6552,11 +6552,13 @@ cleanup:
|
||||
|
||||
static int qemudDomainChangeEjectableMedia(struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
- virDomainDiskDefPtr disk)
|
||||
+ virDomainDiskDefPtr disk,
|
||||
+ unsigned long long qemuCmdFlags)
|
||||
{
|
||||
virDomainDiskDefPtr origdisk = NULL;
|
||||
int i;
|
||||
int ret;
|
||||
+ char *driveAlias = NULL;
|
||||
|
||||
origdisk = NULL;
|
||||
for (i = 0 ; i < vm->def->ndisks ; i++) {
|
||||
@@ -6594,6 +6596,9 @@ static int qemudDomainChangeEjectableMedia(struct qemud_driver *driver,
|
||||
driver->securityDriver->domainSetSecurityImageLabel(vm, disk) < 0)
|
||||
return -1;
|
||||
|
||||
+ if (!(driveAlias = qemuDeviceDriveHostAlias(origdisk, qemuCmdFlags)))
|
||||
+ goto error;
|
||||
+
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (disk->src) {
|
||||
@@ -6605,10 +6610,10 @@ static int qemudDomainChangeEjectableMedia(struct qemud_driver *driver,
|
||||
format = origdisk->driverType;
|
||||
}
|
||||
ret = qemuMonitorChangeMedia(priv->mon,
|
||||
- origdisk->info.alias,
|
||||
+ driveAlias,
|
||||
disk->src, format);
|
||||
} else {
|
||||
- ret = qemuMonitorEjectMedia(priv->mon, origdisk->info.alias);
|
||||
+ ret = qemuMonitorEjectMedia(priv->mon, driveAlias);
|
||||
}
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
@@ -6625,11 +6630,14 @@ static int qemudDomainChangeEjectableMedia(struct qemud_driver *driver,
|
||||
disk->src = NULL;
|
||||
origdisk->type = disk->type;
|
||||
|
||||
+ VIR_FREE(driveAlias);
|
||||
+
|
||||
virDomainDiskDefFree(disk);
|
||||
|
||||
return ret;
|
||||
|
||||
error:
|
||||
+ VIR_FREE(driveAlias);
|
||||
if (driver->securityDriver &&
|
||||
driver->securityDriver->domainRestoreSecurityImageLabel &&
|
||||
driver->securityDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
|
||||
@@ -7434,7 +7442,9 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
|
||||
switch (dev->data.disk->device) {
|
||||
case VIR_DOMAIN_DISK_DEVICE_CDROM:
|
||||
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
|
||||
- ret = qemudDomainChangeEjectableMedia(driver, vm, dev->data.disk);
|
||||
+ ret = qemudDomainChangeEjectableMedia(driver, vm,
|
||||
+ dev->data.disk,
|
||||
+ qemuCmdFlags);
|
||||
if (ret == 0)
|
||||
dev->data.disk = NULL;
|
||||
break;
|
|
@ -0,0 +1,26 @@
|
|||
commit b7a7b3365145f6e9e434a3265a58666cd2e6d8dd
|
||||
Author: Guido Günther <agx@sigxcpu.org>
|
||||
Date: Wed Mar 17 21:04:11 2010 +0100
|
||||
|
||||
Don't crash without a security driver
|
||||
|
||||
"virsh dominfo <vm>" crashes if there's no primary security driver set
|
||||
since we only intialize the secmodel.model and secmodel.doi if we have
|
||||
one. Attached patch checks for securityPrimaryDriver instead of
|
||||
securityDriver since the later is always set in qemudSecurityInit().
|
||||
|
||||
Closes: http://bugs.debian.org/574359
|
||||
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index 1f2b11d..257f914 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -4979,7 +4979,7 @@ static int qemudNodeGetSecurityModel(virConnectPtr conn,
|
||||
int ret = 0;
|
||||
|
||||
qemuDriverLock(driver);
|
||||
- if (!driver->securityDriver) {
|
||||
+ if (!driver->securityPrimaryDriver) {
|
||||
memset(secmodel, 0, sizeof (*secmodel));
|
||||
goto cleanup;
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
commit 74c7a3463d18a530d6d749d0199061b5d3f17faa
|
||||
Author: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Tue May 11 14:44:34 2010 -0400
|
||||
|
||||
node_device: udev: Fix PCI product/vendor swappage
|
||||
|
||||
Product and vendor values were swapped in the XML, which made virt-manager
|
||||
PCI device listing kinda useless.
|
||||
|
||||
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
||||
index bcfe991..4a9d65f 100644
|
||||
--- a/src/node_device/node_device_udev.c
|
||||
+++ b/src/node_device/node_device_udev.c
|
||||
@@ -382,8 +382,8 @@ static int udevTranslatePCIIds(unsigned int vendor,
|
||||
|
||||
/* pci_get_strings returns void */
|
||||
pci_get_strings(&m,
|
||||
- &vendor_name,
|
||||
&device_name,
|
||||
+ &vendor_name,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
commit 75d88455f54088f88bc7a503da0a4cd413ef7b95
|
||||
Author: Klaus Ethgen <Klaus@Ethgen.de>
|
||||
Date: Tue Apr 27 09:20:47 2010 +0200
|
||||
|
||||
The base used for conversion of USB values should be 16 not 10.
|
||||
|
||||
Signed-off-by: Guido Günther <agx@sigxcpu.org>
|
||||
|
||||
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
||||
index b12a49e..3a5a7e2 100644
|
||||
--- a/src/node_device/node_device_udev.c
|
||||
+++ b/src/node_device/node_device_udev.c
|
||||
@@ -548,8 +548,6 @@ out:
|
||||
}
|
||||
|
||||
|
||||
-/* XXX Is 10 the correct base for the Number/Class/SubClass/Protocol
|
||||
- * conversions? */
|
||||
static int udevProcessUSBInterface(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
@@ -559,28 +557,28 @@ static int udevProcessUSBInterface(struct udev_device *device,
|
||||
if (udevGetUintSysfsAttr(device,
|
||||
"bInterfaceNumber",
|
||||
&data->usb_if.number,
|
||||
- 10) == PROPERTY_ERROR) {
|
||||
+ 16) == PROPERTY_ERROR) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (udevGetUintSysfsAttr(device,
|
||||
"bInterfaceClass",
|
||||
&data->usb_if._class,
|
||||
- 10) == PROPERTY_ERROR) {
|
||||
+ 16) == PROPERTY_ERROR) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (udevGetUintSysfsAttr(device,
|
||||
"bInterfaceSubClass",
|
||||
&data->usb_if.subclass,
|
||||
- 10) == PROPERTY_ERROR) {
|
||||
+ 16) == PROPERTY_ERROR) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (udevGetUintSysfsAttr(device,
|
||||
"bInterfaceProtocol",
|
||||
&data->usb_if.protocol,
|
||||
- 10) == PROPERTY_ERROR) {
|
||||
+ 16) == PROPERTY_ERROR) {
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
commit e984019688509605966c03cd77f4591d2cc222d3
|
||||
Author: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Fri Apr 30 18:14:35 2010 +0200
|
||||
|
||||
domain: Fix PCI address decimal parsing regression
|
||||
|
||||
<hostdev> address parsing previously attempted to detect the number
|
||||
base: currently it is hardcoded to base 16, which can break PCI
|
||||
assignment via virt-manager. Revert to the previous behavior.
|
||||
|
||||
* src/conf/domain_conf.c: virDomainDevicePCIAddressParseXML, switch to
|
||||
virStrToLong_ui(bus, NULL, 0, ...) to autodetect base
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 1607e8b..546ddf2 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -1079,28 +1079,28 @@ virDomainDevicePCIAddressParseXML(xmlNodePtr node,
|
||||
function = virXMLPropString(node, "function");
|
||||
|
||||
if (domain &&
|
||||
- virStrToLong_ui(domain, NULL, 16, &addr->domain) < 0) {
|
||||
+ virStrToLong_ui(domain, NULL, 0, &addr->domain) < 0) {
|
||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Cannot parse <address> 'domain' attribute"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (bus &&
|
||||
- virStrToLong_ui(bus, NULL, 16, &addr->bus) < 0) {
|
||||
+ virStrToLong_ui(bus, NULL, 0, &addr->bus) < 0) {
|
||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Cannot parse <address> 'bus' attribute"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (slot &&
|
||||
- virStrToLong_ui(slot, NULL, 16, &addr->slot) < 0) {
|
||||
+ virStrToLong_ui(slot, NULL, 0, &addr->slot) < 0) {
|
||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Cannot parse <address> 'slot' attribute"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (function &&
|
||||
- virStrToLong_ui(function, NULL, 16, &addr->function) < 0) {
|
||||
+ virStrToLong_ui(function, NULL, 0, &addr->function) < 0) {
|
||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Cannot parse <address> 'function' attribute"));
|
||||
goto cleanup;
|
|
@ -0,0 +1,108 @@
|
|||
commit 83be64034a0b530c904ceb4fd1ed1c10b5cdf4bf
|
||||
Author: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Mon May 17 10:15:53 2010 -0400
|
||||
|
||||
qemu: Report cmdline output if VM dies early
|
||||
|
||||
qemuReadLogOutput early VM death detection is racy and won't always work.
|
||||
Startup then errors when connecting to the VM monitor. This won't report
|
||||
the emulator cmdline output which is typically the most useful diagnostic.
|
||||
|
||||
Check if the VM has died at the very end of the monitor connection step,
|
||||
and if so, report the cmdline output.
|
||||
|
||||
See also: https://bugzilla.redhat.com/show_bug.cgi?id=581381
|
||||
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index ab6bec8..582fdee 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -2034,39 +2034,47 @@ static void qemudFreePtyPath(void *payload, const char *name ATTRIBUTE_UNUSED)
|
||||
VIR_FREE(payload);
|
||||
}
|
||||
|
||||
+static void
|
||||
+qemuReadLogFD(int logfd, char *buf, int maxlen, int off)
|
||||
+{
|
||||
+ int ret;
|
||||
+ char *tmpbuf = buf + off;
|
||||
+
|
||||
+ ret = saferead(logfd, tmpbuf, maxlen - off - 1);
|
||||
+ if (ret < 0) {
|
||||
+ ret = 0;
|
||||
+ }
|
||||
+
|
||||
+ tmpbuf[ret] = '\0';
|
||||
+}
|
||||
+
|
||||
static int
|
||||
qemudWaitForMonitor(struct qemud_driver* driver,
|
||||
virDomainObjPtr vm, off_t pos)
|
||||
{
|
||||
- char buf[4096]; /* Plenty of space to get startup greeting */
|
||||
+ char buf[4096] = ""; /* Plenty of space to get startup greeting */
|
||||
int logfd;
|
||||
int ret = -1;
|
||||
+ virHashTablePtr paths = NULL;
|
||||
|
||||
- if ((logfd = qemudLogReadFD(driver->logDir, vm->def->name, pos))
|
||||
- < 0)
|
||||
+ if ((logfd = qemudLogReadFD(driver->logDir, vm->def->name, pos)) < 0)
|
||||
return -1;
|
||||
|
||||
- ret = qemudReadLogOutput(vm, logfd, buf, sizeof(buf),
|
||||
- qemudFindCharDevicePTYs,
|
||||
- "console", 30);
|
||||
- if (close(logfd) < 0) {
|
||||
- char ebuf[4096];
|
||||
- VIR_WARN(_("Unable to close logfile: %s"),
|
||||
- virStrerror(errno, ebuf, sizeof ebuf));
|
||||
- }
|
||||
-
|
||||
- if (ret < 0)
|
||||
- return -1;
|
||||
+ if (qemudReadLogOutput(vm, logfd, buf, sizeof(buf),
|
||||
+ qemudFindCharDevicePTYs,
|
||||
+ "console", 30) < 0)
|
||||
+ goto closelog;
|
||||
|
||||
VIR_DEBUG("Connect monitor to %p '%s'", vm, vm->def->name);
|
||||
- if (qemuConnectMonitor(driver, vm) < 0)
|
||||
- return -1;
|
||||
+ if (qemuConnectMonitor(driver, vm) < 0) {
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
|
||||
/* Try to get the pty path mappings again via the monitor. This is much more
|
||||
* reliable if it's available.
|
||||
* Note that the monitor itself can be on a pty, so we still need to try the
|
||||
* log output method. */
|
||||
- virHashTablePtr paths = virHashCreate(0);
|
||||
+ paths = virHashCreate(0);
|
||||
if (paths == NULL) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
@@ -2087,6 +2095,23 @@ cleanup:
|
||||
virHashFree(paths, qemudFreePtyPath);
|
||||
}
|
||||
|
||||
+ if (kill(vm->pid, 0) == -1 && errno == ESRCH) {
|
||||
+ /* VM is dead, any other error raised in the interim is probably
|
||||
+ * not as important as the qemu cmdline output */
|
||||
+ qemuReadLogFD(logfd, buf, sizeof(buf), strlen(buf));
|
||||
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("process exited while connecting to monitor: %s"),
|
||||
+ buf);
|
||||
+ ret = -1;
|
||||
+ }
|
||||
+
|
||||
+closelog:
|
||||
+ if (close(logfd) < 0) {
|
||||
+ char ebuf[4096];
|
||||
+ VIR_WARN(_("Unable to close logfile: %s"),
|
||||
+ virStrerror(errno, ebuf, sizeof ebuf));
|
||||
+ }
|
||||
+
|
||||
return ret;
|
||||
}
|
||||
|
24
libvirt.spec
24
libvirt.spec
|
@ -169,7 +169,7 @@
|
|||
Summary: Library providing a simple API virtualization
|
||||
Name: libvirt
|
||||
Version: 0.7.7
|
||||
Release: 3%{?dist}%{?extra_release}
|
||||
Release: 4%{?dist}%{?extra_release}
|
||||
License: LGPLv2+
|
||||
Group: Development/Libraries
|
||||
Source: http://libvirt.org/sources/libvirt-%{version}.tar.gz
|
||||
|
@ -179,6 +179,16 @@ Patch1: %{name}-%{version}-fix-usb-product.patch
|
|||
Patch2: %{name}-%{version}-set-kernel-perms.patch
|
||||
# Fix slow storage volume allocation (bz 582356)
|
||||
Patch3: %{name}-%{version}-fix-slow-dsync.patch
|
||||
# Fix nodedev XML conversion errors (bz 591262)
|
||||
Patch4: %{name}-%{version}-nodedev-conversions.patch
|
||||
# Fix PCI xml decimal parsing (bz 582752)
|
||||
Patch5: %{name}-%{version}-pci-decimal-parsing.patch
|
||||
# Fix CDROM media connect/eject (bz 582005)
|
||||
Patch6: %{name}-%{version}-fix-cdrom-change.patch
|
||||
# Always report qemu startup output on error (bz 581381)
|
||||
Patch7: %{name}-%{version}-qemu-startup-output.patch
|
||||
# Fix crash from 'virsh dominfo' if secdriver disabled (bz 581166)
|
||||
Patch8: %{name}-%{version}-no-secdriver-crash.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
URL: http://libvirt.org/
|
||||
BuildRequires: python-devel
|
||||
|
@ -403,6 +413,11 @@ of recent versions of Linux (and other OSes).
|
|||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
|
||||
%build
|
||||
%if ! %{with_xen}
|
||||
|
@ -824,6 +839,13 @@ fi
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue May 18 2010 Cole Robinson <crobinso@redhat.com> - 0.7.7-4.fc13
|
||||
- Fix nodedev XML conversion errors (bz 591262)
|
||||
- Fix PCI xml decimal parsing (bz 582752)
|
||||
- Fix CDROM media connect/eject (bz 582005)
|
||||
- Always report qemu startup output on error (bz 581381)
|
||||
- Fix crash from 'virsh dominfo' if secdriver disabled (bz 581166)
|
||||
|
||||
* Tue Apr 20 2010 Cole Robinson <crobinso@redhat.com> - 0.7.7-3.fc13
|
||||
- Fix slow storage volume allocation (bz 582356)
|
||||
|
||||
|
|
Loading…
Reference in New Issue