mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone
Blob Blame History Raw
From be941dc3b54a4ff176a08ffdb635f6998621bbda Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 24 Apr 2016 11:33:28 +0100
Subject: [PATCH] v2v: Assert fail if we overwrite an existing disk in a bus
 slot.

Prevents us from accidentally "losing" a disk during conversion.  I
believe from code inspection that this assertion is always true for
the current code, so this should have no effect.

(cherry picked from commit 6193b2b273f603bbe7b361d858e5b2fca0082ef6)
---
 v2v/target_bus_assignment.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/v2v/target_bus_assignment.ml b/v2v/target_bus_assignment.ml
index b82915b..eb3ed58 100644
--- a/v2v/target_bus_assignment.ml
+++ b/v2v/target_bus_assignment.ml
@@ -76,6 +76,7 @@ and insert bus i slot =
     bus := Array.make (i+1) BusSlotEmpty;
     Array.blit oldbus 0 !bus 0 oldlen
   );
+  assert (!bus.(i) = BusSlotEmpty);
   Array.set !bus i slot
 
 (* Insert a slot into the bus, but if the desired slot is not empty, then
-- 
2.7.4