Change in vdsm[master]: virt: Report disks stats using libvirt bulk stats

2016-09-17 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: virt: Report disks stats using libvirt bulk stats
..


Patch Set 2: Code-Review-1

It does not work, libvirt allocation is mostly useless for what our needs.

We need to use the storage apis doing the right thing for file and block 
storage.

So the solution should use storage apis in a dedicated thread pool that will 
not effect virt monitoring if storage domain is blocking monitoring.

-- 
To view, visit https://gerrit.ovirt.org/64093
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4139ac1fa2ab5000ba41d3035c7f810cfe2bcbbd
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Ala Hino 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Milan Zamazal 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: virt: Report disks stats using libvirt bulk stats

2016-09-16 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: virt: Report disks stats using libvirt bulk stats
..


Patch Set 2:

* 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.6', 
'ovirt-4.0'])

-- 
To view, visit https://gerrit.ovirt.org/64093
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4139ac1fa2ab5000ba41d3035c7f810cfe2bcbbd
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Ala Hino 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Milan Zamazal 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: virt: Report disks stats using libvirt bulk stats

2016-09-16 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: virt: Report disks stats using libvirt bulk stats
..


Patch Set 1:

* 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.6', 
'ovirt-4.0'])

-- 
To view, visit https://gerrit.ovirt.org/64093
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4139ac1fa2ab5000ba41d3035c7f810cfe2bcbbd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: virt: Report disks stats using libvirt bulk stats

2016-09-16 Thread nsoffer
Nir Soffer has uploaded a new change for review.

Change subject: virt: Report disks stats using libvirt bulk stats
..

virt: Report disks stats using libvirt bulk stats

We used to collect disk apparentsize and truesize using risky storage
apis, updating the value once per minute.  Turns out that we already
fetch the needed info during bulk sampling every 15 seconds.  Use the
values from the stats cache instead of the drive object.

Change-Id: I4139ac1fa2ab5000ba41d3035c7f810cfe2bcbbd
Signed-off-by: Nir Soffer 
---
M lib/vdsm/virt/vmstats.py
M tests/vmStatsTests.py
2 files changed, 28 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/64093/1

diff --git a/lib/vdsm/virt/vmstats.py b/lib/vdsm/virt/vmstats.py
index dadbf26..ef2d67a 100644
--- a/lib/vdsm/virt/vmstats.py
+++ b/lib/vdsm/virt/vmstats.py
@@ -362,12 +362,12 @@
 drive_stats = {}
 try:
 drive_stats = {
-'truesize': str(vm_drive.truesize),
-'apparentsize': str(vm_drive.apparentsize),
 'readLatency': '0',
 'writeLatency': '0',
 'flushLatency': '0'
 }
+drive_stats.update(
+_disk_size(last_sample, last_indexes[vm_drive.name]))
 if isVdsmImage(vm_drive):
 drive_stats['imageID'] = vm_drive.imageID
 elif "GUID" in vm_drive:
@@ -408,6 +408,19 @@
 return stats
 
 
+def _disk_size(sample, index):
+stats = {}
+
+for libvirt_name, ovirt_name in (
+("physical", "apparentsize"),
+("allocation", "truesize"),
+):
+key = 'block.%d.%s' % (index, libvirt_name)
+stats[ovirt_name] = str(sample.get(key, 0))
+
+return stats
+
+
 def _disk_rate(first_sample, first_index, last_sample, last_index, interval):
 stats = {}
 
diff --git a/tests/vmStatsTests.py b/tests/vmStatsTests.py
index 9827c4e..6363495 100644
--- a/tests/vmStatsTests.py
+++ b/tests/vmStatsTests.py
@@ -85,7 +85,8 @@
 'block.1.wr.times': 0,
 'block.1.fl.reqs': 0,
 'block.1.fl.times': 0,
-'block.1.allocation': 0,
+'block.1.allocation': 268435456,
+'block.1.physical': 1073741824,
 'block.1.capacity': 42949672960,
 },
 {
@@ -414,6 +415,17 @@
 'writtenBytes',
 )
 
+def test_disk_size(self):
+drives = (FakeDrive(name='vda', size=700 * 1024 * 1024),)
+testvm = FakeVM(drives=drives)
+stats = {}
+before = copy.deepcopy(self.bulk_stats)
+after = copy.deepcopy(self.bulk_stats)
+vmstats.disks(testvm, stats, before, after, 10)
+drive = stats['disks']['vda']
+self.assertEqual(drive['apparentsize'], '1073741824')
+self.assertEqual(drive['truesize'], '268435456')
+
 def test_disk_all_keys_present(self):
 interval = 10  # seconds
 drives = (FakeDrive(name='hdc', size=700 * 1024 * 1024),)


-- 
To view, visit https://gerrit.ovirt.org/64093
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4139ac1fa2ab5000ba41d3035c7f810cfe2bcbbd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer 
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org