[PATCH 5/5] event: add hard disk dropping event reason enum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START
---
 include/libvirt/libvirt.h.in |  1 +
 src/qemu/qemu_domain.c       | 18 +++++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index f6a7aff..72df5a2 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -4603,6 +4603,7 @@ typedef void (*virConnectDomainEventBlockJobCallback)(virConnectPtr conn,
  */
 typedef enum {
     VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START = 0, /* oldSrcPath is set */
+    VIR_DOMAIN_EVENT_HARDDISK_DROP_MISSING_ON_START = 1,
 
 #ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_EVENT_DISK_CHANGE_LAST
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4594b2c..7ce8b1d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1907,22 +1907,30 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
                   "due to inaccessible source '%s'",
                   disk->dst, def->name, uuid, disk->src);
 
-        event = virDomainEventDiskChangeNewFromObj(vm, disk->src, NULL, disk->info.alias,
-                                                   VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START);
-        if (event)
-            qemuDomainEventQueue(driver, event);
-
         /* For CDROM and Floppy disk, only drop source path.
          * For Hard disk, drop its definition.
          */
         if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ||
             disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
+
+            event = virDomainEventDiskChangeNewFromObj(vm, disk->src, NULL,
+                                                       disk->info.alias,
+                                                       VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START);
+            if (event)
+                qemuDomainEventQueue(driver, event);
+
             VIR_FREE(disk->src);
             nextDisk++;
         } else {
             if (bitmap && disk->info.bootIndex)
                 ignore_value(virBitmapSetBit(bitmap, disk->info.bootIndex - 1));
 
+            event = virDomainEventDiskChangeNewFromObj(vm, disk->src, NULL,
+                                                       disk->info.alias,
+                                                       VIR_DOMAIN_EVENT_HARDDISK_DROP_MISSING_ON_START);
+            if (event)
+                qemuDomainEventQueue(driver, event);
+
             virDomainDiskDefFree(disk);
             if (VIR_DELETE_ELEMENT(def->disks, nextDisk, def->ndisks) < 0)
                 goto cleanup;
-- 
1.7.11.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]