mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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