Pradipta Banerjee has uploaded a new change for review.
Change subject: Add getOSName() method in deployUtil for OS detection
......................................................................
Add getOSName() method in deployUtil for OS detection
This patch improves the current detection of whether the running
host is RHEL6 based or Fedora by adding a new method getOSName()
Change-Id: Ifff9b08902cd234dfa03292136317d50e5e3d22b
Signed-off-by: Pradipta Kr. Banerjee <bpradip(a)in.ibm.com>
---
M vds_bootstrap/vds_bootstrap.py
M vdsm_reg/deployUtil.py.in
2 files changed, 24 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/8002/1
diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py
index 537953d..c6ae08e 100755
--- a/vds_bootstrap/vds_bootstrap.py
+++ b/vds_bootstrap/vds_bootstrap.py
@@ -66,11 +66,18 @@
(LOGDIR, "phase1", strftime("%Y%m%d%H%M%S")),
filemode='w')
-rhel6based = deployUtil.versionCompare(deployUtil.getOSVersion(), "6.0") >= 0
+#Detect RHEL6 or Fedora16 as min supported version
+rhel6based = False
+fedorabased = False
+if (deployUtil.getOSName().lower() == "redhat" and
+ deployUtil.versionCompare(deployUtil.getOSVersion(), "6.0")) >= 0:
+ rhel6based = True
-# TODO this is an infra-hackish heuristic for identifying Fedora
-# drop as soon as possible
-fedorabased = deployUtil.versionCompare(deployUtil.getOSVersion(), "16") >= 0
+if (deployUtil.getOSName().lower() == "fedora" and
+ deployUtil.versionCompare(deployUtil.getOSVersion(), "16")) >= 0:
+ fedorabased = True
+
+logging.debug("fedorabased=%d rhel6based=%d", fedorabased, rhel6based)
if rhel6based:
VDSM_NAME = "vdsm"
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index bbda70e..e410e32 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -451,6 +451,19 @@
logging.debug("OS Release Ver = %s", osVer[1])
return osVer[1]
+def getOSName():
+ """
+ Return the OS Name, Fedora, Redhat etc
+
+ Return "Unknown OS" on any failure.
+ """
+
+ # platform.linux_distribution returns a tuple (distname, version, id) or
+ # default as given in args in case of any failure
+ osName = platform.linux_distribution(distname='Unknown OS', version='')
+ logging.debug("OS Name = %s", osName[0])
+ return osName[0]
+
def getKernelVR():
"""Return current kernel version and release."""
--
To view, visit http://gerrit.ovirt.org/8002
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifff9b08902cd234dfa03292136317d50e5e3d22b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Pradipta Banerjee <bpradip(a)in.ibm.com>
Greg Padgett has uploaded a new change for review.
Change subject: [WIP] api: Report hyperthreading info in getVdsCapabilities
......................................................................
[WIP] api: Report hyperthreading info in getVdsCapabilities
Report hyperthreading info in getVdsCapabilities:
cpuHtEnabled - Whether hyperthreading is enabled
reportHostThreadsAsCores - Whether vdsm is reporting threads as cores,
determined by vdsm.conf configuration setting
This information is used by ovirt-engine to help determine CPU topology
and provide support for cluster-based CPU overcommitment.
Change-Id: If6868f3947ade62dda7cb6265b0c9e50c2face94
Signed-off-by: Greg Padgett <gpadgett(a)redhat.com>
---
M vdsm/caps.py
M vdsm_api/vdsmapi-schema.json
2 files changed, 11 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/10144/1
diff --git a/vdsm/caps.py b/vdsm/caps.py
index d1297c9..07bfc28 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -253,10 +253,15 @@
cpuInfo = CpuInfo()
cpuTopology = CpuTopology()
+ caps['cpuHtEnabled'] = \
+ str(cpuTopology.threads() != cpuTopology.cores()).lower()
+
if config.getboolean('vars', 'report_host_threads_as_cores'):
caps['cpuCores'] = str(cpuTopology.threads())
+ caps['reportHostThreadsAsCores'] = 'true'
else:
caps['cpuCores'] = str(cpuTopology.cores())
+ caps['reportHostThreadsAsCores'] = 'false'
caps['cpuSockets'] = str(cpuTopology.sockets())
caps['cpuSpeed'] = cpuInfo.mhz()
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 1b1c075..30a8b8a 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -848,6 +848,8 @@
#
# @kvmEnabled: KVM is enabled on the host
#
+# @cpuHtEnabled: CPU hyperthreading is enabled on this host
+#
# @cpuCores: The number of CPU cores present
#
# @cpuSockets: The numbet of CPU sockets
@@ -857,6 +859,8 @@
# @cpuModel: The CPU model
#
# @cpuFlags: CPU feature flags (a comma-separated string)
+#
+# @reportHostThreadsAsCores: Vdsm is reporting threads as cores on this host
#
# @version_name: The name given to this version of VDSM
#
@@ -909,7 +913,8 @@
# the current API truncates @software_version to 'x.y'.
##
{'type': 'VdsmCapabilities',
- 'data': {'kvmEnabled': 'bool', 'cpuCores': 'uint',
+ 'data': {'kvmEnabled': 'bool', 'cpuHtEnabled': 'bool', 'cpuCores': 'uint',
+ 'reportHostThreadsAsCores': 'bool',
'cpuSockets': 'uint', 'cpuSpeed': 'float', 'cpuModel': 'str',
'cpuFlags': 'str', 'version_name': 'str', 'software_version': 'str',
'software_revision': 'str', 'supportedENGINEs': ['str'],
--
To view, visit http://gerrit.ovirt.org/10144
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If6868f3947ade62dda7cb6265b0c9e50c2face94
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett <gpadgett(a)redhat.com>