Change in vdsm[master]: xmlrpc: Parsing error logging enhancement - vdsClient
by Dan Kenigsberg
Dan Kenigsberg has posted comments on this change.
Change subject: xmlrpc: Parsing error logging enhancement - vdsClient
......................................................................
Patch Set 3: Code-Review-1
(2 comments)
....................................................
Commit Message
Line 5: CommitDate: 2013-11-04 09:44:48 +0100
Line 6:
Line 7: xmlrpc: Parsing error logging enhancement - vdsClient
Line 8:
Line 9: Logging enhancement which help to understand the issues during
English mistake stays. You should say "which helps understand the issues..."
Line 10: parsing xml response obtained from vdsm. Parsing
Line 11: issues can occur when bad characters are in xml etc.
Line 12:
Line 13: In order to get raw response we need to wrap transport class
....................................................
File lib/vdsm/vdscli.py.in
Line 40:
Line 41: def __getattr__(self, name):
Line 42: if hasattr(self._transport, name):
Line 43: func = getattr(self._transport, name)
Line 44: return lambda *args, **kwargs: self._wrap(name, func, args, kwargs)
Please answer: which method(s) is(are) expected to raise ExpatError? I'd rather be more specific and wrap only the thing we need.
Line 45: raise AttributeError(name)
Line 46:
Line 47: def _wrap(self, name, func, args, kwargs):
Line 48: try:
--
To view, visit http://gerrit.ovirt.org/20627
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ife29c4f7749b9cd8a4ad892f486d91509e505ae4
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: mooli tayer <mtayer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
9 years, 11 months
Change in vdsm[master]: libvirt is happy with redefinition of an existing nwfilter
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: libvirt is happy with redefinition of an existing nwfilter
......................................................................
libvirt is happy with redefinition of an existing nwfilter
Change-Id: Id253c66df8296613b6a2bc3fc058ef2754702964
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/tool/nwfilter.py
1 file changed, 0 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/20788/1
diff --git a/lib/vdsm/tool/nwfilter.py b/lib/vdsm/tool/nwfilter.py
index 54bbe8d..f87f975 100755
--- a/lib/vdsm/tool/nwfilter.py
+++ b/lib/vdsm/tool/nwfilter.py
@@ -56,14 +56,6 @@
define vdsm network filter on libvirt to control VM traffic
"""
- try:
- conn.nwfilterLookupByName(self.filterName).undefine()
- except libvirt.libvirtError:
- # Ignore failure if filter isn't exists or if failed to remove.
- # Failure might occur when attempting to remove a filter which
- # is being used by running VMs
- pass
-
nwFilter = conn.nwfilterDefineXML(self.buildFilterXml())
logging.debug("Filter %s was defined" % nwFilter.name())
--
To view, visit http://gerrit.ovirt.org/20788
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id253c66df8296613b6a2bc3fc058ef2754702964
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 11 months
Change in vdsm[master]: Fix minor network functional tests issues
by amuller@redhat.com
Assaf Muller has uploaded a new change for review.
Change subject: Fix minor network functional tests issues
......................................................................
Fix minor network functional tests issues
Some tests were asserting that networks existed based on out
of date statuses.
Change-Id: I5a029f6da66f59b2e0394d3f4bb26637aa0b59c6
Signed-off-by: Assaf Muller <amuller(a)redhat.com>
---
M tests/functional/networkTests.py
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/20859/1
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index ec113e3..4b3a53f 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -400,7 +400,7 @@
self.assertNetworkExists(netVlan, bridged=bridged)
self.assertVlanExists(nics[0] + '.' + str(vlanId))
- self.vdsm_net.delNetwork(netVlan)
+ status, msg = self.vdsm_net.delNetwork(netVlan)
self.assertEquals(status, SUCCESS, msg)
@cleanupNet
@@ -418,7 +418,7 @@
self.assertNetworkExists(NETWORK_NAME, bridged=bridged)
self.assertVlanExists(nics[0] + '.' + VLAN_ID)
- self.vdsm_net.delNetwork(NETWORK_NAME)
+ status, msg = self.vdsm_net.delNetwork(NETWORK_NAME)
self.assertEquals(status, SUCCESS, msg)
@cleanupNet
@@ -435,6 +435,7 @@
status, msg = self.vdsm_net.addNetwork(firstVlan, vlan=firstVlanId,
bond=BONDING_NAME,
nics=nics, opts=opts)
+ self.assertEquals(status, SUCCESS, msg)
with nonChangingOperstate(BONDING_NAME):
for netVlan, vlanId in NET_VLANS[1:]:
status, msg = self.vdsm_net.addNetwork(netVlan,
--
To view, visit http://gerrit.ovirt.org/20859
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a029f6da66f59b2e0394d3f4bb26637aa0b59c6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller(a)redhat.com>
9 years, 11 months
Change in vdsm[master]: tests: prevent hook validation decorator from leaving script...
by Nir Soffer
Nir Soffer has posted comments on this change.
Change subject: tests: prevent hook validation decorator from leaving scripts installed
......................................................................
Patch Set 7:
(1 comment)
....................................................
File lib/vdsm/utils.py
Line 130: logging.warning("Directory: %s already removed", directoryToRemove)
Line 131: else:
Line 132: logging.error("Removing directory: %s failed", directoryToRemove,
Line 133: exc_info=True)
Line 134: raise
We have similar saying about acting like roman in Rome :-) That is a valid reason.
I'll let others approve this.
Line 135:
Line 136: IPXMLRPCRequestHandler = SimpleXMLRPCRequestHandler
Line 137:
Line 138:
--
To view, visit http://gerrit.ovirt.org/20310
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I138c3eab77ea6d35d6a997049940923026e06d96
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Miguel Angel Ajo Pelayo <miguelangel(a)ajo.es>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Miguel Angel Ajo Pelayo <miguelangel(a)ajo.es>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
9 years, 11 months
Change in vdsm[master]: Remove redundant supervsdm.validateAccess.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Remove redundant supervsdm.validateAccess.
......................................................................
Remove redundant supervsdm.validateAccess.
Change-Id: Id37865225ea2d29361d6e588f9bb0acf7bf71cec
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/fileSD.py
M vdsm/supervdsmServer
2 files changed, 0 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/20838/1
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index f9ff93b..47c5448 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -35,7 +35,6 @@
from persistentDict import PersistentDict, DictValidator
from vdsm import constants
from vdsm.utils import stripNewLines
-import supervdsm
import mount
REMOTE_PATH = "REMOTE_PATH"
@@ -50,10 +49,6 @@
def validateDirAccess(dirPath):
try:
getProcPool().fileUtils.validateAccess(dirPath)
- supervdsm.getProxy().validateAccess(
- constants.QEMU_PROCESS_USER,
- (constants.DISKIMAGE_GROUP, constants.METADATA_GROUP), dirPath,
- (os.R_OK | os.X_OK))
except OSError as e:
if e.errno == errno.EACCES:
raise se.StorageServerAccessPermissionError(dirPath)
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index d42e320..7a9c3da 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -57,7 +57,6 @@
from storage.iscsi import readSessionInfo as _readSessionInfo
from supervdsm import _SuperVdsmManager
from storage.fileUtils import chown, resolveGid, resolveUid
-from storage.fileUtils import validateAccess as _validateAccess
from vdsm.constants import METADATA_GROUP, EXT_UDEVADM, \
DISKIMAGE_USER, DISKIMAGE_GROUP, P_LIBVIRT_VMCHANNELS, VDSM_USER
from storage.devicemapper import _removeMapping, _getPathsStatus
@@ -237,11 +236,6 @@
raise err
return res
-
- @logDecorator
- def validateAccess(self, user, groups, *args, **kwargs):
- return self._runAs(user, groups, _validateAccess, args=args,
- kwargs=kwargs)
@logDecorator
def setSafeNetworkConfig(self):
--
To view, visit http://gerrit.ovirt.org/20838
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id37865225ea2d29361d6e588f9bb0acf7bf71cec
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
9 years, 11 months
Change in vdsm[master]: sampling.ImagePathStatus: drop dead thread
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: sampling.ImagePathStatus: drop dead thread
......................................................................
sampling.ImagePathStatus: drop dead thread
In pre-historic rhev-2.1 days, ImagePathStatus thread was used to
collect and cache information about the image repository accessibility.
However, this code was never used by ovirt-3.y.
By default, images_check_times is set to 0, meaning that the
sampling.ImagePathStatus thread is never started. It is highly unlikely
that there's a secret vdsm client out there that explicitly turns on
this monitoring thread and read the 'storageDomains' element out of
getVdsStats.
Change-Id: I682d9730ac087e0a24ba5c72dbac912c87a6452f
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/sampling.py
M vdsm_api/vdsmapi-schema.json
3 files changed, 0 insertions(+), 52 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/20812/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index c0bdd53..c8ce7e6 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -194,9 +194,6 @@
('irsd', '%(images)s/irsd', None),
- ('images_check_times', '0',
- 'Image repository check period (seconds).'),
-
('volume_utilization_percent', '50', None),
('volume_utilization_chunk_mb', '1024', None),
diff --git a/vdsm/sampling.py b/vdsm/sampling.py
index 851034d..aafb942 100644
--- a/vdsm/sampling.py
+++ b/vdsm/sampling.py
@@ -36,7 +36,6 @@
from vdsm import utils
from vdsm import netinfo
from vdsm.constants import P_VDSM_RUN
-from vdsm.config import config
_THP_STATE_PATH = '/sys/kernel/mm/transparent_hugepage/enabled'
if not os.path.exists(_THP_STATE_PATH):
@@ -478,12 +477,10 @@
def __init__(self, cif, log, ifids, ifrates):
self.startTime = time.time()
StatsThread.__init__(self, log, ifids, ifrates)
- self._imagesStatus = ImagePathStatus(cif)
self._pid = os.getpid()
self._ncpus = max(os.sysconf('SC_NPROCESSORS_ONLN'), 1)
def stop(self):
- self._imagesStatus.stop()
StatsThread.stop(self)
def _updateIfRates(self, hs0, hs1):
@@ -504,18 +501,7 @@
stats = StatsThread.get(self)
stats['cpuSysVdsmd'] = stats['cpuUserVdsmd'] = 0.0
stats['storageDomains'] = {}
- if self._imagesStatus._cif.irs:
- self._imagesStatus._refreshStorageDomains()
now = time.time()
- for sd, d in self._imagesStatus.storageDomains.iteritems():
- stats['storageDomains'][sd] = {
- 'code': d['code'],
- 'delay': d['delay'],
- 'lastCheck': d['lastCheck'],
- 'valid': d['valid'],
- 'version': d['version'],
- 'acquired': d['acquired'],
- }
stats['elapsedTime'] = int(now - self.startTime)
if len(self._samples) < 2:
return stats
@@ -539,35 +525,3 @@
stats['diskStats'] = hs1.diskStats
stats['thpState'] = hs1.thpState
return stats
-
-
-class ImagePathStatus(threading.Thread):
- def __init__(self, cif, interval=None):
- if interval is None:
- interval = config.getint('irs', 'images_check_times')
- self._interval = interval
- self._cif = cif
- self.storageDomains = {}
- self._stopEvent = threading.Event()
- threading.Thread.__init__(self, name='ImagePathStatus')
- if self._interval > 0:
- self.start()
-
- def stop(self):
- self._stopEvent.set()
-
- def _refreshStorageDomains(self):
- self.storageDomains = self._cif.irs.repoStats()
- del self.storageDomains["status"]
- if "args" in self.storageDomains:
- del self.storageDomains["args"]
-
- def run(self):
- try:
- while not self._stopEvent.isSet():
- if self._cif.irs:
- self._refreshStorageDomains()
- self._stopEvent.wait(self._interval)
- except:
- logging.error("Error while refreshing storage domains",
- exc_info=True)
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 0281c4d..72848f8 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -1569,8 +1569,6 @@
#
# @cpuUserVdsmd: Ratio of CPU time spent in userspace by vdsm
#
-# @storageDomains: Storage Domain vital statistics
-#
# @elapsedTime: The number of seconds that vdsm has been running
#
# @memUsed: The percentage of memory used (not including caches)
@@ -1628,7 +1626,6 @@
'network': 'HostNetworkInterfaceStatsMap',
'rxDropped': 'uint', 'txDropped': 'uint',
'cpuSysVdsmd': 'float', 'cpuUserVdsmd': 'float',
- 'storageDomains': 'StorageDomainVitalsMap',
'elapsedTime': 'uint', 'memUsed': 'uint',
'anonHugePages': 'uint', 'cpuLoad': 'float',
'diskStats': 'PathStatsMap', 'thpState': 'THPStates',
--
To view, visit http://gerrit.ovirt.org/20812
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I682d9730ac087e0a24ba5c72dbac912c87a6452f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 11 months
Change in vdsm[master]: Monitor bridges using vdsStats
by psebek@redhat.com
Petr Šebek has uploaded a new change for review.
Change subject: Monitor bridges using vdsStats
......................................................................
Monitor bridges using vdsStats
Added monitoring bridges to vdsStats. This change answer to rfe 675560.
Change-Id: If73565bf62f339e338d65b0200a1ba7f1131b706
Bug-Url: https://bugzilla.redhat.com/675560
Signed-off-by: Petr Sebek <psebek(a)redhat.com>
---
M vdsm/clientIF.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/16227/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 073523f..5168687 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -82,7 +82,7 @@
self.gluster = None
try:
self.vmContainer = {}
- ifids = netinfo.nics() + netinfo.bondings()
+ ifids = netinfo.nics() + netinfo.bondings() + netinfo.bridges()
ifrates = map(netinfo.speed, ifids)
self._hostStats = sampling.HostStatsThread(
cif=self, log=log, ifids=ifids,
--
To view, visit http://gerrit.ovirt.org/16227
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If73565bf62f339e338d65b0200a1ba7f1131b706
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Šebek <psebek(a)redhat.com>
9 years, 11 months
Change in vdsm[master]: xmlrpc: Parsing error logging enhancement - vdsClient
by ybronhei@redhat.com
Yaniv Bronhaim has posted comments on this change.
Change subject: xmlrpc: Parsing error logging enhancement - vdsClient
......................................................................
Patch Set 3: Code-Review+1
--
To view, visit http://gerrit.ovirt.org/20627
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ife29c4f7749b9cd8a4ad892f486d91509e505ae4
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: mooli tayer <mtayer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
9 years, 11 months
Change in vdsm[master]: Removal of needless base class StatsThread
by psebek@redhat.com
Petr Šebek has uploaded a new change for review.
Change subject: Removal of needless base class StatsThread
......................................................................
Removal of needless base class StatsThread
>From this base class inherit only class HostStatsThread, therefore can
be content of class StatsThread moved to class HostStatsThread without
changing of functionality and with higher clarity.
Change-Id: Ica913d6e97d37c7729b77574373247add2125338
Signed-off-by: Petr Sebek <psebek(a)redhat.com>
---
M vdsm/sampling.py
1 file changed, 64 insertions(+), 77 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/20745/1
diff --git a/vdsm/sampling.py b/vdsm/sampling.py
index 851034d..41453d6 100644
--- a/vdsm/sampling.py
+++ b/vdsm/sampling.py
@@ -358,30 +358,47 @@
intervalAccum = (intervalAccum + waitInterval) % maxInterval
-class StatsThread(threading.Thread):
+class HostStatsThread(threading.Thread):
"""
- A thread that periodically checks the stats of interfaces
+ A thread that periodically samples host statistics.
"""
AVERAGING_WINDOW = 5
SAMPLE_INTERVAL_SEC = 2
- def __init__(self, log, ifids, ifrates):
+ def __init__(self, cif, log, ifids, ifrates):
+ self.startTime = time.time()
+
threading.Thread.__init__(self)
self._log = log
self._stopEvent = threading.Event()
self._samples = []
self._ifids = ifids
self._ifrates = ifrates
- self._ncpus = 1
# in bytes-per-second
- self._lineRate = (sum(ifrates) or 1000) * (10 ** 6) / 8
+ self._lineRate = (sum(self._ifrates) or 1000) * (10 ** 6) / 8
self._lastSampleTime = time.time()
+ self._imagesStatus = ImagePathStatus(cif)
+ self._pid = os.getpid()
+ self._ncpus = max(os.sysconf('SC_NPROCESSORS_ONLN'), 1)
+
def stop(self):
+ self._imagesStatus.stop()
self._stopEvent.set()
- def sample(self): # override
- pass
+ def _updateIfRates(self, hs0, hs1):
+ i = 0
+ for ifid in self._ifids:
+ if (hs0.interfaces[ifid].operstate !=
+ hs1.interfaces[ifid].operstate):
+ self._ifrates[i] = netinfo.speed(ifid)
+ i += 1
+
+ def sample(self):
+ hs = HostSample(self._pid, self._ifids)
+ if self._samples:
+ self._updateIfRates(self._samples[-1], hs)
+ return hs
def run(self):
import vm
@@ -404,6 +421,46 @@
self._log.error("Error while sampling stats", exc_info=True)
def get(self):
+ stats = self._getInterfacesStats()
+ stats['cpuSysVdsmd'] = stats['cpuUserVdsmd'] = 0.0
+ stats['storageDomains'] = {}
+ if self._imagesStatus._cif.irs:
+ self._imagesStatus._refreshStorageDomains()
+ now = time.time()
+ for sd, d in self._imagesStatus.storageDomains.iteritems():
+ stats['storageDomains'][sd] = {
+ 'code': d['code'],
+ 'delay': d['delay'],
+ 'lastCheck': d['lastCheck'],
+ 'valid': d['valid'],
+ 'version': d['version'],
+ 'acquired': d['acquired'],
+ }
+ stats['elapsedTime'] = int(now - self.startTime)
+ if len(self._samples) < 2:
+ return stats
+ hs0, hs1 = self._samples[0], self._samples[-1]
+ interval = hs1.timestamp - hs0.timestamp
+ jiffies = (hs1.pidcpu.user - hs0.pidcpu.user) % (2 ** 32)
+ stats['cpuUserVdsmd'] = (jiffies / interval) % (2 ** 32)
+ jiffies = hs1.pidcpu.sys - hs0.pidcpu.sys
+ stats['cpuSysVdsmd'] = (jiffies / interval) % (2 ** 32)
+
+ jiffies = (hs1.totcpu.user - hs0.totcpu.user) % (2 ** 32)
+ stats['cpuUser'] = jiffies / interval / self._ncpus
+ jiffies = (hs1.totcpu.sys - hs0.totcpu.sys) % (2 ** 32)
+ stats['cpuSys'] = jiffies / interval / self._ncpus
+ stats['cpuIdle'] = max(0.0,
+ 100.0 - stats['cpuUser'] - stats['cpuSys'])
+ stats['memUsed'] = hs1.memUsed
+ stats['anonHugePages'] = hs1.anonHugePages
+ stats['cpuLoad'] = hs1.cpuLoad
+
+ stats['diskStats'] = hs1.diskStats
+ stats['thpState'] = hs1.thpState
+ return stats
+
+ def _getInterfacesStats(self):
"""
Compile and return a dict containing the stats.
@@ -468,76 +525,6 @@
stats['rxDropped'] = rxDropped
stats['txDropped'] = txDropped
- return stats
-
-
-class HostStatsThread(StatsThread):
- """
- A thread that periodically samples host statistics.
- """
- def __init__(self, cif, log, ifids, ifrates):
- self.startTime = time.time()
- StatsThread.__init__(self, log, ifids, ifrates)
- self._imagesStatus = ImagePathStatus(cif)
- self._pid = os.getpid()
- self._ncpus = max(os.sysconf('SC_NPROCESSORS_ONLN'), 1)
-
- def stop(self):
- self._imagesStatus.stop()
- StatsThread.stop(self)
-
- def _updateIfRates(self, hs0, hs1):
- i = 0
- for ifid in self._ifids:
- if (hs0.interfaces[ifid].operstate !=
- hs1.interfaces[ifid].operstate):
- self._ifrates[i] = netinfo.speed(ifid)
- i += 1
-
- def sample(self):
- hs = HostSample(self._pid, self._ifids)
- if self._samples:
- self._updateIfRates(self._samples[-1], hs)
- return hs
-
- def get(self):
- stats = StatsThread.get(self)
- stats['cpuSysVdsmd'] = stats['cpuUserVdsmd'] = 0.0
- stats['storageDomains'] = {}
- if self._imagesStatus._cif.irs:
- self._imagesStatus._refreshStorageDomains()
- now = time.time()
- for sd, d in self._imagesStatus.storageDomains.iteritems():
- stats['storageDomains'][sd] = {
- 'code': d['code'],
- 'delay': d['delay'],
- 'lastCheck': d['lastCheck'],
- 'valid': d['valid'],
- 'version': d['version'],
- 'acquired': d['acquired'],
- }
- stats['elapsedTime'] = int(now - self.startTime)
- if len(self._samples) < 2:
- return stats
- hs0, hs1 = self._samples[0], self._samples[-1]
- interval = hs1.timestamp - hs0.timestamp
- jiffies = (hs1.pidcpu.user - hs0.pidcpu.user) % (2 ** 32)
- stats['cpuUserVdsmd'] = (jiffies / interval) % (2 ** 32)
- jiffies = hs1.pidcpu.sys - hs0.pidcpu.sys
- stats['cpuSysVdsmd'] = (jiffies / interval) % (2 ** 32)
-
- jiffies = (hs1.totcpu.user - hs0.totcpu.user) % (2 ** 32)
- stats['cpuUser'] = jiffies / interval / self._ncpus
- jiffies = (hs1.totcpu.sys - hs0.totcpu.sys) % (2 ** 32)
- stats['cpuSys'] = jiffies / interval / self._ncpus
- stats['cpuIdle'] = max(0.0,
- 100.0 - stats['cpuUser'] - stats['cpuSys'])
- stats['memUsed'] = hs1.memUsed
- stats['anonHugePages'] = hs1.anonHugePages
- stats['cpuLoad'] = hs1.cpuLoad
-
- stats['diskStats'] = hs1.diskStats
- stats['thpState'] = hs1.thpState
return stats
--
To view, visit http://gerrit.ovirt.org/20745
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica913d6e97d37c7729b77574373247add2125338
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Šebek <psebek(a)redhat.com>
9 years, 11 months