~ubuntu-branches/ubuntu/trusty/heat/trusty-security

« back to all changes in this revision

Viewing changes to heat/engine/resources/volume.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-10-12 16:53:03 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20131012165303-0sc41ujl3luuu56q
Tags: 2013.2~rc2-0ubuntu1
New upstream release candidate (LP: #1239156).

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from heat.common import exception
22
22
from heat.engine import clients
23
23
from heat.engine import resource
 
24
from heat.engine.resources import nova_utils
24
25
from heat.engine import scheduler
25
26
 
26
27
volume_backups = try_import('cinderclient.v1.volume_backups')
230
231
 
231
232
        try:
232
233
            server_api.delete_server_volume(self.server_id, self.volume_id)
233
 
        except clients.novaclient.exceptions.NotFound:
234
 
            logger.warning('%s - not found' % str(self))
 
234
        except (clients.novaclient.exceptions.BadRequest,
 
235
                clients.novaclient.exceptions.NotFound) as e:
 
236
            logger.warning('%s - %s' % (str(self), str(e)))
235
237
 
236
238
        yield
237
239
 
244
246
                try:
245
247
                    server_api.delete_server_volume(self.server_id,
246
248
                                                    self.volume_id)
247
 
                except clients.novaclient.exceptions.NotFound:
 
249
                except (clients.novaclient.exceptions.BadRequest,
 
250
                        clients.novaclient.exceptions.NotFound):
248
251
                    pass
249
252
                vol.get()
250
253
 
333
336
            'Description': _('Key/value pairs to associate with the volume.')},
334
337
        'imageRef': {
335
338
            'Type': 'String',
336
 
            'Description': _('If specified, the image to create the volume '
337
 
                             'from.')},
 
339
            'Description': _('DEPRECATED: use "image" instead.')},
 
340
        'image': {
 
341
            'Type': 'String',
 
342
            'Description': _('If specified, the name or ID of the image to '
 
343
                             'create the volume from.')},
338
344
        'source_volid': {
339
345
            'Type': 'String',
340
346
            'Description': _('If specified, the volume to use as source.')}
375
381
            'size': self.properties['size'],
376
382
            'availability_zone': self.properties['availability_zone']
377
383
        }
378
 
        optionals = ['snapshot_id', 'volume_type', 'imageRef', 'source_volid',
 
384
        if self.properties.get('image'):
 
385
            arguments['imageRef'] = nova_utils.get_image_id(
 
386
                self.nova(), self.properties['image'])
 
387
        elif self.properties.get('imageRef'):
 
388
            arguments['imageRef'] = self.properties['imageRef']
 
389
 
 
390
        optionals = ['snapshot_id', 'volume_type', 'source_volid',
379
391
                     'metadata']
380
392
        arguments.update((prop, self.properties[prop]) for prop in optionals
381
393
                         if self.properties[prop])