Change in vdsm[master]: net stats: drop statsAge from statistics
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: net stats: drop statsAge from statistics
......................................................................
net stats: drop statsAge from statistics
statsAge has been reported by getVdsStats and getAllVmStats since ever,
but it has never been consumed by Engine. This patch drops this element,
since we would like to report sampleTime in a following patch, and would
not like to report duplicate information.
Change-Id: I3f48e2eecc49bdf877056295b198725add1f792d
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/sampling.py
M vdsm/virt/vm.py
3 files changed, 7 insertions(+), 18 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/36482/1
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 65a6302..e1849e1 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -1955,8 +1955,6 @@
#
# @txRate: Outgoing packet rate (as a percentage of total capacity)
#
-# @statsAge: Seconds elapsed since the stats were last sampled
-#
# @network: Per-interface network statistics
#
# @rxDropped: The number of incoming packets dropped
@@ -2033,7 +2031,7 @@
##
{'type': 'HostStats',
'data': {'cpuUser': 'float', 'cpuSys': 'float', 'cpuIdle': 'float',
- 'rxRate': 'float', 'txRate': 'float', 'statsAge': 'uint',
+ 'rxRate': 'float', 'txRate': 'float',
'network': 'HostNetworkInterfaceStatsMap',
'rxDropped': 'uint', 'txDropped': 'uint',
'cpuSysVdsmd': 'float', 'cpuUserVdsmd': 'float',
@@ -6723,8 +6721,6 @@
#
# @boot: #optional An alias for the type of device used to boot the VM
#
-# @statsAge: The age of these statistics in seconds
-#
# @cpuSys: Ratio of CPU time spent by qemu on other than guest time
#
# @cpuUser: Ratio of CPU time spent by the guest VM
@@ -6801,7 +6797,7 @@
'network': 'NetworkInterfaceStatsMap',
'disks': 'VmDiskStatsMap', 'monitorResponse': 'int',
'elapsedTime': 'uint', '*cdrom': 'str',
- '*boot': 'VmBootMode','statsAge': 'float', 'cpuSys': 'float',
+ '*boot': 'VmBootMode', 'cpuSys': 'float',
'cpuUser': 'float',
'acpiEnable': 'bool', 'timeOffset': 'uint',
'clientIp': 'str', 'pauseCode': 'str', 'memUsage': 'uint',
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index 04203ff..86071c6 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -527,7 +527,6 @@
self._log = log
self._stopEvent = threading.Event()
self._samples = []
- self._lastSampleTime = time.time()
self._pid = os.getpid()
self._ncpus = max(os.sysconf('SC_NPROCESSORS_ONLN'), 1)
@@ -555,7 +554,6 @@
if diff:
self._CONNLOG.debug('%s', diff)
- self._lastSampleTime = sample.timestamp
if len(self._samples) > self.AVERAGING_WINDOW:
self._samples.pop(0)
except vm.TimeoutError:
@@ -651,8 +649,7 @@
* txRate
"""
stats = {'cpuUser': 0.0, 'cpuSys': 0.0, 'cpuIdle': 100.0,
- 'rxRate': 0.0, 'txRate': 0.0,
- 'statsAge': time.time() - self._lastSampleTime}
+ 'rxRate': 0.0, 'txRate': 0.0, }
if len(self._samples) < 2:
return stats
hs0, hs1 = self._samples[0], self._samples[-1]
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 6617526..767f9b9 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -665,12 +665,6 @@
def get(self):
stats = {}
- try:
- stats['statsAge'] = time.time() - self.getLastSampleTime()
- except TypeError:
- self._log.debug("Stats age not available")
- stats['statsAge'] = -1.0
-
self._getCpuStats(stats)
self._getNetworkStats(stats)
self._getDiskStats(stats)
@@ -2341,9 +2335,11 @@
decStats = {}
try:
- if self._vmStats:
+ if self._vmStats and self._vmStats.getLastSampleTime() is not None:
decStats = self._vmStats.get()
- self._setUnresponsiveIfTimeout(stats, decStats['statsAge'])
+ self._setUnresponsiveIfTimeout(
+ stats,
+ time.time() - self._vmStats.getLastSampleTime())
except Exception:
self.log.exception("Error fetching vm stats")
for var in decStats:
--
To view, visit http://gerrit.ovirt.org/36482
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f48e2eecc49bdf877056295b198725add1f792d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 3 months
Change in vdsm[master]: net stats: expose sample timestamp
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: net stats: expose sample timestamp
......................................................................
net stats: expose sample timestamp
Change-Id: I8e996cc1dcdf8f8223e83e36092949e4951c5d1d
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/functional/networkTests.py
M tests/vmTests.py
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/sampling.py
M vdsm/virt/vm.py
5 files changed, 25 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/36483/1
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index 1a557a6..482fd0f 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -428,14 +428,16 @@
self.assertIn(
left, hostStats['network'], 'couldn''t find veth')
- def getTxStatsFromInterface(iface):
+ def getStatsFromInterface(iface):
status, msg, hostStats = self.vdsm_net.getVdsStats()
self.assertEqual(status, SUCCESS, msg)
self.assertIn('network', hostStats)
self.assertIn(iface, hostStats['network'])
self.assertIn('tx', hostStats['network'][iface])
self.assertIn('rx', hostStats['network'][iface])
- return int(hostStats['network'][iface]['tx'])
+ self.assertIn('sampleTime', hostStats['network'][iface])
+ return (int(hostStats['network'][iface]['tx']),
+ hostStats['network'][iface]['sampleTime'])
with vethIf() as (left, right):
# disabling IPv6 on Interface for removal of Router Solicitation
@@ -446,7 +448,7 @@
# Vdsm scans for new devices every 15 seconds
self.retryAssert(
assertTestDevStatsReported, timeout=20)
- prevTxStat = getTxStatsFromInterface(left)
+ prevTxStat, prevTime = getStatsFromInterface(left)
# running ARP from the interface
rc, out, err = execCmd([_ARPPING_COMMAND.cmd, '-D', '-I', left,
'-c', '1', IP_ADDRESS_IN_NETWORK])
@@ -454,7 +456,10 @@
raise SkipTest('Could not run sysctl command', out, err)
# Sleep 2 seconds for the statistics to be updated
time.sleep(2)
- curTxStat = getTxStatsFromInterface(left)
+ curTxStat, curTime = getStatsFromInterface(left)
+ self.assertTrue(
+ curTime > prevTime,
+ 'sampleTime is not monotonically invreasing')
diff = (curTxStat - prevTxStat)
self.assertTrue(ARP_REQUEST_SIZE <= diff
<= (ARP_REQUEST_SIZE + DHCP_PACKET_SIZE),
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 41fe8d0..a24ee81 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -1480,11 +1480,17 @@
MAC = '52:54:00:59:F5:3F'
with fake.VM() as testvm:
mock_stats_thread = vm.VmStatsThread(testvm)
+ pretime = utils.monotonic_time()
res = mock_stats_thread._getNicStats(
name='vnettest', model='virtio', mac=MAC,
start_sample=(2 ** 64 - 15 * GBPS, 1, 2, 3, 0, 4, 5, 6),
end_sample=(0, 7, 8, 9, 5 * GBPS, 10, 11, 12),
interval=15.0)
+ posttime = utils.monotonic_time()
+ self.assertIn('sampleTime', res)
+ self.assertTrue(pretime <= res['sampleTime'] <= posttime,
+ 'sampleTime not in [%s..%s]' % (pretime, posttime))
+ del res['sampleTime']
self.assertEqual(res, {
'rxErrors': '8', 'rxDropped': '9',
'txErrors': '11', 'txDropped': '12',
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index e1849e1..b20b2d6 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -1706,6 +1706,8 @@
#
# @tx: The number of outgoing bytes in total (new in version 4.17)
#
+# @sampleTime: Time stamp of the sample (new in version 4.17)
+#
# @macAddr: The hardware address
#
# Since: 4.10.0
@@ -1714,7 +1716,8 @@
'data': {'name': 'str', 'speed': 'uint', 'rxDropped': 'uint',
'txDropped': 'uint', 'rxErrors': 'uint', 'txErrors': 'uint',
'state': 'NetworkInterfaceState', 'rxRate': 'float',
- 'txRate': 'float', 'rx': 'uint', 'tx': 'uint', 'macAddr': 'str'}}
+ 'txRate': 'float', 'rx': 'uint', 'tx': 'uint', 'sampleTime': 'float',
+ 'macAddr': 'str'}}
##
# @HostNetworkInterfaceStats:
#
@@ -1742,13 +1745,16 @@
#
# @tx: The number of outgoing bytes in total (new in version 4.17)
#
+# @sampleTime: Time stamp of the sample (new in version 4.17)
+#
# Since: 4.11.1
##
{'type': 'HostNetworkInterfaceStats',
'data': {'name': 'str', 'speed': 'uint', 'rxDropped': 'uint',
'txDropped': 'uint', 'rxErrors': 'uint', 'txErrors': 'uint',
'state': 'NetworkInterfaceState', 'rxRate': 'float',
- 'txRate': 'float', 'rx': 'uint', 'tx': 'uint'}}
+ 'txRate': 'float', 'rx': 'uint', 'tx': 'uint', 'sampleTime': 'float',
+ }}
##
# @StorageDomainVitals:
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index 86071c6..73943df 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -692,6 +692,7 @@
'txRate': '%.1f' % txRate,
'rx': str(iface.rx),
'tx': str(iface.tx),
+ 'sampleTime': hs1.timestamp,
}
rx += thisRx
tx += thisTx
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 767f9b9..8fa7872 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -599,6 +599,7 @@
ifStats['rx'] = str(end_sample[0])
ifStats['tx'] = str(end_sample[4])
+ ifStats['sampleTime'] = utils.monotonic_time()
return ifStats
--
To view, visit http://gerrit.ovirt.org/36483
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e996cc1dcdf8f8223e83e36092949e4951c5d1d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 3 months
Change in vdsm[master]: net stats: add tx/rx statistic to getInterfacesStat
by automation@ovirt.org
automation(a)ovirt.org has posted comments on this change.
Change subject: net stats: add tx/rx statistic to getInterfacesStat
......................................................................
Patch Set 12:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit http://gerrit.ovirt.org/35061
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I314a04570dec56677168e0fdb4a7824d299dbd65
Gerrit-PatchSet: 12
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amir Shladovsky <a.shlado(a)gmail.com>
Gerrit-Reviewer: Antoni Segura Puimedon <toni(a)midokura.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan(a)redhat.com>
Gerrit-Reviewer: Lior Vernia <lvernia(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
9 years, 3 months
Change in vdsm[master]: Revert "jsonrpc: Image_upload missing in command_info"
by Oved Ourfali
Oved Ourfali has uploaded a new change for review.
Change subject: Revert "jsonrpc: Image_upload missing in command_info"
......................................................................
Revert "jsonrpc: Image_upload missing in command_info"
This reverts commit 691a6f49b785b725439230a3f0bf55a9e71f539b.
Change-Id: I3837c27bfbe2629c8959bf47a10ee72bcdec37cf
Signed-off-by: Oved Ourfali <oourfali(a)redhat.com>
---
M vdsm/rpc/Bridge.py
1 file changed, 0 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/36534/1
diff --git a/vdsm/rpc/Bridge.py b/vdsm/rpc/Bridge.py
index a42ff97..f8c06f6 100644
--- a/vdsm/rpc/Bridge.py
+++ b/vdsm/rpc/Bridge.py
@@ -423,7 +423,6 @@
'Image_deleteVolumes': {'ret': 'uuid'},
'Image_getVolumes': {'ret': 'uuidlist'},
'Image_download': {'ret': 'uuid'},
- 'Image_upload': {'ret': 'uuid'},
'Image_mergeSnapshots': {'ret': 'uuid'},
'Image_move': {'ret': 'uuid'},
'Image_reconcileVolumeChain': {'ret': 'volumes'},
--
To view, visit http://gerrit.ovirt.org/36534
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3837c27bfbe2629c8959bf47a10ee72bcdec37cf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Oved Ourfali <oourfali(a)redhat.com>
9 years, 3 months
Change in vdsm[ovirt-3.5]: jsonrpc: Image_upload missing in command_info
by Oved Ourfali
Oved Ourfali has uploaded a new change for review.
Change subject: jsonrpc: Image_upload missing in command_info
......................................................................
jsonrpc: Image_upload missing in command_info
Change-Id: I79e28fed4caf3da5bdfefe030e4cfccb823d81d7
Bug-Url: https://bugzilla.redhat.com/1177952
Signed-off-by: Oved Ourfali <oourfali(a)redhat.com>
---
M vdsm/rpc/Bridge.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/36516/1
diff --git a/vdsm/rpc/Bridge.py b/vdsm/rpc/Bridge.py
index 8600f5f..e4b12aa 100644
--- a/vdsm/rpc/Bridge.py
+++ b/vdsm/rpc/Bridge.py
@@ -418,6 +418,7 @@
'Image_deleteVolumes': {'ret': 'uuid'},
'Image_getVolumes': {'ret': 'uuidlist'},
'Image_download': {'ret': 'uuid'},
+ 'Image_upload': {'ret': 'uuid'},
'Image_mergeSnapshots': {'ret': 'uuid'},
'Image_move': {'ret': 'uuid'},
'Image_reconcileVolumeChain': {'ret': 'volumes'},
--
To view, visit http://gerrit.ovirt.org/36516
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I79e28fed4caf3da5bdfefe030e4cfccb823d81d7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Oved Ourfali <oourfali(a)redhat.com>
9 years, 3 months
Change in vdsm[master]: jsonrpc: Image_upload missing in command_info
by Oved Ourfali
Oved Ourfali has uploaded a new change for review.
Change subject: jsonrpc: Image_upload missing in command_info
......................................................................
jsonrpc: Image_upload missing in command_info
Change-Id: I79e28fed4caf3da5bdfefe030e4cfccb823d81d7
Bug-Url: https://bugzilla.redhat.com/1177952
Signed-off-by: Oved Ourfali <oourfali(a)redhat.com>
---
M vdsm/rpc/Bridge.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/36515/1
diff --git a/vdsm/rpc/Bridge.py b/vdsm/rpc/Bridge.py
index f8c06f6..a42ff97 100644
--- a/vdsm/rpc/Bridge.py
+++ b/vdsm/rpc/Bridge.py
@@ -423,6 +423,7 @@
'Image_deleteVolumes': {'ret': 'uuid'},
'Image_getVolumes': {'ret': 'uuidlist'},
'Image_download': {'ret': 'uuid'},
+ 'Image_upload': {'ret': 'uuid'},
'Image_mergeSnapshots': {'ret': 'uuid'},
'Image_move': {'ret': 'uuid'},
'Image_reconcileVolumeChain': {'ret': 'volumes'},
--
To view, visit http://gerrit.ovirt.org/36515
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I79e28fed4caf3da5bdfefe030e4cfccb823d81d7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Oved Ourfali <oourfali(a)redhat.com>
9 years, 3 months