summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikanth Karthikesan <knikanth@suse.de>2010-03-17 12:44:25 +0530
committerChristophe Varoqui <christophe.varoqui@free.fr>2010-03-17 22:47:38 +0100
commit105e550743e3872fa4b82affd963af2a8387df51 (patch)
treea3843d8b8de9472d160b09d61ee24a92f7ff9655
parentb68400c7b1a1863bd606e7909b2ab3fb2df3c7b7 (diff)
downloadmultipath-tools-105e550743e3872fa4b82affd963af2a8387df51.tar.gz
multipath-tools-105e550743e3872fa4b82affd963af2a8387df51.tar.bz2
multipath-tools-105e550743e3872fa4b82affd963af2a8387df51.zip
multipath: display average priority as group priority
Display avg priority as group priority Now average priority is used as path group priority, instead of sum of priorities of the paths. But while displaying group priority, sum is being displayed. Change it to print the average priority. When there are no enabled paths, print 0 as priority. Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
-rw-r--r--libmultipath/print.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 10e5ce5..9753fe2 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -378,6 +378,7 @@ snprint_pg_selector (char * buff, size_t len, struct pathgroup * pgp)
static int
snprint_pg_pri (char * buff, size_t len, struct pathgroup * pgp)
{
+ int avg_priority = 0;
/*
* path group priority is not updated for every path prio change,
* but only on switch group code path.
@@ -385,7 +386,9 @@ snprint_pg_pri (char * buff, size_t len, struct pathgroup * pgp)
* Printing is another reason to update.
*/
path_group_prio_update(pgp);
- return snprint_int(buff, len, pgp->priority);
+ if (pgp->enabled_paths)
+ avg_priority = pgp->priority / pgp->enabled_paths;
+ return snprint_int(buff, len, avg_priority);
}
static int