Change in vdsm[master]: Fix fix getDomUuidFromVolumePath()

ewarszaw at redhat.com ewarszaw at redhat.com
Thu Oct 31 19:06:25 UTC 2013


Eduardo has uploaded a new change for review.

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

Fix fix getDomUuidFromVolumePath()

Change-Id: I648e6a3f4e877c8f2471e82d7064c3e5a021d4d1
Bug-Url: http://bugzilla.redhat.com/1017735
Signed-off-by: Eduardo <ewarszaw at redhat.com>
---
M vdsm/storage/fileVolume.py
1 file changed, 5 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/20783/1

diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index cf26197..c6f1702 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -18,13 +18,11 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
-from os.path import normpath
 import errno
 import os
 import sanlock
 
 import storage_exception as se
-from vdsm.config import config
 from vdsm.utils import ActionStopped, grepCmd
 from sdc import sdCache
 import outOfProcess as oop
@@ -44,16 +42,11 @@
 
 
 def getDomUuidFromVolumePath(volPath):
-    # Volume path has pattern:
-    #  /rhev/data-center/spUUID/sdUUID/images/imgUUID/volUUID
-
-    # sdUUID position after data-center
-    sdUUIDOffset = 1
-
-    volList = volPath.split('/')
-    sdUUIDPos = len(normpath(config.get('irs', 'repository')).split('/')) + \
-        sdUUIDOffset
-    return volList[sdUUIDPos]
+    # fileVolume path has pattern:
+    # */sdUUID/images/imgUUID/volUUID
+    sdPath = os.path.normpath(volPath).split('/images')[0]
+    target, sdUUID = os.path.split(sdPath)
+    return sdUUID
 
 
 class FileVolume(volume.Volume):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I648e6a3f4e877c8f2471e82d7064c3e5a021d4d1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw at redhat.com>


More information about the vdsm-patches mailing list