Blame SOURCES/0035-v2v-o-rhv-upload-tell-whether-a-SD-actually-exists.patch

da373f
From e7b94193f29d7a2715a860deb6db0708eef8c107 Mon Sep 17 00:00:00 2001
3efd08
From: Pino Toscano <ptoscano@redhat.com>
3efd08
Date: Fri, 13 Sep 2019 12:40:34 +0200
3efd08
Subject: [PATCH] v2v: -o rhv-upload: tell whether a SD actually exists
3efd08
3efd08
If there is no DC with the specified storage domain attached to it, it
3efd08
can mean that the SD does not exist.
3efd08
3efd08
(cherry picked from commit 2b39c27b7f1e72f3a3bf3a616e4576af691beb88)
3efd08
---
3efd08
 v2v/rhv-upload-precheck.py | 9 +++++++++
3efd08
 1 file changed, 9 insertions(+)
3efd08
3efd08
diff --git a/v2v/rhv-upload-precheck.py b/v2v/rhv-upload-precheck.py
3efd08
index 725a8dc9e..1b344ba27 100644
3efd08
--- a/v2v/rhv-upload-precheck.py
3efd08
+++ b/v2v/rhv-upload-precheck.py
3efd08
@@ -66,6 +66,15 @@ data_centers = system_service.data_centers_service().list(
3efd08
     case_sensitive=True,
3efd08
 )
3efd08
 if len(data_centers) == 0:
3efd08
+    storage_domains = system_service.storage_domains_service().list(
3efd08
+        search='name=%s' % params['output_storage'],
3efd08
+        case_sensitive=True,
3efd08
+    )
3efd08
+    if len(storage_domains) == 0:
3efd08
+        # The storage domain does not even exist.
3efd08
+        raise RuntimeError("The storage domain ā€˜%sā€™ does not exist" %
3efd08
+                           (params['output_storage']))
3efd08
+
3efd08
     # The storage domain is not attached to a datacenter
3efd08
     # (shouldn't happen, would fail on disk creation).
3efd08
     raise RuntimeError("The storage domain ā€˜%sā€™ is not attached to a DC" %
3efd08
-- 
da373f
2.18.4
3efd08