vdsm/0002-add-get-uuid-method-for-arm.patch
2021-10-14 14:28:59 +08:00

54 lines
1.9 KiB
Diff

From 441cda8a132876dac91bd81b26efd3057305afbb Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Wed, 13 Oct 2021 14:48:02 +0800
Subject: [PATCH] add get uuid method for arm
---
lib/vdsm/host/__init__.py | 5 +++++
lib/vdsm/osinfo.py | 6 ++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/vdsm/host/__init__.py b/lib/vdsm/host/__init__.py
index 9d529d7..fbdea70 100644
--- a/lib/vdsm/host/__init__.py
+++ b/lib/vdsm/host/__init__.py
@@ -55,6 +55,11 @@ def uuid():
host_UUID = systemId.rstrip('\0').replace(',', '')
except IOError:
logging.warning('Could not find host UUID.')
+ elif cpuarch.is_arm(arch):
+ try:
+ host_UUID = os.popen('dmidecode -s system-uuid').read().strip()
+ except KeyError:
+ logging.warning('Could not find host UUID.')
except:
logging.error("Error retrieving host UUID", exc_info=True)
diff --git a/lib/vdsm/osinfo.py b/lib/vdsm/osinfo.py
index deae299..8dccae9 100644
--- a/lib/vdsm/osinfo.py
+++ b/lib/vdsm/osinfo.py
@@ -118,6 +118,8 @@ def _release_name():
return OSName.RHEL
elif os.path.exists('/etc/debian_version'):
return OSName.DEBIAN
+ elif os.path.exists('/etc/openEuler-release'):
+ return OSName.RHEL
else:
return OSName.UNKNOWN
@@ -282,8 +284,8 @@ def package_versions():
KEY_PACKAGES[pkg])
else:
pkgs[pkg] = {
- 'version': mi['version'].decode('utf-8'),
- 'release': mi['release'].decode('utf-8'),
+ 'version': mi['version'],
+ 'release': mi['release'],
}
except Exception:
logging.error('', exc_info=True)
--
2.27.0