~ubuntu-branches/ubuntu/trusty/cinder/trusty

« back to all changes in this revision

Viewing changes to cinder/api/v2/volumes.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Yolanda Robla Mota, James Page, Chuck Short
  • Date: 2013-02-22 10:45:17 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20130222104517-ng3r6ace9vi4m869
Tags: 2013.1.g3-0ubuntu1
[ Yolanda Robla Mota ]
* d/control: Add BD on python-hp3parclient.
* d/patches: Drop patches related to disabling hp3parclient.

[ James Page ]
* d/control: Add Suggests: python-hp3parclient for python-cinder.
* d/control: Add BD on python-oslo-config.
* d/*: Wrapped and sorted.

[ Chuck Short ]
* New upstream release.
* debian/rules, debian/cinder-volumes.install: 
  - Fail if binaries are missing and install missing binaries.
* debian/patches/fix-ubuntu-tests.patch: Fix failing tests.
* debian/control: Add python-rtslib and python-mock.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
import webob
19
19
from webob import exc
20
 
from xml.dom import minidom
21
20
 
22
21
from cinder.api import common
23
22
from cinder.api.openstack import wsgi
27
26
from cinder import flags
28
27
from cinder.openstack.common import log as logging
29
28
from cinder.openstack.common import uuidutils
 
29
from cinder import utils
30
30
from cinder import volume
31
31
from cinder.volume import volume_types
32
32
 
51
51
    elem.set('availability_zone')
52
52
    elem.set('created_at')
53
53
    elem.set('name')
54
 
    elem.set('display_description')
 
54
    elem.set('description')
55
55
    elem.set('volume_type')
56
56
    elem.set('snapshot_id')
57
57
    elem.set('source_volid')
97
97
        volume = {}
98
98
        volume_node = self.find_first_child_named(node, 'volume')
99
99
 
100
 
        attributes = ['name', 'display_description', 'size',
 
100
        attributes = ['name', 'description', 'size',
101
101
                      'volume_type', 'availability_zone']
102
102
        for attr in attributes:
103
103
            if volume_node.getAttribute(attr):
119
119
 
120
120
    def default(self, string):
121
121
        """Deserialize an xml-formatted volume create request."""
122
 
        dom = minidom.parseString(string)
 
122
        dom = utils.safe_minidom_parse_string(string)
123
123
        volume = self._extract_volume(dom)
124
124
        return {'body': {'volume': volume}}
125
125
 
214
214
 
215
215
        return image_uuid
216
216
 
 
217
    @wsgi.response(202)
217
218
    @wsgi.serializers(xml=VolumeTemplate)
218
219
    @wsgi.deserializers(xml=CreateDeserializer)
219
220
    def create(self, req, body):
231
232
            volume['display_name'] = volume.get('name')
232
233
            del volume['name']
233
234
 
 
235
        # NOTE(thingee): v2 API allows description instead of description
 
236
        if volume.get('description'):
 
237
            volume['display_description'] = volume.get('description')
 
238
            del volume['description']
 
239
 
234
240
        req_volume_type = volume.get('volume_type', None)
235
241
        if req_volume_type:
236
242
            try:
302
308
        if not body:
303
309
            raise exc.HTTPUnprocessableEntity()
304
310
 
305
 
        if not 'volume' in body:
 
311
        if 'volume' not in body:
306
312
            raise exc.HTTPUnprocessableEntity()
307
313
 
308
314
        volume = body['volume']
310
316
 
311
317
        valid_update_keys = (
312
318
            'name',
313
 
            'display_description',
 
319
            'description',
314
320
            'metadata',
315
321
        )
316
322
 
323
329
            update_dict['display_name'] = update_dict['name']
324
330
            del update_dict['name']
325
331
 
 
332
        # NOTE(thingee): v2 API allows name instead of display_name
 
333
        if 'description' in update_dict:
 
334
            update_dict['display_description'] = update_dict['description']
 
335
            del update_dict['description']
 
336
 
326
337
        try:
327
338
            volume = self.volume_api.get(context, id)
328
339
            self.volume_api.update(context, volume, update_dict)