Change in vdsm[master]: caps: Modify memory units of numa node
by fromani@redhat.com
Francesco Romani has posted comments on this change.
Change subject: caps: Modify memory units of numa node
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit http://gerrit.ovirt.org/27399
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibf59a940395cc9d6134503826552fe16053a76f8
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xiaolei Shi <xiao-lei.shi(a)hp.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: Xiaolei Shi <xiao-lei.shi(a)hp.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
10 years
Change in vdsm[master]: caps: Repair collect numa information
by fromani@redhat.com
Francesco Romani has posted comments on this change.
Change subject: caps: Repair collect numa information
......................................................................
Patch Set 6: Code-Review-1
(1 comment)
mostly OK, just one note and -1 only for visibility.
http://gerrit.ovirt.org/#/c/27090/6/vdsm/caps.py
File vdsm/caps.py:
Line 223: memDict
minor nit:
please consider
memInfo = utils.readMemInfo()
return {
'total': str(memInfo['MemTotal'] / 1024),
'free': str(memInfo['MemFree'] / 1024)}
please also check the possible rounding oddities, e.g what if the host have 3.5 GiB of RAM? (not sure it is possible on recent/decent boxes) - avoid float if it is possible, if you address this.
--
To view, visit http://gerrit.ovirt.org/27090
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb70231c81e75d29107f4ea89367aa33d8e85bad
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xiaolei Shi <xiao-lei.shi(a)hp.com>
Gerrit-Reviewer: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Gilad Chaplik <gchaplik(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: Xiaolei Shi <xiao-lei.shi(a)hp.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
10 years
Change in vdsm[master]: sampling: Collect numa related statistics
by fromani@redhat.com
Francesco Romani has posted comments on this change.
Change subject: sampling: Collect numa related statistics
......................................................................
Patch Set 5: Code-Review-1
(9 comments)
A few comments, -1 only for visibility.
http://gerrit.ovirt.org/#/c/26876/5/vdsm/virt/sampling.py
File vdsm/virt/sampling.py:
Line 127: A sample of the CPU consumption of each core
Line 128:
Line 129: The sample is taken at initialization time and can't be updated.
Line 130: """
Line 131: CPU_CORE_STATS_PATTERN = re.compile(r'cpu(\d+)\s+(.*)')
Any chance to get rid of this? Just asking, probably not but it is worth to try... :\
Line 132:
Line 133: def __init__(self):
Line 134: self._coresSample = {}
Line 135: with open('/proc/stat') as src:
Line 142: coreSample['user'] = user
Line 143: coreSample['userNice'] = userNice
Line 144: coreSample['sys'] = sys
Line 145: coreSample['idle'] = idle
Line 146: self._coresSample[match.group(1)] = coreSample
minor note: I'd prefer the literal syntax here:
user, userNice, sys, idle = \
map(int, match.group(2).split()[0:4])
self._coresSample[match.group(1)] = {
'user': user,
'userNice': userNice,
'sys': sys,
'idle': idle
}
also, it is preferred to leverage the open-bracket than the continuation mark:
user, userNice, sys, idle = map(
int, match.group(2).split()[0:4])
(and yes, in retrospect getNumaTopology should have been changed as well... but it is not a big deal however).
Line 147:
Line 148: def getCoreSample(self, coreId):
Line 149: strCoreId = str(coreId)
Line 150: if strCoreId in self._coresSample:
Line 158: The sample is taken at initialization time and can't be updated.
Line 159: """
Line 160: def __init__(self):
Line 161: self._nodesMemSample = {}
Line 162: numaTopology = caps._getNumaTopology()
See the comment below, this is probably a candidate to be made public.
Line 163: for nodeIndex in numaTopology:
Line 164: nodeMemSample = {}
Line 165: if len(numaTopology) < 2:
Line 166: memInfo = caps._getUMAHostMemoryStats()
Line 164: nodeMemSample = {}
Line 165: if len(numaTopology) < 2:
Line 166: memInfo = caps._getUMAHostMemoryStats()
Line 167: else:
Line 168: memInfo = caps._getMemoryStatsByNumaCell(int(nodeIndex))
All those caps functions (caps._get*) have a leading underscore, yet we are using them from a different module. I'd like to either have them "public" or, better, to add a public helper to provide the right 'meminfo' result given the memory topology (UMA vs NUMA).
Line 169: nodeMemSample['memFree'] = memInfo['free']
Line 170: nodeMemSample['memPercent'] = 100 - \
Line 171: int(100.0 * int(memInfo['free']) / int(memInfo['total']))
Line 172: self._nodesMemSample[nodeIndex] = nodeMemSample
Line 168: memInfo = caps._getMemoryStatsByNumaCell(int(nodeIndex))
Line 169: nodeMemSample['memFree'] = memInfo['free']
Line 170: nodeMemSample['memPercent'] = 100 - \
Line 171: int(100.0 * int(memInfo['free']) / int(memInfo['total']))
Line 172: self._nodesMemSample[nodeIndex] = nodeMemSample
minor nit: same as above:
if len(numaTopology) < 2:
memInfo = caps._getUMAHostMemoryStats()
else:
memInfo = caps._getMemoryStatsByNumaCell(int(nodeIndex))
self._nodesMemSample[nodeIndex] = {
'memFree': memInfo['free'],
'memPercent': 100 - int(
100.0 * int(memInfo['free']) / int(memInfo['total']))
}
Line 173:
Line 174:
Line 175: class PidCpuSample:
Line 176: """
Line 538:
Line 539: if self._boot_time():
Line 540: stats['bootTime'] = self._boot_time()
Line 541:
Line 542: stats['numaNodeMemFree'] = hs1.numaNodeMem._nodesMemSample
same here for this 'private' field; most often accessing a leading underscore field is a code smell, if possible I'd like to respect the proper interface.
Line 543: stats['cpuStatistics'] = self._getCpuCoresStats()
Line 544: return stats
Line 545:
Line 546: def _getCpuCoresStats(self):
Line 552: """
Line 553: cpuCoreStats = {}
Line 554: numaTopology = caps._getNumaTopology()
Line 555: for nodeIndex in numaTopology:
Line 556: cpuCores = numaTopology[nodeIndex]['cpus']
_getNumaTopology() returns a dict, and apparently we are just interested on its values here. Then 'numaTopology' may be elided, while we need 'nodeIndex' below. So please consider the following:
for nodeIndex, numaNode in caps._getNumaTopology().iteritems():
cpuCores = numaNode['cpus']
Line 557: for cpuCore in cpuCores:
Line 558: coreStat = {}
Line 559: coreStat['nodeIndex'] = int(nodeIndex)
Line 560: hs0, hs1 = self._samples[0], self._samples[-1]
Line 564: (2 ** 32)
Line 565: coreStat['cpuUser'] = ("%.2f" % (jiffies / interval))
Line 566: jiffies = (hs1.cpuCores.getCoreSample(cpuCore)['sys'] -
Line 567: hs0.cpuCores.getCoreSample(cpuCore)['sys']) % \
Line 568: (2 ** 32)
To see the same code twice is usually the threshold to extract an helper. Can it be done here?
Line 569: coreStat['cpuSys'] = ("%.2f" % (jiffies / interval))
Line 570: coreStat['cpuIdle'] = ("%.2f" %
Line 571: max(0.0, 100.0 -
Line 572: float(coreStat['cpuUser']) -
Line 570: coreStat['cpuIdle'] = ("%.2f" %
Line 571: max(0.0, 100.0 -
Line 572: float(coreStat['cpuUser']) -
Line 573: float(coreStat['cpuSys'])))
Line 574: cpuCoreStats[str(cpuCore)] = coreStat
same not as above as the usage of the dict, please see above
Line 575: return cpuCoreStats
Line 576:
Line 577: def _getInterfacesStats(self):
Line 578: """
--
To view, visit http://gerrit.ovirt.org/26876
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib8d2edd74b8b5d5d3d3e508afc3f675037a86597
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xiaolei Shi <xiao-lei.shi(a)hp.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Gilad Chaplik <gchaplik(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: Xiaolei Shi <xiao-lei.shi(a)hp.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
10 years
Change in vdsm[ovirt-3.4]: hsm: move domainStateCallback to HSM
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: hsm: move domainStateCallback to HSM
......................................................................
hsm: move domainStateCallback to HSM
It seems that the garbage collector is not fast enough to clear the
callback per-pool that we added in commit:
7e30615 sp: update domain links on state change
This different approach will allow us to add only one callback (per
HSM) and forward the event to the current connected pools.
Change-Id: I7509aced432dfa77dbec727d57f507d1a9c550b7
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
2 files changed, 11 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/27478/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 7e4dc15..21a0002 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -37,6 +37,7 @@
import types
import math
import stat
+from weakref import proxy
from vdsm.config import config
import sp
@@ -399,6 +400,11 @@
monitorInterval = config.getint('irs', 'sd_health_check_delay')
self.domainMonitor = domainMonitor.DomainMonitor(monitorInterval)
+ self._domainStateCallback = partial(
+ HSM._onDomainStateChange, proxy(self))
+ self.domainMonitor.onDomainStateChange.register(
+ self._domainStateCallback)
+
@property
def ready(self):
return self._ready
@@ -411,6 +417,10 @@
"""
self.domainStateChangeCallbacks.add(callbackFunc)
+ def _onDomainStateChange(self, sdUUID, isValid):
+ for pool in self.pools.values():
+ pool.domainStateChangeEvent(sdUUID, isValid)
+
def _hsmSchedule(self, name, func, *args):
self.taskMng.scheduleJob("hsm", self.tasksDir, vars.task,
name, func, *args)
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 4d6a487..3d7ab55 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -104,10 +104,6 @@
self.domainMonitor = domainMonitor
self._upgradeCallback = partial(StoragePool._upgradePoolDomain,
proxy(self))
- self._domainStateCallback = partial(
- StoragePool._domainStateChange, proxy(self))
- self.domainMonitor.onDomainStateChange.register(
- self._domainStateCallback)
self._backend = None
def __is_secure__(self):
@@ -141,7 +137,7 @@
def getBackend(self):
return self._backend
- def _domainStateChange(self, sdUUID, isValid):
+ def domainStateChangeEvent(self, sdUUID, isValid):
if isValid and sdUUID in self.getDomains():
self._refreshDomainLinks(sdCache.produce(sdUUID))
--
To view, visit http://gerrit.ovirt.org/27478
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7509aced432dfa77dbec727d57f507d1a9c550b7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
10 years
Change in vdsm[master]: caps: Add selinux enforcement reporting.
by dkuznets@redhat.com
Dima Kuznetsov has uploaded a new change for review.
Change subject: caps: Add selinux enforcement reporting.
......................................................................
caps: Add selinux enforcement reporting.
Added selinuxEnforceModed field to getVdsCaps() what indicates whether
selinux is enforced on host or not
Change-Id: I98e0fcb71e831a76c4584bca46dc58fc4298180f
Signed-off-by: Dima Kuznetsov <dkuznets(a)redhat.com>
---
M vdsm/caps.py
M vdsm_api/vdsmapi-schema.json
2 files changed, 25 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/26951/1
diff --git a/vdsm/caps.py b/vdsm/caps.py
index 3636228..597c3ed 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -32,6 +32,7 @@
import libvirt
import rpm
+import selinux
from vdsm.config import config
from vdsm import libvirtconnection
@@ -390,6 +391,20 @@
return platform.machine()
+def getSELinuxEnforceMode():
+ selinux_mnts = ['/sys/fs/selinux', '/selinux']
+ for mnt in selinux_mnts:
+ enforce_path = os.path.join(mnt, 'enforce')
+ if not os.path.exists(enforce_path):
+ continue
+
+ with open(enforce_path) as fileStream:
+ return int(fileStream.read().strip())
+
+ # Assume disabled if cannot find
+ return -1
+
+
def get():
targetArch = getTargetArch()
@@ -459,6 +474,10 @@
caps['numaNodeDistance'] = _getNumaNodeDistance()
caps['autoNumaBalancing'] = _getAutoNumaBalancingInfo()
+ if selinux.is_selinux_enabled() == 0:
+ caps['selinuxEnforceMode'] = str(-1)
+ else:
+ caps['selinuxEnforceMode'] = getSELinuxEnforceMode()
return caps
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 6571cb7..5ef5cbe 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -1112,7 +1112,10 @@
#
# @autoNumaBalancing: The status of auto numa balancing function
#
-# Since: 4.10.0
+# @selinuxEnforceMode: The mode of enforcement of SELinux policies on the
+# host.
+#
+# Since: 4.15.0
#
# Notes: Since ovirt-engine cannot parse software versions in 'x.y.z' format,
# the current API truncates @software_version to 'x.y'.
@@ -1134,7 +1137,8 @@
'guestOverhead': 'uint', 'netConfigDirty': 'bool',
'rngSources': ['VmRngDeviceSource'], 'numaNodes': 'NumaNodeMap',
'numaNodeDistance': 'NumaNodeDistanceMap',
- 'autoNumaBalancing': 'AutoNumaBalancingStatus'}}
+ 'autoNumaBalancing': 'AutoNumaBalancingStatus',
+ 'selinuxEnforceMode': 'int'}}
##
# @Host.getCapabilities:
--
To view, visit http://gerrit.ovirt.org/26951
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I98e0fcb71e831a76c4584bca46dc58fc4298180f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <dkuznets(a)redhat.com>
10 years
Change in vdsm[master]: sourcerouting: fix _getRoute not to include local routes
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: sourcerouting: fix _getRoute not to include local routes
......................................................................
sourcerouting: fix _getRoute not to include local routes
_getRoute, a method used to find the routes of a vdsm created table
in Dynamic Source Routing was listing the routes of the table and
matching by device, the problem is that such matching would wrongly
include local scope routes. Having such route would generate an
IPRoute2 exception when removing routes and rules would never be
removed, thus leaving behind trash in the rule list.
Change-Id: I5b3d43c8a2077e40b8b4314f02ea17bc3968c42b
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M vdsm/network/sourceroute.py
1 file changed, 2 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/27262/1
diff --git a/vdsm/network/sourceroute.py b/vdsm/network/sourceroute.py
index 17773a3..5e3fb5e 100644
--- a/vdsm/network/sourceroute.py
+++ b/vdsm/network/sourceroute.py
@@ -112,20 +112,14 @@
@staticmethod
def _getRoutes(table, device):
routes = []
- for entry in routeShowTable(table):
+ for entry in routeShowTable('all'):
try:
route = Route.fromText(entry)
except ValueError:
logging.debug("Could not parse route %s" % entry)
else:
- if route.device == device:
- """
- When displaying routes from a table, the table is omitted,
- so add it back again
- """
- route.table = table
+ if route.table == table:
routes.append(route)
-
return routes
@staticmethod
--
To view, visit http://gerrit.ovirt.org/27262
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b3d43c8a2077e40b8b4314f02ea17bc3968c42b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
10 years
Change in vdsm[ovirt-3.4]: sp: update domain links on state change
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: sp: update domain links on state change
......................................................................
sp: update domain links on state change
In some situations (e.g. after a reconstructMaster command) the
domain links may be missing and it's impossible to recreate them
on connectStoragePool or refreshStoragePool since the storage may
be unreachable. The best we can do is recreate them as soon as
the domains are visible again.
This patch has been submitted to the ovirt-3.4 branch only because it's not the long-term solution that instead should be delivered by BZ#1093924.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1086210
Relates-To: https://bugzilla.redhat.com/show_bug.cgi?id=1093924
Change-Id: I7ac20e4b515472b24c35b2cccd2ad3dc98b3574c
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 8 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/27466/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 1a87e84..4d6a487 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -104,6 +104,10 @@
self.domainMonitor = domainMonitor
self._upgradeCallback = partial(StoragePool._upgradePoolDomain,
proxy(self))
+ self._domainStateCallback = partial(
+ StoragePool._domainStateChange, proxy(self))
+ self.domainMonitor.onDomainStateChange.register(
+ self._domainStateCallback)
self._backend = None
def __is_secure__(self):
@@ -137,6 +141,10 @@
def getBackend(self):
return self._backend
+ def _domainStateChange(self, sdUUID, isValid):
+ if isValid and sdUUID in self.getDomains():
+ self._refreshDomainLinks(sdCache.produce(sdUUID))
+
def _upgradePoolDomain(self, sdUUID, isValid):
# This method is called everytime the onDomainStateChange
# event is emitted, this event is emitted even when a domain goes
--
To view, visit http://gerrit.ovirt.org/27466
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ac20e4b515472b24c35b2cccd2ad3dc98b3574c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
10 years