Change in vdsm[ovirt-3.3]: storage: fix getDomUuidFromVolumePath()

ybronhei at redhat.com ybronhei at redhat.com
Thu Oct 31 12:16:40 UTC 2013


Hello Saggi Mizrahi,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/20753

to review the following change.

Change subject: storage: fix getDomUuidFromVolumePath()
......................................................................

storage: fix getDomUuidFromVolumePath()

getDomUuidFromVolumePath returned the imgUUID instead of the sdUUID.

Since this is used as the parameter for getProcessPool() a process pool
was created per image id instead of per domain id.

Since imgUUIDs are much more abundant this can cause the creation of an
obscene number of process pools and in turn a lot of processes.

Change-Id: I17267993c8e3a582b1277f1e8aacd6bc69c8e4ec
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1017735
Signed-off-by: Saggi Mizrahi <smizrahi at redhat.com>
---
M tests/Makefile.am
A tests/fileVolumeTests.py
M vdsm/storage/fileVolume.py
3 files changed, 38 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/20753/1

diff --git a/tests/Makefile.am b/tests/Makefile.am
index ad8c6cf..f87eddd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -28,6 +28,7 @@
 	betterPopenTests.py \
 	capsTests.py \
 	configNetworkTests.py \
+	fileVolumeTests.py \
 	fileUtilTests.py \
 	fuserTests.py \
 	getAllVolumesTests.py \
diff --git a/tests/fileVolumeTests.py b/tests/fileVolumeTests.py
new file mode 100644
index 0000000..e1a8f8a
--- /dev/null
+++ b/tests/fileVolumeTests.py
@@ -0,0 +1,33 @@
+#
+# Copyright 2012 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+from testrunner import VdsmTestCase as TestCaseBase
+from vdsm.config import config
+import storage.fileVolume as fileVolume
+
+import os
+
+
+class GetDomUuidFromVolumePathTests(TestCaseBase):
+    def test(self):
+        testPath = os.path.join(config.get('irs', 'repository'),
+                                "spUUID/sdUUID/images/imgUUID/volUUID")
+        self.assertEqual(fileVolume.getDomUuidFromVolumePath(testPath),
+                         "sdUUID")
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index 4525b0e..3eb4518 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -48,12 +48,12 @@
     #  /rhev/data-center/spUUID/sdUUID/images/imgUUID/volUUID
 
     # sdUUID position after data-center
-    sdUUIDPos = 3
+    sdUUIDOffset = 1
 
     volList = volPath.split('/')
-    sdUUID = len(normpath(config.get('irs', 'repository')).split('/')) + \
-        sdUUIDPos
-    return volList[sdUUID]
+    sdUUIDPos = len(normpath(config.get('irs', 'repository')).split('/')) + \
+        sdUUIDOffset
+    return volList[sdUUIDPos]
 
 
 class FileVolume(volume.Volume):


-- 
To view, visit http://gerrit.ovirt.org/20753
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I17267993c8e3a582b1277f1e8aacd6bc69c8e4ec
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>


More information about the vdsm-patches mailing list