From 4dd0b950833d000413f69d7c8a90b3311b67f4ba Mon Sep 17 00:00:00 2001 From: Asias He Date: Thu, 24 Sep 2015 09:28:21 +0800 Subject: [PATCH 1/4] rpm: Fix build in centos container mock will call /usr/sbin/mock, but we need /usr/bin/mock. Signed-off-by: Pekka Enberg --- dist/redhat/build_rpm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/redhat/build_rpm.sh b/dist/redhat/build_rpm.sh index 1184a4b..63b7df1 100755 --- a/dist/redhat/build_rpm.sh +++ b/dist/redhat/build_rpm.sh @@ -18,4 +18,4 @@ cp dist/redhat/scylla-jmx.spec.in $RPMBUILD/SPECS/scylla-jmx.spec sed -i -e "s/@@VERSION@@/$SCYLLA_VERSION/g" $RPMBUILD/SPECS/scylla-jmx.spec sed -i -e "s/@@RELEASE@@/$SCYLLA_RELEASE/g" $RPMBUILD/SPECS/scylla-jmx.spec rpmbuild -bs --define "_topdir $RPMBUILD" -ba $RPMBUILD/SPECS/scylla-jmx.spec -mock rebuild --resultdir=`pwd`/build/rpms $RPMBUILD/SRPMS/scylla-jmx-$VERSION*.src.rpm +/usr/bin/mock rebuild --resultdir=`pwd`/build/rpms $RPMBUILD/SRPMS/scylla-jmx-$VERSION*.src.rpm From 86ae0a38a95a8efbc35b022187a0256b2eeb04fa Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Thu, 24 Sep 2015 12:34:42 +0000 Subject: [PATCH 2/4] dist: check hostname is resolvable Warning for #6 Signed-off-by: Takuya ASADA [ penberg: edit warning text ] Signed-off-by: Pekka Enberg --- dist/redhat/scylla-jmx.spec.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dist/redhat/scylla-jmx.spec.in b/dist/redhat/scylla-jmx.spec.in index 9bbf899..ce69d87 100644 --- a/dist/redhat/scylla-jmx.spec.in +++ b/dist/redhat/scylla-jmx.spec.in @@ -38,6 +38,15 @@ install -m755 dist/redhat/scripts/* $RPM_BUILD_ROOT%{_prefix}/lib/scylla/jmx %pre /usr/sbin/groupadd scylla 2> /dev/null || : /usr/sbin/useradd -g scylla -s /sbin/nologin -r -d ${_sharedstatedir}/scylla scylla 2> /dev/null || : +ping -c1 `hostname` > /dev/null 2>&1 +if [ $? -ne 0 ]; then +echo +echo "**************************************************************" +echo "* WARNING: You need to add hostname on /etc/hosts, otherwise *" +echo "* scylla-jmx will not able to start up. *" +echo "**************************************************************" +echo +fi %post %systemd_post scylla-jmx.service From f035be44356293690a059a5dcc589e54c5eca549 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Thu, 24 Sep 2015 14:56:40 +0000 Subject: [PATCH 3/4] dist: does not need maven for running time Signed-off-by: Takuya ASADA Signed-off-by: Pekka Enberg --- dist/redhat/scylla-jmx.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/redhat/scylla-jmx.spec.in b/dist/redhat/scylla-jmx.spec.in index ce69d87..ec3dd3e 100644 --- a/dist/redhat/scylla-jmx.spec.in +++ b/dist/redhat/scylla-jmx.spec.in @@ -10,7 +10,7 @@ Source0: %{name}-@@VERSION@@-@@RELEASE@@.tar BuildArch: noarch BuildRequires: maven java-1.8.0-openjdk-devel systemd-units -Requires: maven java-1.8.0-openjdk scylla-server +Requires: java-1.8.0-openjdk scylla-server %description From d67e6e60fc920143472836e292cda3634ddbe6e0 Mon Sep 17 00:00:00 2001 From: Amnon Heiman Date: Tue, 29 Sep 2015 09:28:59 +0300 Subject: [PATCH 4/4] EndPointSnitchInfo: Support null as host name In origin an undocumented feature (bug?) is that passing null as a host name for getRack and getDatacenter returns the rack or datacenter according to the loopbck address. This follow the same behaviour, so when the host is null, the function will not fail but will call the API with the local loopback address Signed-off-by: Amnon Heiman Signed-off-by: Pekka Enberg --- .../org/apache/cassandra/locator/EndpointSnitchInfo.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/apache/cassandra/locator/EndpointSnitchInfo.java b/src/main/java/org/apache/cassandra/locator/EndpointSnitchInfo.java index 1639bbc..b34250e 100644 --- a/src/main/java/org/apache/cassandra/locator/EndpointSnitchInfo.java +++ b/src/main/java/org/apache/cassandra/locator/EndpointSnitchInfo.java @@ -18,6 +18,7 @@ package org.apache.cassandra.locator; import java.lang.management.ManagementFactory; +import java.net.InetAddress; import java.net.UnknownHostException; import javax.management.MBeanServer; @@ -63,6 +64,9 @@ public class EndpointSnitchInfo implements EndpointSnitchInfoMBean { public String getRack(String host) throws UnknownHostException { log("getRack(String host) throws UnknownHostException"); MultivaluedMap queryParams = new MultivaluedMapImpl(); + if (host == null) { + host = InetAddress.getLoopbackAddress().getHostAddress(); + } queryParams.add("host", host); return c.getStringValue("/snitch/rack", queryParams); } @@ -77,6 +81,9 @@ public class EndpointSnitchInfo implements EndpointSnitchInfoMBean { public String getDatacenter(String host) throws UnknownHostException { log(" getDatacenter(String host) throws UnknownHostException"); MultivaluedMap queryParams = new MultivaluedMapImpl(); + if (host == null) { + host = InetAddress.getLoopbackAddress().getHostAddress(); + } queryParams.add("host", host); return c.getStringValue("/snitch/datacenter", queryParams); }