Skip to content

Commit

Permalink
pool: introduce property for https mover port range
Browse files Browse the repository at this point in the history
Motivation:
in a situation where admins need to pinpoint movers to a fixed port the
HTTP and HTTPS movers were sharing the same property, thus making such
configuration impossible.

Modification:
introduce pool.mover.https.port.min and pool.mover.https.port.max, which
defaults to their http siblings. Update NettyTransferService to display
listen port in cell info output.

Result:
it's possible to run pool with a fixed ports for http and https movers.

Acked-by: Lea Morschel
Target: master
Require-book: no
Require-notes: yes
  • Loading branch information
kofemann committed Aug 10, 2023
1 parent dab3637 commit 2cbd89f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Expand Up @@ -20,6 +20,7 @@
import static com.google.common.base.Preconditions.checkState;

import com.google.common.collect.Maps;
import com.google.common.net.InetAddresses;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
Expand All @@ -31,6 +32,7 @@
import dmg.cells.nucleus.CDC;
import dmg.cells.nucleus.CellAddressCore;
import dmg.cells.nucleus.CellIdentityAware;
import dmg.cells.nucleus.CellInfoProvider;
import dmg.cells.nucleus.CellPath;
import dmg.cells.nucleus.NoRouteToCellException;
import io.netty.bootstrap.ServerBootstrap;
Expand All @@ -45,6 +47,7 @@
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.util.concurrent.GlobalEventExecutor;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -88,7 +91,7 @@
* the Netty channel to close.
*/
public abstract class NettyTransferService<P extends ProtocolInfo>
implements TransferService<NettyMover<P>>, MoverFactory, CellIdentityAware {
implements TransferService<NettyMover<P>>, MoverFactory, CellIdentityAware, CellInfoProvider {

private static final Logger LOGGER =
LoggerFactory.getLogger(NettyTransferService.class);
Expand Down Expand Up @@ -641,4 +644,11 @@ protected abstract void sendAddressToDoor(NettyMover<P> mover, InetSocketAddress
throws Exception;

protected abstract UUID createUuid(P protocolInfo);

@Override
public void getInfo(PrintWriter pw) {
CellInfoProvider.super.getInfo(pw);
var endpoint = getServerAddress();
pw.printf(" Listening on: %s:%d\n", InetAddresses.toUriString(endpoint.getAddress()), endpoint.getPort());
}
}
13 changes: 11 additions & 2 deletions modules/dcache/src/main/resources/org/dcache/pool/classic/pool.xml
Expand Up @@ -455,7 +455,7 @@

<bean id="http-transfer-service-parent" abstract="true"
class="org.dcache.http.HttpTransferService" depends-on="rep">
<description>HTTP transfer service</description>
<description>Abstract HTTP transfer service</description>
<property name="postTransferService" ref="post-transfer-service"/>
<property name="threads" value="${pool.mover.http.threads}"/>
<property name="chunkSize" value="${pool.mover.http.chunk-size}"/>
Expand All @@ -473,7 +473,9 @@
<property name="customHeaders" ref="custom-headers"/>
</bean>

<bean id="http-transfer-service" parent="http-transfer-service-parent"/>
<bean id="http-transfer-service" parent="http-transfer-service-parent">
<description>HTTP transfer service</description>
</bean>

<bean id="remote-http-transfer-service" class="org.dcache.pool.classic.RemoteHttpTransferService"
depends-on="rep" destroy-method="shutdown">
Expand Down Expand Up @@ -790,7 +792,14 @@
</bean>

<bean id="https-transfer-service" parent="http-transfer-service-parent" class="org.dcache.http.HttpsTransferService">
<description>HTTPS transfer service</description>
<property name="sslContext" ref="netty-ssl-context-builder" />
<property name="portRange">
<bean class="org.dcache.util.NettyPortRange">
<constructor-arg value="${pool.mover.https.port.min}"/>
<constructor-arg value="${pool.mover.https.port.max}"/>
</bean>
</property>
</bean>
</beans>

Expand Down
4 changes: 4 additions & 0 deletions skel/share/defaults/pool.properties
Expand Up @@ -532,6 +532,10 @@ pool.mover.http.timeout.connect = 300
pool.mover.http.port.min = ${dcache.net.wan.port.min}
pool.mover.http.port.max = ${dcache.net.wan.port.max}

# ---- HTTPS mover port range
pool.mover.https.port.min = ${pool.mover.http.port.min}
pool.mover.https.port.max = ${pool.mover.http.port.max}

# ---- FTP data channel port range
#
# Currently only used by remote FTP mover
Expand Down

0 comments on commit 2cbd89f

Please sign in to comment.