From: MotoKen Date: Tue, 25 Sep 2012 05:08:34 +0000 (+0800) Subject: Fixes remove_export for IetAdm X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5b61536fdf17332f48af4b422fe23c2e153934a1;p=openstack-build%2Fcinder-build.git Fixes remove_export for IetAdm * Corrects indentation. * Uses specific iqn as keyword argument. Fixes bug 1055401 Change-Id: Ie99dd8a34924f0d7f447cf41a305353659a51d11 --- diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index a0bc3941b..76077c6f8 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -394,7 +394,7 @@ class ISCSIDriver(VolumeDriver): except exception.NotFound: LOG.info(_("Skipping remove_export. No iscsi_target " "provisioned for volume: %s"), volume['id']) - return + return else: iscsi_target = 0 diff --git a/cinder/volume/iscsi.py b/cinder/volume/iscsi.py index ec6e40894..54bc93e13 100644 --- a/cinder/volume/iscsi.py +++ b/cinder/volume/iscsi.py @@ -75,7 +75,7 @@ class TargetAdmin(object): """Delete a target.""" raise NotImplementedError() - def _show_target(self, tid, **kwargs): + def show_target(self, tid, iqn=None, **kwargs): """Query the given target ID.""" raise NotImplementedError() @@ -168,9 +168,7 @@ class TgtAdm(TargetAdmin): os.unlink(volume_path) - def show_target(self, tid, **kwargs): - iqn = kwargs.get('iqn', None) - + def show_target(self, tid, iqn=None, **kwargs): if iqn is None: raise exception.InvalidParameterValue( err=_('valid iqn needed for show_target')) @@ -198,16 +196,16 @@ class IetAdm(TargetAdmin): def _new_target(self, name, tid, **kwargs): self._run('--op', 'new', - '--tid=%s' % tid, - '--params', 'Name=%s' % name, - **kwargs) + '--tid=%s' % tid, + '--params', 'Name=%s' % name, + **kwargs) def _delete_target(self, tid, **kwargs): self._run('--op', 'delete', '--tid=%s' % tid, **kwargs) - def show_target(self, tid, **kwargs): + def show_target(self, tid, iqn=None, **kwargs): self._run('--op', 'show', '--tid=%s' % tid, **kwargs)