Dan Kenigsberg has uploaded a new change for review.
Change subject: storage.glusterVolume.getVmVolInfo: move logic to storage domain
..
storage.glusterVolume.getVmVolInfo: move logic to storage domain
volume.getVmVolInfo is never used. The only usage of
glusterVolume.getVmVolInfo requires a cumbersome production of a
glusterVolume object. This patch moves the logic into the storage
domain, and enable the complete removal of glusterVolume in a subsequent
patch.
Change-Id: I05352ee60546f03b8e6272abbdd923d0ec6074b7
Signed-off-by: Dan Kenigsberg dan...@redhat.com
---
M vdsm/storage/glusterSD.py
M vdsm/storage/glusterVolume.py
M vdsm/storage/hsm.py
M vdsm/storage/sd.py
M vdsm/storage/volume.py
5 files changed, 39 insertions(+), 66 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/21122/1
diff --git a/vdsm/storage/glusterSD.py b/vdsm/storage/glusterSD.py
index 2931083..492413f 100644
--- a/vdsm/storage/glusterSD.py
+++ b/vdsm/storage/glusterSD.py
@@ -5,6 +5,8 @@
import fileSD
import mount
import storage_exception as se
+import supervdsm
+from gluster.exception import GlusterException
class GlusterStorageDomain(nfsSD.NfsStorageDomain):
@@ -27,6 +29,39 @@
raise se.StorageDomainDoesNotExist(sdUUID)
+def getExtraVolumeInfo(self, volPath):
+volfileServer, gvolname = self.getRemotePath().rsplit(:, 1)
+
+# Volume transport to Libvirt transport mapping
+VOLUME_TRANS_MAP = {'TCP': 'tcp', 'RDMA': 'rdma'}
+
+# Extract the volume's transport using gluster cli
+svdsmProxy = supervdsm.getProxy()
+try:
+volInfo = svdsmProxy.glusterVolumeInfo(gvolname, volfileServer)
+volTrans = VOLUME_TRANS_MAP[volInfo[gvolname]['transportType'][0]]
+except GlusterException:
+# In case of issues with finding transport type, default to tcp
+self.log.warning(Unable to find transport type for GlusterFS
+ volume %s. GlusterFS server = %s.
+ Defaulting to tcp,
+ (gvolname, volfileServer), exc_info=True)
+volTrans = VOLUME_TRANS_MAP['TCP']
+
+# Use default port
+volPort = 0
+
+# sdUUID/images/imgUUID/volUUID
+imgFileRelPath = '/'.join(volPath.rsplit(/)[-4:])
+
+glusterPath = gvolname + '/' + imgFileRelPath
+
+return {'path': glusterPath,
+'protocol': 'gluster', 'volPort': volPort,
+'volTransport': volTrans,
+'volfileServer': volfileServer,
+'volType': 'network',
+}
def findDomain(sdUUID):
return GlusterStorageDomain(GlusterStorageDomain.findDomainPath(sdUUID))
diff --git a/vdsm/storage/glusterVolume.py b/vdsm/storage/glusterVolume.py
index 3368de3..1406cdd 100644
--- a/vdsm/storage/glusterVolume.py
+++ b/vdsm/storage/glusterVolume.py
@@ -1,8 +1,4 @@
-from volume import VmVolumeInfo
import fileVolume
-from sdc import sdCache
-import supervdsm as svdsm
-from gluster.exception import GlusterException
class GlusterVolume(fileVolume.FileVolume):
@@ -11,44 +7,3 @@
fileVolume.FileVolume.__init__(self, repoPath, sdUUID, imgUUID,
volUUID)
-def getVmVolumeInfo(self):
-
-Send info to represent Gluster volume as a network block device
-
-rpath = sdCache.produce(self.sdUUID).getRemotePath()
-rpath_list = rpath.rsplit(:, 1)
-volfileServer = rpath_list[0]
-volname = rpath_list[1]
-
-# Volume transport to Libvirt transport mapping
-VOLUME_TRANS_MAP = {'TCP': 'tcp', 'RDMA': 'rdma'}
-
-# Extract the volume's transport using gluster cli
-svdsmProxy = svdsm.getProxy()
-
-try:
-volInfo = svdsmProxy.glusterVolumeInfo(volname, volfileServer)
-volTrans = VOLUME_TRANS_MAP[volInfo[volname]['transportType'][0]]
-except GlusterException:
-# In case of issues with finding transport type, default to tcp
-self.log.warning(Unable to find transport type for GlusterFS
- volume %s. GlusterFS server = %s.
- Defaulting to tcp,
- (volname, volfileServer), exc_info=True)
-volTrans = VOLUME_TRANS_MAP['TCP']
-
-# Use default port
-volPort = 0
-
-imgFilePath = self.getVolumePath()
-imgFilePath_list = imgFilePath.rsplit(/)
-
-# Extract path to the image, relative to the gluster mount
-imgFileRelPath = /.join(imgFilePath_list[-4:])
-
-glusterPath = volname + '/' + imgFileRelPath
-
-return {'volType': VmVolumeInfo.TYPE_NETWORK, 'path': glusterPath,
-'protocol': 'gluster', 'volPort': volPort,
-'volTransport': volTrans,
-