This is an automated email from the ASF dual-hosted git repository. jiajunwang pushed a commit to branch helix-0.9.x in repository https://gitbox.apache.org/repos/asf/helix.git
commit 03b8511d30dbcd4d6b09c238f0ba3eaf1e4fcee0 Author: Meng Zhang <[email protected]> AuthorDate: Wed Sep 2 23:02:16 2020 -0700 Return "name" field as VM name in Azure environment (#1340) * Return name field as VM name in Azure envrionment * fix comment * fix test --- .../src/main/java/org/apache/helix/HelixCloudProperty.java | 8 ++++---- .../azure/AzureCloudInstanceInformationProcessor.java | 14 +++++++------- .../org/apache/helix/manager/zk/ParticipantManager.java | 4 ++-- .../cloud/TestAzureCloudInstanceInformationProcessor.java | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/helix-core/src/main/java/org/apache/helix/HelixCloudProperty.java b/helix-core/src/main/java/org/apache/helix/HelixCloudProperty.java index 554c595..6cbc2e1 100644 --- a/helix-core/src/main/java/org/apache/helix/HelixCloudProperty.java +++ b/helix-core/src/main/java/org/apache/helix/HelixCloudProperty.java @@ -37,7 +37,7 @@ public class HelixCloudProperty { private static final Logger LOG = LoggerFactory.getLogger(HelixCloudProperty.class.getName()); private static final String AZURE_CLOUD_PROPERTY_FILE = SystemPropertyKeys.AZURE_CLOUD_PROPERTIES; private static final String CLOUD_INFO_SOURCE = "cloud_info_source"; - private static final String CLOUD_INFO_PROCESSFOR_NAME = "cloud_info_processor_name"; + private static final String CLOUD_INFO_PROCESSOR_NAME = "cloud_info_processor_name"; private static final String CLOUD_MAX_RETRY = "cloud_max_retry"; private static final String CONNECTION_TIMEOUT_MS = "connection_timeout_ms"; private static final String REQUEST_TIMEOUT_MS = "request_timeout_ms"; @@ -74,7 +74,7 @@ public class HelixCloudProperty { * @param */ public HelixCloudProperty(CloudConfig cloudConfig) { - setCloudEndabled(cloudConfig.isCloudEnabled()); + setCloudEnabled(cloudConfig.isCloudEnabled()); if (cloudConfig.isCloudEnabled()) { setCloudId(cloudConfig.getCloudID()); setCloudProvider(cloudConfig.getCloudProvider()); @@ -93,7 +93,7 @@ public class HelixCloudProperty { LOG.info("Successfully loaded Helix Azure cloud properties: {}", azureProperties); setCloudInfoSources( Collections.singletonList(azureProperties.getProperty(CLOUD_INFO_SOURCE))); - setCloudInfoProcessorName(azureProperties.getProperty(CLOUD_INFO_PROCESSFOR_NAME)); + setCloudInfoProcessorName(azureProperties.getProperty(CLOUD_INFO_PROCESSOR_NAME)); setCloudMaxRetry(Integer.valueOf(azureProperties.getProperty(CLOUD_MAX_RETRY))); setCloudConnectionTimeout(Long.valueOf(azureProperties.getProperty(CONNECTION_TIMEOUT_MS))); setCloudRequestTimeout(Long.valueOf(azureProperties.getProperty(REQUEST_TIMEOUT_MS))); @@ -145,7 +145,7 @@ public class HelixCloudProperty { return _customizedCloudProperties; } - public void setCloudEndabled(boolean isCloudEnabled) { + public void setCloudEnabled(boolean isCloudEnabled) { _isCloudEnabled = isCloudEnabled; } diff --git a/helix-core/src/main/java/org/apache/helix/cloud/azure/AzureCloudInstanceInformationProcessor.java b/helix-core/src/main/java/org/apache/helix/cloud/azure/AzureCloudInstanceInformationProcessor.java index c943664..b11e943 100644 --- a/helix-core/src/main/java/org/apache/helix/cloud/azure/AzureCloudInstanceInformationProcessor.java +++ b/helix-core/src/main/java/org/apache/helix/cloud/azure/AzureCloudInstanceInformationProcessor.java @@ -48,15 +48,15 @@ public class AzureCloudInstanceInformationProcessor LoggerFactory.getLogger(AzureCloudInstanceInformationProcessor.class); private final CloseableHttpClient _closeableHttpClient; private final HelixCloudProperty _helixCloudProperty; - private final String COMPUTE = "compute"; - private final String INSTANCE_NAME = "vmId"; - private final String DOMAIN = "platformFaultDomain"; - private final String INSTANCE_SET_NAME = "vmScaleSetName"; + private static final String COMPUTE = "compute"; + private static final String INSTANCE_NAME = "name"; + private static final String DOMAIN = "platformFaultDomain"; + private static final String INSTANCE_SET_NAME = "vmScaleSetName"; public AzureCloudInstanceInformationProcessor(HelixCloudProperty helixCloudProperty) { _helixCloudProperty = helixCloudProperty; - RequestConfig requestConifg = RequestConfig.custom() + RequestConfig requestConfig = RequestConfig.custom() .setConnectionRequestTimeout((int) helixCloudProperty.getCloudRequestTimeout()) .setConnectTimeout((int) helixCloudProperty.getCloudConnectionTimeout()).build(); @@ -69,7 +69,7 @@ public class AzureCloudInstanceInformationProcessor }; //TODO: we should regularize the way how httpClient should be used throughout Helix. e.g. Helix-rest could also use in the same way - _closeableHttpClient = HttpClients.custom().setDefaultRequestConfig(requestConifg) + _closeableHttpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig) .setRetryHandler(httpRequestRetryHandler).build(); } @@ -153,7 +153,7 @@ public class AzureCloudInstanceInformationProcessor } } catch (IOException e) { throw new HelixException( - String.format("Error in parsing cloud instance information: %s", response, e)); + String.format("Error in parsing cloud instance information: %s", response), e); } return azureCloudInstanceInformation; } diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java index 7063c20..bdf820f 100644 --- a/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java +++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java @@ -143,7 +143,7 @@ public class ParticipantManager { boolean autoJoin = false; boolean autoRegistration = false; - // Read "allowParticipantAutoJoin" flag to see if an instance can auto join to the cluster + // Read "allowParticipantAutoJoin" field to see if an instance can auto join to the cluster try { HelixConfigScope scope = new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER) .forCluster(_manager.getClusterName()).build(); @@ -160,7 +160,7 @@ public class ParticipantManager { try { autoRegistration = Boolean.valueOf(_helixManagerProperty.getHelixCloudProperty().getCloudEnabled()); - LOG.info("instance: " + _instanceName + " auto-register " + _clusterName + " is " + LOG.info("instance: " + _instanceName + " auto-registering " + _clusterName + " is " + autoRegistration); } catch (Exception e) { LOG.info("auto registration is false for cluster" + _clusterName); diff --git a/helix-core/src/test/java/org/apache/helix/cloud/TestAzureCloudInstanceInformationProcessor.java b/helix-core/src/test/java/org/apache/helix/cloud/TestAzureCloudInstanceInformationProcessor.java index 350c9a9..4bad9d7 100644 --- a/helix-core/src/test/java/org/apache/helix/cloud/TestAzureCloudInstanceInformationProcessor.java +++ b/helix-core/src/test/java/org/apache/helix/cloud/TestAzureCloudInstanceInformationProcessor.java @@ -64,6 +64,6 @@ public class TestAzureCloudInstanceInformationProcessor extends MockHttpClient { Assert.assertEquals( azureCloudInstanceInformation .get(CloudInstanceInformation.CloudInstanceField.INSTANCE_NAME.name()), - "d2b921cc-c16c-41f7-a86d-a445eac6ec26"); + "test-helix_1"); } }
