From f1bb9c2e71764d2243ecb8af37f2e74d1984b3ce Mon Sep 17 00:00:00 2001 From: Amir Sadoughi Date: Tue, 9 Apr 2013 03:26:01 -0500 Subject: [PATCH] Fix for circular reference error On create_subnet, the quantum client passes in arguments to create a subnet with, including dns_nameservers and allocation_pools, which do not exist in quark's database models. SQLAlchemy causes these fields to exist in the model created and result as basic objects in the response object, which in turn is choked upon by oslo-incubator's jsonutils.to_primitive function. --- quark/plugin.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/quark/plugin.py b/quark/plugin.py index 2f7a336..8afe362 100644 --- a/quark/plugin.py +++ b/quark/plugin.py @@ -215,6 +215,12 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2): if not net: raise exceptions.NetworkNotFound(net_id=net_id) + # TODO(mdietz): do something clever with these + garbage = ["allocation_pools", "dns_nameservers"] + for k in garbage: + if k in subnet["subnet"]: + subnet["subnet"].pop(k) + new_subnet = db_api.subnet_create(context, **subnet["subnet"]) subnet_dict = self._make_subnet_dict(new_subnet) return subnet_dict