summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2010-06-11 15:18:31 -0700
committerMohit Mehta <mohit.mehta@vyatta.com>2010-06-11 15:18:31 -0700
commitf72bec9dff2b62e9d3704676ec3a12cf1c85a09d (patch)
tree95db5953490b0bfa5ceece31777a8eae85c9ae52
parent2f5e7e7e9aa7669de5e5fb9025cb319e8b493904 (diff)
downloadvyatta-cfg-f72bec9dff2b62e9d3704676ec3a12cf1c85a09d.tar.gz
vyatta-cfg-f72bec9dff2b62e9d3704676ec3a12cf1c85a09d.zip
add function to get all configured sync-groups
-rwxr-xr-xlib/Vyatta/Keepalived.pm20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/Vyatta/Keepalived.pm b/lib/Vyatta/Keepalived.pm
index 6689f4a..dc7e71b 100755
--- a/lib/Vyatta/Keepalived.pm
+++ b/lib/Vyatta/Keepalived.pm
@@ -29,7 +29,7 @@ our @EXPORT = qw(get_conf_file get_state_script get_state_file
vrrp_log vrrp_get_init_state get_changes_file
start_daemon restart_daemon stop_daemon
vrrp_get_config list_vrrp_intf list_vrrp_group
- list_vrrp_sync_group);
+ list_vrrp_sync_group list_all_vrrp_sync_grps);
use base qw(Exporter);
use Vyatta::Config;
@@ -371,5 +371,23 @@ sub list_vrrp_sync_group {
return $sync_group;
}
+sub list_all_vrrp_sync_grps {
+ my @sync_grps = ();
+ my @vrrp_intfs = list_vrrp_intf();
+ foreach my $vrrp_intf (@vrrp_intfs) {
+ my @vrrp_groups = list_vrrp_group($vrrp_intf);
+ foreach my $vrrp_group (@vrrp_groups) {
+ my $sync_grp = list_vrrp_sync_group($vrrp_intf, $vrrp_group);
+ if (defined $sync_grp) {
+ # add to sync_grps if not already there
+ if (scalar( grep( /^$sync_grp$/, @sync_grps ) ) == 0) {
+ push (@sync_grps, $sync_grp);
+ }
+ }
+ }
+ }
+ return @sync_grps;
+}
+
1;
#end of file