Fix bugs
diff --git a/plstackapi/core/api/slivers.py b/plstackapi/core/api/slivers.py
index 0fcc191..c41ffba 100644
--- a/plstackapi/core/api/slivers.py
+++ b/plstackapi/core/api/slivers.py
@@ -7,6 +7,7 @@
from plstackapi.core.api.images import _get_images
from plstackapi.core.api.keys import _get_keys
from plstackapi.core.api.slices import _get_slices
+from plstackapi.core.api.slices import _get_sites
from plstackapi.core.api.deployment_networks import _get_deployment_networks
from plstackapi.core.api.nodes import _get_nodes
@@ -31,14 +32,16 @@
if flavors: fields['flavor'] = flavors[0]
images = _get_images(fields.get('image'))
if images: fields['image'] = images[0]
- keys = _get_keys(fields.get('get'))
+ keys = _get_keys(fields.get('key'))
if keys: fields['key'] = keys[0]
slices = _get_slices(fields.get('slice'))
- if slices: fields['slice'] = slices[0]
+ if slices:
+ fields['slice'] = slices[0]
+ fields['site'] = slices[0].site
deployment_networks = _get_deployment_networks(fields.get('deploymentNetwork'))
if deployment_networks: fields['deploymentNetwork'] = deployment_networks[0]
nodes = _get_nodes(fields.get('node'))
- if nodes: fields['node'] = nodess[0]
+ if nodes: fields['node'] = nodes[0]
sliver = Sliver(**fields)
# create quantum sliver
diff --git a/plstackapi/core/serializers.py b/plstackapi/core/serializers.py
index 206c1e0..3692d1d 100644
--- a/plstackapi/core/serializers.py
+++ b/plstackapi/core/serializers.py
@@ -165,13 +165,13 @@
model = Sliver
fields = ('id',
'instance_id',
- 'name'
+ 'name',
'flavor',
'image',
- 'key'
+ 'key',
'slice',
- 'deployment_network',
- 'noode')
+ 'deploymentNetwork',
+ 'node')
class NodeSerializer(serializers.HyperlinkedModelSerializer):
# HyperlinkedModelSerializer doesn't include the id by default
diff --git a/plstackapi/core/views/deployment_networks.py b/plstackapi/core/views/deployment_networks.py
index d57962a..7f495e6 100644
--- a/plstackapi/core/views/deployment_networks.py
+++ b/plstackapi/core/views/deployment_networks.py
@@ -15,9 +15,12 @@
def post(self, request, format = None):
data = parse_request(request.DATA)
+ print "REQUESTDATA"
+ print data
if 'auth' not in data:
return Response(status=status.HTTP_400_BAD_REQUEST)
elif 'deploymentNetwork' in data:
+
deployment = add_deployment_network(data['auth'], data['deploymentNetwork'].get('name'))
serializer = DeploymentNetworkSerializer(deployment)
return Response(serializer.data, status=status.HTTP_201_CREATED)
diff --git a/plstackapi/openstack/manager.py b/plstackapi/openstack/manager.py
index eb76ff7..8181c36 100644
--- a/plstackapi/openstack/manager.py
+++ b/plstackapi/openstack/manager.py
@@ -45,7 +45,6 @@
node_chunks = chunks(compute_nodes, nodes_per_site)
for name in new_node_names:
- for
node = Node(name=compute_nodes_dict[name].hypervisor_hostname)
node.save()