From: Sean McGinnis Date: Tue, 7 Oct 2014 15:10:57 +0000 (-0500) Subject: Eqlx fix NoSuchOptError for volume_name_template on clone X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c11aeb9f8385408502be06ffc5869eb142136127;p=openstack-build%2Fcinder-build.git Eqlx fix NoSuchOptError for volume_name_template on clone The eqlx driver was referencing the volume_name_template config setting via self.configuration.volume_name_template. This option is not imported in self.configuration. The curent preferred method for volume clone is to reference the passed in name, avoiding the need for the driver to know what the naming template is all together. Change-Id: If4963bbe61574c006ad04e5e88d04c7f7bc7cee1 Closes-Bug: 1378369 --- diff --git a/cinder/tests/test_eqlx.py b/cinder/tests/test_eqlx.py index 4ddbab8d5..4324bed05 100644 --- a/cinder/tests/test_eqlx.py +++ b/cinder/tests/test_eqlx.py @@ -49,7 +49,6 @@ class DellEQLSanISCSIDriverTestCase(test.TestCase): self.configuration.eqlx_cli_max_retries = 5 self.configuration.eqlx_chap_login = 'admin' self.configuration.eqlx_chap_password = 'password' - self.configuration.volume_name_template = 'volume_%s' self._context = context.get_admin_context() self.driver = eqlx.DellEQLSanISCSIDriver( configuration=self.configuration) @@ -159,11 +158,9 @@ class DellEQLSanISCSIDriverTestCase(test.TestCase): def test_create_cloned_volume(self): self.driver._eql_execute = self.mox.\ CreateMock(self.driver._eql_execute) - src_vref = {'id': 'fake_uuid'} + src_vref = {'name': 'fake_uuid'} volume = {'name': self.volume_name} - src_volume_name = self.configuration.\ - volume_name_template % src_vref['id'] - self.driver._eql_execute('volume', 'select', src_volume_name, 'clone', + self.driver._eql_execute('volume', 'select', src_vref['name'], 'clone', volume['name']).\ AndReturn(['iSCSI target name is %s.' % self.fake_iqn]) self.driver._eql_execute('volume', 'select', volume['name'], diff --git a/cinder/volume/drivers/eqlx.py b/cinder/volume/drivers/eqlx.py index a4a778c67..81dfff021 100644 --- a/cinder/volume/drivers/eqlx.py +++ b/cinder/volume/drivers/eqlx.py @@ -410,8 +410,7 @@ class DellEQLSanISCSIDriver(SanISCSIDriver): def create_cloned_volume(self, volume, src_vref): """Creates a clone of the specified volume.""" try: - src_volume_name = self.configuration.\ - volume_name_template % src_vref['id'] + src_volume_name = src_vref['name'] out = self._eql_execute('volume', 'select', src_volume_name, 'clone', volume['name']) self.add_multihost_access(volume)