~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/volume/iscsi.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-09-26 12:56:25 UTC
  • mfrom: (1.1.64)
  • Revision ID: package-import@ubuntu.com-20120926125625-27eb9h4hadrjqzjm
Tags: 2012.2~rc3-0ubuntu1
New upstream relase. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
        """Delete a target."""
76
76
        raise NotImplementedError()
77
77
 
78
 
    def show_target(self, tid, **kwargs):
 
78
    def show_target(self, tid, iqn=None, **kwargs):
79
79
        """Query the given target ID."""
80
80
        raise NotImplementedError()
81
81
 
119
119
        """ % (name, path)
120
120
 
121
121
        LOG.info(_('Creating volume: %s') % vol_id)
122
 
        volume_path = os.path.join(FLAGS.volumes_dir, vol_id)
 
122
        volumes_dir = FLAGS.volumes_dir
 
123
        volume_path = os.path.join(volumes_dir, vol_id)
123
124
 
124
125
        f = open(volume_path, 'w+')
125
126
        f.write(volume_conf)
127
128
 
128
129
        try:
129
130
            (out, err) = self._execute('tgt-admin',
130
 
                                       '--conf',
131
 
                                       volume_path,
132
131
                                       '--update',
133
132
                                       name,
134
133
                                       run_as_root=True)
143
142
        iqn = '%s%s' % (FLAGS.iscsi_target_prefix, vol_id)
144
143
        tid = self._get_target(iqn)
145
144
        if tid is None:
 
145
            LOG.error(_("Failed to create iscsi target for volume "
 
146
                        "id:%(vol_id)s. Please ensure your tgtd config file "
 
147
                        "contains 'include %(volumes_dir)s/*'") % locals())
146
148
            raise exception.NotFound()
147
149
 
148
150
        return tid
168
170
 
169
171
        os.unlink(volume_path)
170
172
 
171
 
    def show_target(self, tid, **kwargs):
172
 
        iqn = kwargs.get('iqn', None)
173
 
 
 
173
    def show_target(self, tid, iqn=None, **kwargs):
174
174
        if iqn is None:
175
175
            raise exception.InvalidParameterValue(
176
176
                err=_('valid iqn needed for show_target'))
207
207
                  '--tid=%s' % tid,
208
208
                  **kwargs)
209
209
 
210
 
    def show_target(self, tid, **kwargs):
 
210
    def show_target(self, tid, iqn=None, **kwargs):
211
211
        self._run('--op', 'show',
212
212
                  '--tid=%s' % tid,
213
213
                  **kwargs)