[PATCH] conf: snapshot: Don't default-snapshot empty floppy drives

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

 



If a floppy drive isn't selected for snapshot explicitly and is empty
don't try to snapshot it. For external snapshots this would fail as we
can't generate a name for the snapshot from an empty drive.

Reported-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/conf/snapshot_conf.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index c53a66b..cbaff74 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -561,7 +561,14 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def,
         if (VIR_STRDUP(disk->name, def->dom->disks[i]->dst) < 0)
             goto cleanup;
         disk->index = i;
-        disk->snapshot = def->dom->disks[i]->snapshot;
+
+        /* Don't snapshot empty floppy drives */
+        if (def->dom->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
+            !virDomainDiskGetSource(def->dom->disks[i]))
+            disk->snapshot = VIR_DOMAIN_SNAPSHOT_LOCATION_NONE;
+        else
+            disk->snapshot = def->dom->disks[i]->snapshot;
+
         disk->src->type = VIR_STORAGE_TYPE_FILE;
         if (!disk->snapshot)
             disk->snapshot = default_snapshot;
-- 
2.1.0

--
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]