[PATCH 23/35] qemu: hotplug: Move post-insertion steps of disk hotplug to qemuDomainAttachDeviceDiskLiveInternal

Peter Krempa posted 35 patches 4 years, 8 months ago
[PATCH 23/35] qemu: hotplug: Move post-insertion steps of disk hotplug to qemuDomainAttachDeviceDiskLiveInternal
Posted by Peter Krempa 4 years, 8 months ago
Move the auditing entry and insertion into the disk definition from the
function which deals with qemu to 'qemuDomainAttachDeviceDiskLiveInternal'
which deals with the hotplug related specifics.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_hotplug.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index fbf4a85c23..9b7067110e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -763,9 +763,6 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver,
         goto cleanup;
     }

-    virDomainAuditDisk(vm, NULL, disk->src, "attach", true);
-
-    virDomainDiskInsert(vm->def, disk);
     ret = 0;

  cleanup:
@@ -781,7 +778,6 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver,
         qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
         ret = -2;

-    virDomainAuditDisk(vm, NULL, disk->src, "attach", false);
     goto cleanup;
 }

@@ -1040,6 +1036,13 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,

     ret = qemuDomainAttachDiskGeneric(driver, vm, disk);

+    virDomainAuditDisk(vm, NULL, disk->src, "attach", ret == 0);
+
+    if (ret < 0)
+        goto cleanup;
+
+    virDomainDiskInsert(vm->def, disk);
+
  cleanup:
     if (ret < 0) {
         ignore_value(qemuRemoveSharedDevice(driver, dev, vm->def->name));
-- 
2.31.1

Re: [PATCH 23/35] qemu: hotplug: Move post-insertion steps of disk hotplug to qemuDomainAttachDeviceDiskLiveInternal
Posted by Ján Tomko 4 years, 8 months ago
On a Friday in 2021, Peter Krempa wrote:
>Move the auditing entry and insertion into the disk definition from the
>function which deals with qemu to 'qemuDomainAttachDeviceDiskLiveInternal'
>which deals with the hotplug related specifics.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_hotplug.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano