Sandro Bonazzola has uploaded a new change for review.

Change subject: UX: more readable error message checking space
......................................................................

UX: more readable error message checking space

Changed the error message when there's not enough space
for the self hosted engine VM to be more readable.

Change-Id: I56d5e011377f6f5bd43b4c86fceb57b6e622ff9d
Bug-Url: https://bugzilla.redhat.com/1013662
Signed-off-by: Sandro Bonazzola <sbona...@redhat.com>
---
M src/ovirt_hosted_engine_setup/domains.py
M src/plugins/ovirt-hosted-engine-setup/storage/storage.py
M src/plugins/ovirt-hosted-engine-setup/vm/boot_disk.py
3 files changed, 31 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/68/19868/1

diff --git a/src/ovirt_hosted_engine_setup/domains.py 
b/src/ovirt_hosted_engine_setup/domains.py
index 8482be6..9d307a5 100644
--- a/src/ovirt_hosted_engine_setup/domains.py
+++ b/src/ovirt_hosted_engine_setup/domains.py
@@ -30,6 +30,10 @@
 _ = lambda m: gettext.dgettext(message=m, domain='ovirt-hosted-engine-setup')
 
 
+class InsufficientSpaceError(Exception):
+    """Raised when check_available_space fails"""
+
+
 @util.export
 class DomainChecker(base.Base):
     """
@@ -112,7 +116,7 @@
             )
         )
         if available_space_mb < minimum:
-            raise RuntimeError(
+            raise InsufficientSpaceError(
                 _(
                     'Error: mount point {path} contains only {available}Mb of '
                     'available space while a minimum of {minimum}Mb is '
diff --git a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py 
b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
index 51c6ca9..1adeef0 100644
--- a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
+++ b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
@@ -710,7 +710,24 @@
                         )
                     )
                 else:
-                    raise
+                    raise e
+            except ohosteddomains.InsufficientSpaceError as e:
+                self.logger.debug('exception', exc_info=True)
+                self.logger.debug(e)
+                if interactive:
+                    self.logger.error(
+                        _(
+                            'Storage domain for self hosted engine '
+                            'is too small'
+                        )
+                    )
+                else:
+                    raise RuntimeError(
+                        _(
+                            'Storage domain for self hosted engine '
+                            'is too small'
+                        )
+                    )
         if self.environment[
             ohostedcons.StorageEnv.DOMAIN_TYPE
         ] == 'nfs':
diff --git a/src/plugins/ovirt-hosted-engine-setup/vm/boot_disk.py 
b/src/plugins/ovirt-hosted-engine-setup/vm/boot_disk.py
index 70f08be..3cad02f 100644
--- a/src/plugins/ovirt-hosted-engine-setup/vm/boot_disk.py
+++ b/src/plugins/ovirt-hosted-engine-setup/vm/boot_disk.py
@@ -344,16 +344,21 @@
                     ) * 1024
                 )
                 valid = True
-            except RuntimeError as e:
+            except ohosteddomains.InsufficientSpaceError as e:
                 self.logger.debug(
                     'Error checking TMPDIR space',
                     exc_info=True,
                 )
-                self.logger.error(e)
+                self.logger.debug(e)
                 valid = False
                 if not interactive:
-                    raise e
+                    raise RuntimeError(
+                        _('Not enough space in the temporary directory')
+                    )
                 else:
+                    self.logger.error(
+                        _('Not enough space in the temporary directory')
+                    )
                     self.environment[
                         ohostedcons.CoreEnv.TEMPDIR
                     ] = self.dialog.queryString(


-- 
To view, visit http://gerrit.ovirt.org/19868
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I56d5e011377f6f5bd43b4c86fceb57b6e622ff9d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: ovirt-hosted-engine-setup-1.0
Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to