Blame SOURCES/virt-manager-cli-Don-t-double-warn-when-skipping-disk-size-warnin.patch

184e0d
From 312203fe234595cedafa1505b89d88a554de1bb7 Mon Sep 17 00:00:00 2001
184e0d
In-Reply-To: <6ee28a662c511063cd5edc32b6a613aa84cff3b9.1493385541.git.phrdina@redhat.com>
184e0d
References: <6ee28a662c511063cd5edc32b6a613aa84cff3b9.1493385541.git.phrdina@redhat.com>
184e0d
From: Pavel Hrdina <phrdina@redhat.com>
184e0d
Date: Thu, 27 Apr 2017 12:19:53 -0400
184e0d
Subject: cli: Don't double warn when skipping disk size warning (bz 1433239)
184e0d
184e0d
From: Cole Robinson <crobinso@redhat.com>
184e0d
184e0d
(cherry picked from commit 7aee124d9aed7646e6e95644909c1d1005a92d07)
184e0d
184e0d
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1433239
184e0d
184e0d
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
184e0d
---
184e0d
 virtinst/cli.py | 7 ++++---
184e0d
 1 file changed, 4 insertions(+), 3 deletions(-)
184e0d
184e0d
diff --git a/virtinst/cli.py b/virtinst/cli.py
184e0d
index 5841ba33..e5097f8d 100644
184e0d
--- a/virtinst/cli.py
184e0d
+++ b/virtinst/cli.py
184e0d
@@ -359,7 +359,7 @@ def set_prompt(prompt):
184e0d
 
184e0d
 
184e0d
 def validate_disk(dev, warn_overwrite=False):
184e0d
-    def _optional_fail(msg, checkname):
184e0d
+    def _optional_fail(msg, checkname, warn_on_skip=True):
184e0d
         do_check = get_global_state().get_validation_check(checkname)
184e0d
         if do_check:
184e0d
             fail(msg + (_(" (Use --check %s=off or "
184e0d
@@ -367,7 +367,8 @@ def validate_disk(dev, warn_overwrite=False):
184e0d
 
184e0d
         logging.debug("Skipping --check %s error condition '%s'",
184e0d
             checkname, msg)
184e0d
-        logging.warn(msg)
184e0d
+        if warn_on_skip:
184e0d
+            logging.warn(msg)
184e0d
 
184e0d
     def check_path_exists(dev):
184e0d
         """
184e0d
@@ -400,7 +401,7 @@ def validate_disk(dev, warn_overwrite=False):
184e0d
         isfatal, errmsg = dev.is_size_conflict()
184e0d
         # The isfatal case should have already caused us to fail
184e0d
         if not isfatal and errmsg:
184e0d
-            _optional_fail(errmsg, "disk_size")
184e0d
+            _optional_fail(errmsg, "disk_size", warn_on_skip=False)
184e0d
 
184e0d
     def check_path_search(dev):
184e0d
         user, broken_paths = dev.check_path_search(dev.conn, dev.path)
184e0d
-- 
184e0d
2.12.2
184e0d