diff options
| author | Eoghan Glynn <eglynn@redhat.com> | 2012-09-25 15:31:58 +0100 |
|---|---|---|
| committer | Eoghan Glynn <eglynn@redhat.com> | 2012-09-25 17:50:20 +0100 |
| commit | 3f85c9b381670fbe1086e0aca862d8868dee25e2 (patch) | |
| tree | dad207abc99cf0360132350d24cc6a2b731150e9 | |
| parent | 13a08f6ec7969c4ec6bd4b3bd816bb2a40f9896a (diff) | |
Revert explicit usage of tgt-adm --conf option.
Fixes bug 1056246.
Reverts commit 0a09bf5faeb30b675fdb8f517c61166ef794bad3.
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: I3c9f0d97e411560e5c0fd058671f8c834e9bed1e
| -rw-r--r-- | nova/tests/test_iscsi.py | 3 | ||||
| -rw-r--r-- | nova/volume/iscsi.py | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/nova/tests/test_iscsi.py b/nova/tests/test_iscsi.py index 7b2506a87..09a6e9e89 100644 --- a/nova/tests/test_iscsi.py +++ b/nova/tests/test_iscsi.py @@ -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): diff --git a/nova/volume/iscsi.py b/nova/volume/iscsi.py index 8742c1de3..c86188b30 100644 --- a/nova/volume/iscsi.py +++ b/nova/volume/iscsi.py @@ -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 |
