mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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