From: Mitsuhiro Tanino <mitsuhiro.tanino@hds.com>
Date: Fri, 23 Jan 2015 22:06:12 +0000 (-0500)
Subject: Remove unnecessary method: _ensure_iscsi_targets() in tgt.py
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=499f36869cd081e383cb0ca82a3f656b296f6343;p=openstack-build%2Fcinder-build.git

Remove unnecessary method: _ensure_iscsi_targets() in tgt.py

This method is unnecessary in tgt.py after Target Object is
introduced at change-id I43190d1dac33748fe55fa00f260f32ab209be656.

Change-Id: I33a56db72535c7ea9bf6ddf43fbdd6eff923c9f3
---

diff --git a/cinder/volume/targets/tgt.py b/cinder/volume/targets/tgt.py
index b2a9ce30d..fcc9a664b 100644
--- a/cinder/volume/targets/tgt.py
+++ b/cinder/volume/targets/tgt.py
@@ -125,22 +125,6 @@ class TgtAdm(iscsi.ISCSITarget):
         iscsi_target = 0  # NOTE(jdg): Not used by tgtadm
         return iscsi_target, lun
 
-    def _ensure_iscsi_targets(self, context, host):
-        """Ensure that target ids have been created in datastore."""
-        # NOTE(jdg): tgtadm doesn't use the iscsi_targets table
-        # TODO(jdg): In the future move all of the dependent stuff into the
-        # cooresponding target admin class
-        host_iscsi_targets = self.db.iscsi_target_count_by_host(context,
-                                                                host)
-        if host_iscsi_targets >= self.configuration.iscsi_num_targets:
-            return
-
-        # NOTE(vish): Target ids start at 1, not 0.
-        target_end = self.configuration.iscsi_num_targets + 1
-        for target_num in xrange(1, target_end):
-            target = {'host': host, 'target_num': target_num}
-            self.db.iscsi_target_create_safe(context, target)
-
     def _get_target_chap_auth(self, name):
         volumes_dir = self.volumes_dir
         vol_id = name.split(':')[1]