# HG changeset patch # User saurabh.vyas@oracle.com # Date 1453835593 28800 # Node ID 5b68a9f172920c562afa83a80297bb3697bca32a # Parent 409525ea516c76cf69d6ae73bbf1e71684f397bb 21241934 ZFSSA driver should return free (vs available) space 22158523 Can't boot zone as iscsi lun has changed diff -r 409525ea516c -r 5b68a9f17292 components/openstack/cinder/patches/10-zfssa-free-space.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/openstack/cinder/patches/10-zfssa-free-space.patch Tue Jan 26 11:13:13 2016 -0800 @@ -0,0 +1,57 @@ +From 075ff30d7d8bbeca1af634718f3cb19099bc44b3 Mon Sep 17 00:00:00 2001 +From: Abhiram Moturi +Date: Mon, 10 Aug 2015 14:23:09 +0000 +Subject: [PATCH] ZFSSA driver to return project 'available' space + +This fix allows the iSCSI driver to return the 'available' space +property at project level instead of the pool level which is more +accurate in cases when storage is not thin provisioned. + +Change-Id: I52dec5e527eab393fd464fbc7f4f910fafb67268 +Closes-Bug: #1479342 +--- +--- cinder-2014.2.2/cinder/volume/drivers/zfssa/zfssarest.py.~1~ 2015-11-08 22:01:48.358042338 -0800 ++++ cinder-2014.2.2/cinder/volume/drivers/zfssa/zfssarest.py 2015-11-08 22:02:05.691920138 -0800 +@@ -82,7 +82,7 @@ + 'ret.status': ret.status, + 'ret.data': ret.data}) + LOG.error(exception_msg) +- raise exception.InvalidVolume(reason=exception_msg) ++ raise exception.VolumeBackendAPIException(data=exception_msg) + + val = json.loads(ret.data) + +@@ -95,10 +95,31 @@ + LOG.error(exception_msg) + raise exception.InvalidInput(reason=pool) + +- avail = val['pool']['usage']['available'] + total = val['pool']['usage']['total'] + +- return avail, total ++ return total ++ ++ def get_project_stats(self, pool, project): ++ """Get available space of a project.""" ++ svc = '/api/storage/v1/pools/%s/projects/%s' % (pool, project) ++ ret = self.rclient.get(svc) ++ if ret.status != restclient.Status.OK: ++ exception_msg = (_('Error Getting Project Stats: ' ++ 'Pool: %(pool)s ' ++ 'Project: %(project)s ' ++ 'Return code: %(ret.status)d ' ++ 'Message: %(ret.data)s.') ++ % {'pool': pool, ++ 'project': project, ++ 'ret.status': ret.status, ++ 'ret.data': ret.data}) ++ LOG.error(exception_msg) ++ raise exception.VolumeBackendAPIException(data=exception_msg) ++ ++ val = json.loads(ret.data) ++ avail = val['project']['space_available'] ++ ++ return avail + + def create_project(self, pool, project, compression=None, logbias=None): + """Create a project on a pool diff -r 409525ea516c -r 5b68a9f17292 components/openstack/cinder/patches/11-zfssa-pep-iscsi.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/openstack/cinder/patches/11-zfssa-pep-iscsi.patch Tue Jan 26 11:13:13 2016 -0800 @@ -0,0 +1,25 @@ +--- cinder-2014.2.2/cinder/volume/drivers/zfssa/zfssaiscsi.py.~1~ 2015-02-05 08:03:26.000000000 -0800 ++++ cinder-2014.2.2/cinder/volume/drivers/zfssa/zfssaiscsi.py 2015-11-08 21:59:29.027424535 -0800 +@@ -290,7 +290,9 @@ + data["storage_protocol"] = self.protocol + + lcfg = self.configuration +- (avail, total) = self.zfssa.get_pool_stats(lcfg.zfssa_pool) ++ total = self.zfssa.get_pool_stats(lcfg.zfssa_pool) ++ avail = self.zfssa.get_project_stats(lcfg.zfssa_pool, ++ lcfg.zfssa_project) + if avail is None or total is None: + return + +@@ -334,9 +336,8 @@ + '') + + def ensure_export(self, context, volume): +- """Driver entry point to get the export info for an existing volume.""" +- LOG.debug('ensure_export: volume name: %s' % volume['name']) +- return self._export_volume(volume) ++ """Synchronously recreates an export for a volume.""" ++ pass + + def copy_image_to_volume(self, context, volume, image_service, image_id): + self.ensure_export(context, volume)