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
Bug-Url: https://bugzilla.redhat.com/1015022
Signed-off-by: Kiril Nesenko <knese...@redhat.com>
---
M src/__main__.py
1 file changed, 31 insertions(+), 8 deletions(-)


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

diff --git a/src/__main__.py b/src/__main__.py
index 3bf2cac..90421e3 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'
@@ -1173,15 +1174,37 @@
 
         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
+                if len(hosts) >= MAX_WARN_HOSTS_COUNT:
+                    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".format(
+                              number=len(hosts),
+                          ))
+                    )
+                    _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
+                else:
+                    continue_ = get_from_prompt(
+                        msg="About to collect information from "
+                            "{len} hypervisors. Continue? (Y/n): ".format(
+                                len=len(hosts),
+                            ),
+                        default='y'
+                    )
 
-                if continue_ not in ('y', 'Y'):
-                    logging.info("Aborting hypervisor collection...")
-                    return
+                    if continue_ not in ('y', 'Y'):
+                        logging.info("Aborting hypervisor collection...")
+                        return
 
             logging.info("Gathering information from selected hypervisors...")
 


-- 
To view, visit http://gerrit.ovirt.org/20493
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: ovirt-log-collector-3.3
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