mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0064-v2v-Assert-fail-if-we-overwrite-an-existing-disk-in-.patch

e76f14
From be941dc3b54a4ff176a08ffdb635f6998621bbda Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Sun, 24 Apr 2016 11:33:28 +0100
e76f14
Subject: [PATCH] v2v: Assert fail if we overwrite an existing disk in a bus
e76f14
 slot.
e76f14
e76f14
Prevents us from accidentally "losing" a disk during conversion.  I
e76f14
believe from code inspection that this assertion is always true for
e76f14
the current code, so this should have no effect.
e76f14
e76f14
(cherry picked from commit 6193b2b273f603bbe7b361d858e5b2fca0082ef6)
e76f14
---
e76f14
 v2v/target_bus_assignment.ml | 1 +
e76f14
 1 file changed, 1 insertion(+)
e76f14
e76f14
diff --git a/v2v/target_bus_assignment.ml b/v2v/target_bus_assignment.ml
e76f14
index b82915b..eb3ed58 100644
e76f14
--- a/v2v/target_bus_assignment.ml
e76f14
+++ b/v2v/target_bus_assignment.ml
e76f14
@@ -76,6 +76,7 @@ and insert bus i slot =
e76f14
     bus := Array.make (i+1) BusSlotEmpty;
e76f14
     Array.blit oldbus 0 !bus 0 oldlen
e76f14
   );
e76f14
+  assert (!bus.(i) = BusSlotEmpty);
e76f14
   Array.set !bus i slot
e76f14
 
e76f14
 (* Insert a slot into the bus, but if the desired slot is not empty, then
e76f14
-- 
7af31e
1.8.3.1
e76f14