]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Revert explicit usage of tgt-adm --conf option.
authorEoghan Glynn <eglynn@redhat.com>
Tue, 25 Sep 2012 14:52:38 +0000 (15:52 +0100)
committerEoghan Glynn <eglynn@redhat.com>
Tue, 25 Sep 2012 20:04:39 +0000 (21:04 +0100)
Fixes bug 1056246.

This reverts commit 0903603971033536751ba40df98a3c39175d3189.

This ensures that we fail-fast if the tgtd configuration does
not include the directory for volume iscsi target configs,
instead of only blowing up when tgtd is restarted.

Change-Id: I30aa3f1d8944eb33cd4a42d65e227031023406b4

cinder/tests/test_iscsi.py
cinder/volume/iscsi.py

index 04ebf233e41828da58e5048630c1e0693077d5f7..38c760835b095f67fd272b083973803e04672c72 100644 (file)
@@ -95,8 +95,7 @@ class TgtAdmTestCase(test.TestCase, TargetAdminTestCase):
         self.flags(iscsi_helper='tgtadm')
         self.flags(volumes_dir=self.persist_tempdir)
         self.script_template = "\n".join([
-        'tgt-admin --conf %s/blaa --update iqn.2011-09.org.foo.bar:blaa'
-            % self.persist_tempdir,
+        'tgt-admin --update iqn.2011-09.org.foo.bar:blaa',
         'tgt-admin --delete iqn.2010-10.org.openstack:volume-blaa'])
 
     def tearDown(self):
index ec6e408946e09ea336feacaf32857f30e070d7b0..3fcc9bdc303066e80e71356026699a3a0416ad2c 100644 (file)
@@ -119,7 +119,8 @@ class TgtAdm(TargetAdmin):
         """ % (name, path)
 
         LOG.info(_('Creating volume: %s') % vol_id)
-        volume_path = os.path.join(FLAGS.volumes_dir, vol_id)
+        volumes_dir = FLAGS.volumes_dir
+        volume_path = os.path.join(volumes_dir, vol_id)
 
         f = open(volume_path, 'w+')
         f.write(volume_conf)
@@ -127,8 +128,6 @@ class TgtAdm(TargetAdmin):
 
         try:
             (out, err) = self._execute('tgt-admin',
-                                       '--conf',
-                                       volume_path,
                                        '--update',
                                        name,
                                        run_as_root=True)
@@ -143,6 +142,9 @@ class TgtAdm(TargetAdmin):
         iqn = '%s%s' % (FLAGS.iscsi_target_prefix, vol_id)
         tid = self._get_target(iqn)
         if tid is None:
+            LOG.error(_("Failed to create iscsi target for volume "
+                        "id:%(vol_id)s. Please ensure your tgtd config file "
+                        "contains 'include %(volumes_dir)s/*'") % locals())
             raise exception.NotFound()
 
         return tid