Blame SOURCES/0020-v2v-Add-some-assertions-to-check-the-source-was-crea.patch

0d20ef
From d977ec8b1df84f390c5932f35feeb249baa7050b Mon Sep 17 00:00:00 2001
0d20ef
From: "Richard W.M. Jones" <rjones@redhat.com>
0d20ef
Date: Wed, 22 Oct 2014 12:35:53 +0100
0d20ef
Subject: [PATCH] v2v: Add some assertions to check the source was created
0d20ef
 correctly.
0d20ef
0d20ef
(cherry picked from commit dbe35729a3fbb7150275584dd0c5aa7d86c8e03e)
0d20ef
---
0d20ef
 v2v/v2v.ml | 11 +++++++++++
0d20ef
 1 file changed, 11 insertions(+)
0d20ef
0d20ef
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
0d20ef
index 6f98a8c..48fb8c6 100644
0d20ef
--- a/v2v/v2v.ml
0d20ef
+++ b/v2v/v2v.ml
0d20ef
@@ -73,6 +73,17 @@ let rec main () =
0d20ef
 
0d20ef
   if verbose then printf "%s%!" (string_of_source source);
0d20ef
 
0d20ef
+  assert (source.s_dom_type <> "");
0d20ef
+  assert (source.s_name <> "");
0d20ef
+  assert (source.s_memory > 0L);
0d20ef
+  assert (source.s_vcpu >= 1);
0d20ef
+  if source.s_disks = [] then
0d20ef
+    error (f_"source has no hard disks!");
0d20ef
+  List.iter (
0d20ef
+    fun disk ->
0d20ef
+      assert (disk.s_qemu_uri <> "");
0d20ef
+  ) source.s_disks;
0d20ef
+
0d20ef
   (* Map source name. *)
0d20ef
   let source =
0d20ef
     match output_name with
0d20ef
-- 
0d20ef
1.8.3.1
0d20ef