Change in vdsm[master]: virt: enable libgfapi
prasanna.kalever at redhat.com
prasanna.kalever at redhat.com
Mon May 2 12:01:38 UTC 2016
Hello Ala Hino,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/56907
to review the following change.
Change subject: virt: enable libgfapi
......................................................................
virt: enable libgfapi
With the introduction of GlusterFS libgfapi, QEMU supports glusterfs through
libgfapi directly.
To enable QEMU to use libgfapi, gluster disks as network devices
and required info, such as hosts list and image path, is provided.
Change-Id: Ia046fc018b55346c50cefe9f9b9c1ddd1aa9dcc9
Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
Signed-off-by: Ala Hino <ahino at redhat.com>
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever at redhat.com>
---
M vdsm/clientIF.py
M vdsm/storage/glusterVolume.py
M vdsm/storage/hsm.py
3 files changed, 23 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/56907/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 3f08183..ae3e34d 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -53,6 +53,7 @@
from virt import recovery
from virt import vm
from virt.vm import Vm
+from virt.vmdevices.storage import DISK_TYPE
try:
import gluster.api as gapi
_glusterEnabled = True
@@ -313,10 +314,19 @@
if res['status']['code']:
raise vm.VolumeError(drive)
- volPath = res['path']
# The order of imgVolumesInfo is not guaranteed
drive['volumeChain'] = res['imgVolumesInfo']
drive['volumeInfo'] = res['info']
+ if drive.get('diskType') == DISK_TYPE.NETWORK:
+ volinfo = res ['info']
+ volPath = volinfo['path']
+ drive['protocol'] = volinfo['protocol']
+ # currently, single host is provided due to this bug:
+ # https://bugzilla.redhat.com/1247521
+ drive['hosts'] = [volinfo['hosts'][0]]
+ else:
+ volPath = res['path']
+
# GUID drive format
elif "GUID" in drive:
diff --git a/vdsm/storage/glusterVolume.py b/vdsm/storage/glusterVolume.py
index b508097..3af23d3 100644
--- a/vdsm/storage/glusterVolume.py
+++ b/vdsm/storage/glusterVolume.py
@@ -71,7 +71,12 @@
glusterPath = volname + '/' + imgFileRelPath
- return {'volType': VmVolumeInfo.TYPE_NETWORK, 'path': glusterPath,
- 'protocol': 'gluster', 'volPort': volPort,
- 'volTransport': volTrans,
- 'volfileServer': volfileServer}
+ hosts = [dict(name=brick.split(":", 1)[0],
+ port=volPort,
+ transport=volTrans)
+ for brick in volInfo[volname]['bricks']]
+
+ return {'path': glusterPath,
+ 'protocol': 'gluster',
+ 'volfileServer': volfileServer,
+ 'hosts': hosts}
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index bd33b25..ac40e47 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3118,8 +3118,7 @@
path = os.path.join(dom.domaindir, sd.DOMAIN_IMAGES, imgUUID,
volUUID)
volInfo = {'domainID': sdUUID, 'imageID': imgUUID,
- 'volumeID': volUUID, 'path': path,
- 'volType': "path"}
+ 'volumeID': volUUID, 'path': path}
leasePath, leaseOffset = dom.getVolumeLease(imgUUID, volUUID)
@@ -3130,8 +3129,8 @@
})
imgVolumesInfo.append(volInfo)
- if volUUID == leafUUID:
- leafInfo = volInfo
+
+ leafInfo = dom.produceVolume(imgUUID, leafUUID).getVmVolumeInfo()
return {'path': leafPath, 'info': leafInfo,
'imgVolumesInfo': imgVolumesInfo}
--
To view, visit https://gerrit.ovirt.org/56907
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia046fc018b55346c50cefe9f9b9c1ddd1aa9dcc9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Prasanna Kumar Kalever <prasanna.kalever at redhat.com>
Gerrit-Reviewer: Ala Hino <ahino at redhat.com>
More information about the vdsm-patches
mailing list