Kiril Nesenko has uploaded a new change for review.

Change subject: Suggest using filters if there are more than 10 hosts.
......................................................................

Suggest using filters if there are more than 10 hosts.

Suggest using filters if there are more than 10 hypervisors
 to collect from.

Added:
* MAX_WARN_HOSTS_COUNT - to define max hypervisors count.

Change-Id: I05fad1b52c1672b45d0199091cb60b9642581621
Signed-off-by: Kiril Nesenko <knese...@redhat.com>
---
M src/__main__.py
1 file changed, 30 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-log-collector 
refs/changes/85/20485/1

diff --git a/src/__main__.py b/src/__main__.py
index 3bf2cac..1e0542e 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -46,6 +46,7 @@
 PGPASS_FILE_ADMIN_LINE = "DB ADMIN credentials"
 DEFAULT_SCRATCH_DIR = None  # Will be initialized by __main__
 SSH_SERVER_ALIVE_INTERVAL = 600
+MAX_WARN_HOSTS_COUNT = 10
 
 #{Logging system
 STREAM_LOG_FORMAT = '%(levelname)s: %(message)s'
@@ -1172,17 +1173,38 @@
         hosts = self.conf.get("hosts")
 
         if hosts:
-            if not self.conf.get("quiet"):
-                continue_ = get_from_prompt(
-                    msg="About to collect information from %d hypervisors. \
-Continue? (Y/n): " % len(hosts),
-                    default='y'
+            # Check if there are more than MAX_WARN_HOSTS_COUNT hosts to 
collect from
+            _max_warn_hosts = False
+            if len(hosts) >= MAX_WARN_HOSTS_COUNT:
+                _max_warn_hosts = True
+                logging.warning(
+                    _("{number} hypervisors detected. It might take some time 
to "
+                      "collect logs from {number} hypervisors. You can use the 
following "
+                      "filters -c, -d, -H. "
+                      "For more information use -h option".format(
+                      number=len(hosts),
+                      ))
                 )
-
-                if continue_ not in ('y', 'Y'):
-                    logging.info("Aborting hypervisor collection...")
+                _continue = get_from_prompt(msg="Do you want to proceed(Y/N)",
+                                            default='y')
+                if _continue not in ('Y', 'y'):
+                    logging.info(
+                        _("Aborting hypervisor collection...")
+                    )
                     return
 
+            if not self.conf.get("quiet"):
+                if not _max_warn_hosts:
+                    continue_ = get_from_prompt(
+                        msg="About to collect information from %d hypervisors. 
\
+    Continue? (Y/n): " % len(hosts),
+                        default='y'
+                    )
+
+                    if continue_ not in ('y', 'Y'):
+                        logging.info("Aborting hypervisor collection...")
+                        return
+
             logging.info("Gathering information from selected hypervisors...")
 
             max_connections = self.conf.get("max_connections", 10)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05fad1b52c1672b45d0199091cb60b9642581621
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-log-collector
Gerrit-Branch: master
Gerrit-Owner: Kiril Nesenko <knese...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to