]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Code refactored, made changes are per reviwer's suggestions.
authorSumit Naiksatam <snaiksat@cisco.com>
Sat, 20 Aug 2011 01:46:34 +0000 (18:46 -0700)
committerSumit Naiksatam <snaiksat@cisco.com>
Sat, 20 Aug 2011 01:46:34 +0000 (18:46 -0700)
quantum/plugins/cisco/nova/quantum_aware_scheduler.py
quantum/plugins/cisco/nova/vifdirect.py

index c82db878b73c282e498e002edda3efee7f4447f4..b5f21ac82056093659748284ad83bc132db758db 100644 (file)
@@ -58,14 +58,12 @@ class QuantumScheduler(driver.Scheduler):
                  {'instance-id': instance_id,
                   'instance-desc': \
                   {'user_id': user_id, 'project_id': project_id}}}
-        client = Client(HOST, PORT, USE_SSL)
-        content_type = "application/json"
-        body = Serializer().serialize(instance_data_dict, content_type)
-        request_url = "/novatenants/" + project_id + "/get_host.json"
-        res = client.do_request(TENANT_ID, 'PUT', request_url, body=body)
-        content = res.read()
-        data = Serializer().deserialize(content, content_type)
+        client = Client(HOST, PORT, USE_SSL, format='json')
+        request_url = "/novatenants/" + project_id + "/get_host"
+        data = client.do_request(TENANT_ID, 'PUT', request_url,
+                                 body=instance_data_dict)
         hostname = data["host_list"]["host_1"]
+
         if not hostname:
             raise driver.NoValidHost(_("Scheduler was unable to locate a host"
                                        " for this request. Is the appropriate"
index f3c3699576b119d1ac55437626d68db96f5039d1..1565bfe57e4b448da32c490bcb7cc2c12e5b2e0f 100644 (file)
@@ -57,15 +57,14 @@ class Libvirt802dot1QbhDriver(VIFDriver):
                  {'instance-id': instance_id,
                   'instance-desc': \
                   {'user_id': user_id, 'project_id': project_id}}}
-        client = Client(HOST, PORT, USE_SSL)
-        content_type = "application/json"
-        body = Serializer().serialize(instance_data_dict, content_type)
-        request_url = "/novatenants/" + project_id + "/get_instance_port.json"
-        res = client.do_request(TENANT_ID, 'PUT', request_url, body=body)
-        content = res.read()
-        data = Serializer().deserialize(content, content_type)
+
+        client = Client(HOST, PORT, USE_SSL, format='json')
+        request_url = "/novatenants/" + project_id + "/get_instance_port"
+        data = client.do_request(TENANT_ID, 'PUT', request_url,
+                                 body=instance_data_dict)
         device = data['vif_desc']['device']
         portprofile = data['vif_desc']['portprofile']
+
         LOG.debug(_("Quantum returned device: %s\n") % device)
         LOG.debug(_("Quantum returned portprofile: %s\n") % portprofile)
         mac_id = mapping['mac'].replace(':', '')