From: Sumit Naiksatam Date: Sat, 20 Aug 2011 01:46:34 +0000 (-0700) Subject: Code refactored, made changes are per reviwer's suggestions. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=efcbdde237cec0ca9689c9353cbc87596973f911;p=openstack-build%2Fneutron-build.git Code refactored, made changes are per reviwer's suggestions. --- diff --git a/quantum/plugins/cisco/nova/quantum_aware_scheduler.py b/quantum/plugins/cisco/nova/quantum_aware_scheduler.py index c82db878b..b5f21ac82 100644 --- a/quantum/plugins/cisco/nova/quantum_aware_scheduler.py +++ b/quantum/plugins/cisco/nova/quantum_aware_scheduler.py @@ -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" diff --git a/quantum/plugins/cisco/nova/vifdirect.py b/quantum/plugins/cisco/nova/vifdirect.py index f3c369957..1565bfe57 100644 --- a/quantum/plugins/cisco/nova/vifdirect.py +++ b/quantum/plugins/cisco/nova/vifdirect.py @@ -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(':', '')