summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-10-26 03:54:12 +0000
committerGerrit Code Review <review@openstack.org>2012-10-26 03:54:12 +0000
commit549b26ab87b4d2a8a4facd832801afae88cbfb7a (patch)
treeeb8efd00e1aa739f3212df05568e9066268ffdf0 /nova/api
parent409de17308f221468e6e9d609752a57da34f1b3b (diff)
parent10caf4b48fa67b160e6024a801efbda292d44ebf (diff)
downloadnova-549b26ab87b4d2a8a4facd832801afae88cbfb7a.tar.gz
nova-549b26ab87b4d2a8a4facd832801afae88cbfb7a.tar.xz
nova-549b26ab87b4d2a8a4facd832801afae88cbfb7a.zip
Merge "Fix Broken XML Namespace Handling"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/servers.py10
-rw-r--r--nova/api/openstack/wsgi.py13
2 files changed, 14 insertions, 9 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index 9c182f3a5..ba88d72e7 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -241,13 +241,9 @@ class CommonDeserializer(wsgi.MetadataXMLDeserializer):
def _extract_scheduler_hints(self, server_node):
"""Marshal the scheduler hints attribute of a parsed request"""
- node = self.find_first_child_named(server_node,
- "OS-SCH-HNT:scheduler_hints")
- # NOTE(vish): Support the os: prefix because it is what we use
- # for json, even though OS-SCH-HNT: is more correct
- if not node:
- node = self.find_first_child_named(server_node,
- "os:scheduler_hints")
+ node = self.find_first_child_named_in_namespace(server_node,
+ "http://docs.openstack.org/compute/ext/scheduler-hints/api/v2",
+ "scheduler_hints")
if node:
scheduler_hints = {}
for child in self.extract_elements(node):
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py
index a7a3823e9..bfe0ec599 100644
--- a/nova/api/openstack/wsgi.py
+++ b/nova/api/openstack/wsgi.py
@@ -244,17 +244,26 @@ class XMLDeserializer(TextDeserializer):
listnames)
return result
+ def find_first_child_named_in_namespace(self, parent, namespace, name):
+ """Search a nodes children for the first child with a given name"""
+ for node in parent.childNodes:
+ if (node.localName == name and
+ node.namespaceURI and
+ node.namespaceURI == namespace):
+ return node
+ return None
+
def find_first_child_named(self, parent, name):
"""Search a nodes children for the first child with a given name"""
for node in parent.childNodes:
- if node.nodeName == name:
+ if node.localName == name:
return node
return None
def find_children_named(self, parent, name):
"""Return all of a nodes children who have the given name"""
for node in parent.childNodes:
- if node.nodeName == name:
+ if node.localName == name:
yield node
def extract_text(self, node):