Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit de17a3f

Browse files
committed
fix(bigtable): rely on metadata from afes for connectivity error
1 parent a1bd39a commit de17a3f

4 files changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.google.cloud.bigtable.data.v2.internal.dp;
2+
3+
public class DirectAccessInvestigator {
4+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.google.cloud.bigtable.data.v2.internal.dp;
2+
3+
import com.google.common.annotations.VisibleForTesting;
4+
import java.io.IOException;
5+
import java.nio.charset.StandardCharsets;
6+
import java.nio.file.Files;
7+
import java.nio.file.Paths;
8+
9+
class GCECheck {
10+
private static final String GCE_PRODUCTION_NAME_PRIOR_2016 = "Google";
11+
private static final String GCE_PRODUCTION_NAME_AFTER_2016 = "Google Compute Engine";
12+
13+
@VisibleForTesting
14+
static String systemProductName = null;
15+
16+
static boolean isRunningOnGCP() {
17+
String osName = System.getProperty("os.name");
18+
if ("Linux".equals(osName)) {
19+
String productName = getSystemProductName();
20+
return productName.contains(GCE_PRODUCTION_NAME_PRIOR_2016)
21+
|| productName.contains(GCE_PRODUCTION_NAME_AFTER_2016);
22+
}
23+
return false;
24+
}
25+
26+
private static String getSystemProductName() {
27+
if (systemProductName != null) {
28+
return systemProductName;
29+
}
30+
try {
31+
return new String(
32+
Files.readAllBytes(Paths.get("/sys/class/dmi/id/product_name")),
33+
StandardCharsets.UTF_8).trim();
34+
} catch (IOException e) {
35+
return "";
36+
}
37+
}
38+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.google.cloud.bigtable.data.v2.internal.dp;
2+
3+
public class LoopbackInterface {
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.google.cloud.bigtable.data.v2.internal.dp;
2+
3+
public class MetadataServer {
4+
}

0 commit comments

Comments
 (0)