]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: hotplug: Move post-insertion steps of disk hotplug to qemuDomainAttachDeviceDis...
authorPeter Krempa <pkrempa@redhat.com>
Tue, 18 May 2021 14:11:52 +0000 (16:11 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 24 May 2021 18:38:08 +0000 (20:38 +0200)
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>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_hotplug.c

index 80ade33e1c162a873246afecd3d1b24a58feb943..f645e5ec8f167d6197fc6c7393623f7af7ea66d3 100644 (file)
@@ -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));