From 68fa9195a4e0d8265ae36be7b4fe638751dca930 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Wed, 8 Feb 2012 23:20:45 +0000 Subject: [PATCH] List all types of MSG brokers, in the returned list prefer stomp+ssl. --- org.glite.lb.logger-msg/Makefile | 2 +- .../project/glite-lb-logger-msg.spec | 2 +- .../src/{msg-brokers-openwire => msg-brokers} | 18 ++++++++++++++++-- org.glite.lb.yaim/config/functions/config_glite_lb.in | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) rename org.glite.lb.logger-msg/src/{msg-brokers-openwire => msg-brokers} (94%) diff --git a/org.glite.lb.logger-msg/Makefile b/org.glite.lb.logger-msg/Makefile index 206eee1..df397eb 100644 --- a/org.glite.lb.logger-msg/Makefile +++ b/org.glite.lb.logger-msg/Makefile @@ -106,7 +106,7 @@ install: ${INSTALL} -m 755 ${EXAMPLES} ${DESTDIR}${PREFIX}${prefix}/${libdir}/glite-lb/examples ( cd ${top_srcdir}/project && ${INSTALL} -m 644 ChangeLog package.description package.summary ${DESTDIR}${PREFIX}${prefix}/share/doc/${package}-${version} ) ${INSTALL} -m 644 ${top_srcdir}/config/msg.conf.example ${DESTDIR}${PREFIX}${sysconfdir}/glite-lb - ${INSTALL} -m 755 ${top_srcdir}/src/msg-brokers-openwire ${DESTDIR}${PREFIX}${prefix}/share/glite-lb + ${INSTALL} -m 755 ${top_srcdir}/src/msg-brokers ${DESTDIR}${PREFIX}${prefix}/share/glite-lb %.lo %.o: %.cpp ${COMPILEXX} -c $< -o $@ diff --git a/org.glite.lb.logger-msg/project/glite-lb-logger-msg.spec b/org.glite.lb.logger-msg/project/glite-lb-logger-msg.spec index e7eba67..6a34124 100644 --- a/org.glite.lb.logger-msg/project/glite-lb-logger-msg.spec +++ b/org.glite.lb.logger-msg/project/glite-lb-logger-msg.spec @@ -63,7 +63,7 @@ rm -rf $RPM_BUILD_ROOT /usr/share/doc/%{name}-%{version}/LICENSE /usr/share/doc/%{name}-%{version}/package.summary /usr/share/doc/%{name}-%{version}/package.description -/usr/share/glite-lb/msg-brokers-openwire +/usr/share/glite-lb/* %changelog diff --git a/org.glite.lb.logger-msg/src/msg-brokers-openwire b/org.glite.lb.logger-msg/src/msg-brokers similarity index 94% rename from org.glite.lb.logger-msg/src/msg-brokers-openwire rename to org.glite.lb.logger-msg/src/msg-brokers index 017a033..74a3dc5 100755 --- a/org.glite.lb.logger-msg/src/msg-brokers-openwire +++ b/org.glite.lb.logger-msg/src/msg-brokers @@ -166,11 +166,12 @@ sub search_bdii ($%) { sub list_brokers ($) { my($ldap, %search, $endpoint, $match, $network, $value, @uris); + my($proto,%uris); my($check) = @_; $ldap = connect_bdii(); %search = ( - filter => "(&(objectClass=GlueService)(GlueServiceType=msg.broker.openwire)", + filter => "(&(objectClass=GlueService)(GlueServiceType=msg.broker.*)", attrs => [ qw(GlueServiceEndpoint GlueServiceUniqueID) ], ); $search{filter} .= "(GlueServiceStatus=OK)" if ($check); @@ -191,12 +192,25 @@ sub list_brokers ($) { } $value = $endpoint->get_value("GlueServiceEndpoint"); if ($match) { - push(@uris, $value); + $proto = ''; + if ($value =~ /^([^:]*):\/\/.*/) { $proto = $1; } + push(@{$uris{$proto}}, $value); debug(2, " keep URI %s", $value); } else { debug(2, " skip URI %s", $value); } } + + foreach $proto ('stomp+ssl', 'openwire+ssl', 'stomp', 'openwire') { + if (exists $uris{$proto}) { + push(@uris,@{$uris{$proto}}); + delete $uris{$proto}; + } + } + foreach $proto (keys %uris) { + push(@uris,@{$uris{$proto}}); + } + debug(1, "got %d broker URIs from BDII", scalar(@uris)); warning("got an empty brokers list from BDII") unless @uris; return(@uris); diff --git a/org.glite.lb.yaim/config/functions/config_glite_lb.in b/org.glite.lb.yaim/config/functions/config_glite_lb.in index cb65dca..3e64a00 100644 --- a/org.glite.lb.yaim/config/functions/config_glite_lb.in +++ b/org.glite.lb.yaim/config/functions/config_glite_lb.in @@ -311,7 +311,7 @@ EOF rm -f "$GLITE_LB_LOCATION_ETC/glite-lb/msg.conf" else if [ "$GLITE_LB_MSG_BROKER" = 'true' -o "$GLITE_LB_MSG_BROKER" = 'auto' -o -z "$GLITE_LB_MSG_BROKER" ]; then - GLITE_LB_MSG_BROKER="`${GLITE_LB_LOCATION}/share/glite-lb/msg-brokers-openwire --bdii $LCG_GFAL_INFOSYS --network $GLITE_LB_MSG_NETWORK --sort find | head -n 1 | sed 's,openwire://,tcp://,'`"; + GLITE_LB_MSG_BROKER="`${GLITE_LB_LOCATION}/share/glite-lb/msg-brokers --bdii $LCG_GFAL_INFOSYS --network $GLITE_LB_MSG_NETWORK --sort find | head -n 1 | sed 's,openwire://,tcp://,'`"; fi if [ ! -z "$GLITE_LB_MSG_BROKER" ]; then cat > "$GLITE_LB_LOCATION_ETC/glite-lb/msg.conf" <