virt-what/0001-alibaba-cloud-Make-the...

42 lines
1.8 KiB
Diff

From 5ab6b37b29a482006aa5d9724a22be49e78e00aa Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 3 Aug 2022 17:37:23 +0000
Subject: [PATCH] alibaba-cloud: Make the test more robust
This test worked by trying to make an HTTP connection to a path under
100.100.100.200, which if successful would indicate that it's an
Alibaba cloud instance. We only try the connection if SM-BIOS
information indicates the hardware OEM is Alibaba.
However 'make check' would hang if 100.100.100.200 doesn't immediately
reject the connection. I found that GCE is such an environment where
connecting to this address would hang rather than reject. GCE does
not have Alibaba hardware of course, but when doing 'make check' we
fake dmidecode data.
Make the test more robust by only trying to connect when we know we're
not in 'make check'.
Fixes: commit b7cc3d93a613ef6d0ac5ccd6e32cc3d66e057243
(cherry picked from commit 26b2c9c5156e85a4d7b566c22cb8f13c741e3530)
---
virt-what.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt-what.in b/virt-what.in
index d56c84f65..66b2d798d 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -116,7 +116,7 @@ arch=$(uname -m | sed -e 's/i.86/i386/' | sed -e 's/arm.*/arm/')
# Check for Alibaba Cloud
if echo "$dmi" | grep -q 'Manufacturer: Alibaba'; then
# Check for Alibaba Cloud ECS Bare Metal (EBM) Instance
- if ( { echo -e "GET /latest/meta-datainstance/instance-type HTTP/1.0\r\nHost: 100.100.100.200\r\n\r" >&3; grep -sq 'ebm' <&3 ; } 3<> /dev/tcp/100.100.100.200/80 ) 2>/dev/null ; then
+ if [ "x$root" = "x" ] && ( { echo -e "GET /latest/meta-datainstance/instance-type HTTP/1.0\r\nHost: 100.100.100.200\r\n\r" >&3; grep -sq 'ebm' <&3 ; } 3<> /dev/tcp/100.100.100.200/80 ) 2>/dev/null ; then
echo "alibaba_cloud-ebm"
else
echo "alibaba_cloud"
--
2.31.1