Skip to content

Commit

Permalink
add dc suffix to resolved dc
Browse files Browse the repository at this point in the history
  • Loading branch information
smiklosovic committed Jul 13, 2023
1 parent 2e092b4 commit c66e655
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/java/org/apache/cassandra/locator/AzureSnitch.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public AzureSnitch(SnitchProperties properties) throws IOException

public AzureSnitch(AzureCloudConnector connector, SnitchProperties properties) throws IOException
{
super(connector, properties, resolveDcAndRack(connector));
super(connector, properties, resolveDcAndRack(connector, properties));
}

private static Pair<String, String> resolveDcAndRack(AzureCloudConnector connector) throws IOException
private static Pair<String, String> resolveDcAndRack(AzureCloudConnector connector, SnitchProperties properties) throws IOException
{
String response = connector.getResponse();
JsonNode jsonNode = JsonUtils.JSON_OBJECT_MAPPER.readTree(response);
Expand All @@ -60,7 +60,9 @@ private static Pair<String, String> resolveDcAndRack(AzureCloudConnector connect
if (location == null || location.isNull() || location.asText().isEmpty())
datacenter = DEFAULT_DC;
else
{
datacenter = location.asText();
}

if (zone == null || zone.isNull() || zone.asText().isEmpty())
{
Expand All @@ -78,7 +80,7 @@ private static Pair<String, String> resolveDcAndRack(AzureCloudConnector connect
rack = zone.asText();
}

return Pair.create(datacenter, "rack-" + rack);
return Pair.create(datacenter + properties.getDcSuffix(), "rack-" + rack);
}

static class AzureCloudConnector extends AbstractCloudMetadataServiceConnector
Expand Down

0 comments on commit c66e655

Please sign in to comment.