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

« back to all changes in this revision

Viewing changes to nova/api/openstack/compute/servers.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Adam Gandelman, Chuck Short
  • Date: 2012-09-25 10:54:59 UTC
  • mfrom: (1.1.63)
  • Revision ID: package-import@ubuntu.com-20120925105459-fr27butcb6p498gp
Tags: 2012.2~rc2-0ubuntu1
[ Adam Gandelman ]
* debian/control: Add python-cinderclient to python-nova Depends.
* wrap-and-sort.

[ Chuck Short ]
* debian/nova-common.postinst: Change root_helper to rootwrap_config
  when upgrading from precise
* debian/pydist-overrides: dont try to install babel.
* New upstream version.
* debian/rules: FTBFS if testsuite fails.

Show diffs side-by-side

added added

removed removed

Lines of Context:
193
193
        if security_groups is not None:
194
194
            server["security_groups"] = security_groups
195
195
 
 
196
        # NOTE(vish): this is not namespaced in json, so leave it without a
 
197
        #             namespace for now
 
198
        block_device_mapping = self._extract_block_device_mapping(server_node)
 
199
        if block_device_mapping is not None:
 
200
            server["block_device_mapping"] = block_device_mapping
 
201
 
196
202
        # NOTE(vish): Support this incorrect version because it was in the code
197
203
        #             base for a while and we don't want to accidentally break
198
204
        #             anyone that might be using it.
206
212
 
207
213
        return server
208
214
 
 
215
    def _extract_block_device_mapping(self, server_node):
 
216
        """Marshal the block_device_mapping node of a parsed request"""
 
217
        node = self.find_first_child_named(server_node, "block_device_mapping")
 
218
        if node:
 
219
            block_device_mapping = []
 
220
            for child in self.extract_elements(node):
 
221
                if child.nodeName != "mapping":
 
222
                    continue
 
223
                mapping = {}
 
224
                attributes = ["volume_id", "snapshot_id", "device_name",
 
225
                              "virtual_name", "volume_size"]
 
226
                for attr in attributes:
 
227
                    value = child.getAttribute(attr)
 
228
                    if value:
 
229
                        mapping[attr] = value
 
230
                attributes = ["delete_on_termination", "no_device"]
 
231
                for attr in attributes:
 
232
                    value = child.getAttribute(attr)
 
233
                    if value:
 
234
                        mapping[attr] = utils.bool_from_str(value)
 
235
                block_device_mapping.append(mapping)
 
236
            return block_device_mapping
 
237
        else:
 
238
            return None
 
239
 
209
240
    def _extract_scheduler_hints(self, server_node):
210
241
        """Marshal the scheduler hints attribute of a parsed request"""
211
242
        node = self.find_first_child_named(server_node,