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

37 lines
1.3 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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