Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > ebe084c140192657f9094e135a84202c > files > 31

libvirt-0.8.2-29.el5.src.rpm

From a51519126deaaedd5cc8e007ab9957a9a239a6d1 Mon Sep 17 00:00:00 2001
From: Daniel P. Berrange <berrange@redhat.com>
Date: Wed, 29 Jun 2011 22:39:57 +0800
Subject: [PATCH] Fix auditing of disk hotunplug operations
To: libvir-list@redhat.com

https://bugzilla.redhat.com/show_bug.cgi?id=710151

The qemuAuditDisk calls in disk hotunplug operations were being
passed 'ret >= 0', but the code which sets ret to 0 was not yet
executed, and the error path had already jumped to the 'cleanup'
label. This meant hotunplug failures were never audited, and
hotunplug success was audited as a failure

* src/qemu/qemu_hotplug.c: Fix auditing of hotunplug
(cherry picked from commit 020342e68debddff641f70f87b5c6991c128648a)

Conflicts:

        src/qemu/qemu_hotplug.c - code lives in qemu_driver.c, and uses
        older method names

Signed-off-by: Daniel Veillard <veillard@redhat.com>
---
 src/qemu/qemu_driver.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3fa532b..3a48966 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8621,18 +8621,20 @@ static int qemudDomainDetachPciDiskDevice(struct qemud_driver *driver,
     if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
             qemuDomainObjExitMonitor(vm);
+            qemuDomainDiskAudit(vm, detach, NULL, "detach", false);
             goto cleanup;
         }
     } else {
         if (qemuMonitorRemovePCIDevice(priv->mon,
                                        &detach->info.addr.pci) < 0) {
             qemuDomainObjExitMonitor(vm);
+            qemuDomainDiskAudit(vm, detach, NULL, "detach", false);
             goto cleanup;
         }
     }
     qemuDomainObjExitMonitorWithDriver(driver, vm);
 
-    qemuDomainDiskAudit(vm, detach, NULL, "detach", ret >= 0);
+    qemuDomainDiskAudit(vm, detach, NULL, "detach", true);
 
     qemudShrinkDisks(vm->def, i);
 
@@ -8694,11 +8696,12 @@ static int qemudDomainDetachSCSIDiskDevice(struct qemud_driver *driver,
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
     if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
         qemuDomainObjExitMonitor(vm);
+        qemuDomainDiskAudit(vm, detach, NULL, "detach", false);
         goto cleanup;
     }
     qemuDomainObjExitMonitorWithDriver(driver, vm);
 
-    qemuDomainDiskAudit(vm, detach, NULL, "detach", ret >= 0);
+    qemuDomainDiskAudit(vm, detach, NULL, "detach", true);
 
     qemudShrinkDisks(vm->def, i);
 
-- 
1.7.4.4