diff options
author | Harald Musum <musum@yahoo-inc.com> | 2017-11-28 14:38:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-28 14:38:41 +0100 |
commit | 8e520ad2893804df314aeff2138cb7ed243b8378 (patch) | |
tree | 69c2b67ce26e0fcf8216f8426bfbd6eaec4ccaef | |
parent | 94aeae9252acbfa519739d0a13ecf789cf7b0a71 (diff) | |
parent | 5b0fef5a317e7022af6f22203fa2fff6384f139c (diff) |
Merge pull request #4297 from vespa-engine/hmusum/rename-element-to-disable-filedistributor
Rename element to disable filedistributor
6 files changed, 13 insertions, 14 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/FileDistributionOptions.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/FileDistributionOptions.java index 0160978773d..8b39a1ecb94 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/admin/FileDistributionOptions.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/FileDistributionOptions.java @@ -21,7 +21,7 @@ public class FileDistributionOptions implements FiledistributorConfig.Producer { private BinaryScaledAmount uploadBitRate = new BinaryScaledAmount(); private BinaryScaledAmount downloadBitRate = new BinaryScaledAmount(); - private boolean disabled = false; + private boolean disableFiledistributor = false; public void downloadBitRate(BinaryScaledAmount amount) { @@ -34,12 +34,12 @@ public class FileDistributionOptions implements FiledistributorConfig.Producer { uploadBitRate = amount; } - public void disabled(boolean value) { - disabled = value; + public void disableFiledistributor(boolean value) { + disableFiledistributor = value; } - public boolean disabled() { - return disabled; + public boolean disableFiledistributor() { + return disableFiledistributor; } private void ensureNonNegative(BinaryScaledAmount amount) { diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminBuilderBase.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminBuilderBase.java index 3e825c3912a..c2ba2efac71 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminBuilderBase.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminBuilderBase.java @@ -80,7 +80,7 @@ public abstract class DomAdminBuilderBase extends VespaDomBuilder.DomConfigProdu new ModelConfigProvider(admin); FileDistributionOptions fileDistributionOptions = FileDistributionOptions.defaultOptions(); - fileDistributionOptions.disabled(disableFiledistributor); + fileDistributionOptions.disableFiledistributor(disableFiledistributor); fileDistributionOptions = new DomFileDistributionOptionsBuilder(fileDistributionOptions).build(XML.getChild(adminElement, "filedistribution")); admin.setFileDistribution(new FileDistributionConfigProducer.Builder(fileDistributionOptions).build(parent, fileRegistry)); return admin; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomFileDistributionOptionsBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomFileDistributionOptionsBuilder.java index 90d71f186ae..9cbdd00899b 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomFileDistributionOptionsBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomFileDistributionOptionsBuilder.java @@ -43,8 +43,9 @@ public class DomFileDistributionOptionsBuilder { getAmount("uploadbitrate", fileDistributionElement).ifPresent(fileDistributionOptions::uploadBitRate); getAmount("downloadbitrate", fileDistributionElement).ifPresent(fileDistributionOptions::downloadBitRate); Element disable = XML.getChild(fileDistributionElement, "disabled"); + if (disable == null) disable = XML.getChild(fileDistributionElement, "disableFiledistributor"); if (disable != null) { - fileDistributionOptions.disabled(Boolean.valueOf(XML.getValue(disable))); + fileDistributionOptions.disableFiledistributor(Boolean.valueOf(XML.getValue(disable))); } } return fileDistributionOptions; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributorService.java b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributorService.java index dd9e057e2fa..7616b721be9 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributorService.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributorService.java @@ -55,7 +55,7 @@ public class FileDistributorService extends AbstractService implements @Override public String getStartupCommand() { // If disabled config proxy should act as file distributor, so don't start this service - return (fileDistributionOptions.disabled()) + return (fileDistributionOptions.disableFiledistributor()) ? null : "exec $ROOT/sbin/vespa-filedistributor" + " --configid " + getConfigId(); } @@ -91,7 +91,7 @@ public class FileDistributorService extends AbstractService implements @Override public void getConfig(FiledistributorrpcConfig.Builder builder) { // If disabled config proxy should act as file distributor, so use config proxy port - int port = (fileDistributionOptions.disabled()) ? 19090 : getRelativePort(0); + int port = (fileDistributionOptions.disableFiledistributor()) ? 19090 : getRelativePort(0); builder.connectionspec("tcp/" + getHostName() + ":" + port); } diff --git a/config-model/src/main/resources/schema/admin.rnc b/config-model/src/main/resources/schema/admin.rnc index b7ec252c4d7..f787335d735 100644 --- a/config-model/src/main/resources/schema/admin.rnc +++ b/config-model/src/main/resources/schema/admin.rnc @@ -81,7 +81,8 @@ LogServer = element logserver { FileDistribution = element filedistribution { element uploadbitrate { xsd:string { pattern = "\d+(\.\d*)?\s*[kmgKMG]?" } }? & element downloadbitrate { xsd:string { pattern = "\d+(\.\d*)?\s*[kmgKMG]?" } }? & - element disabled { xsd:boolean }? # Nov. 2017: Temporary, should not be documented + element disabled { xsd:boolean }? & # Nov. 2017: Temporary, should not be documented, can be removed as soon as no config model is using it + element disableFiledistributor { xsd:boolean }? # Nov. 2017: Temporary, should not be documented } Metrics = element metrics { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/admin/AdminTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/admin/AdminTestCase.java index d8bf40ac2d8..fed9000f72b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/admin/AdminTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/admin/AdminTestCase.java @@ -8,7 +8,6 @@ import com.yahoo.cloud.config.SentinelConfig; import com.yahoo.config.model.ApplicationConfigProducerRoot; import com.yahoo.config.model.deploy.DeployProperties; import com.yahoo.config.model.deploy.DeployState; -import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.config.model.test.TestDriver; import com.yahoo.config.model.test.TestRoot; import com.yahoo.config.provision.ApplicationId; @@ -24,11 +23,9 @@ import com.yahoo.vespa.model.container.component.Component; import com.yahoo.vespa.model.container.component.StatisticsComponent; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; -import org.junit.Ignore; import org.junit.Test; import java.util.Set; -import java.util.stream.IntStream; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; @@ -288,7 +285,7 @@ public class AdminTestCase { " <admin version='2.0'>" + " <adminserver hostalias='node0' />" + " <filedistribution>" + - " <disabled>true</disabled>" + + " <disableFiledistributor>true</disableFiledistributor>" + " </filedistribution>" + " </admin>" + "</services>"; |