<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
hi Artur,<br>
<br>
Thanks for you response and suggestion, I update patch as your
suggestion [1], but I am not sure if the synth_objs can be loaded
correctly since<br>
it requires to use foreign_keys to get objects [2]. We may need to
implement your propose patch `Add support fro multiple foreign keys
in NeutronDbObject`[3] as some patches requires that too, I will
follow up with it.
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<br>
<div class="moz-cite-prefix"><br>
[1]<a class="moz-txt-link-freetext" href="https://review.openstack.org/306685">https://review.openstack.org/306685</a><br>
[2]<a class="moz-txt-link-freetext" href="https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/objects/base.py#L434">https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/objects/base.py#L434</a><br>
[3]<a class="moz-txt-link-freetext" href="https://review.openstack.org/#/c/357207">https://review.openstack.org/#/c/357207</a><br>
<br>
Thanks Eli.<br>
<br>
On 2016年08月18日 21:20, Korzeniewski, Artur wrote:<br>
</div>
<blockquote
cite="mid:5B943078C8FC6642A64B42E5ABD692D05CD44BE7@irsmsx105.ger.corp.intel.com"
type="cite">
<pre wrap="">Hi,
So in the first place, you do not need the multiple foreign keys in Flavor db use case.
You can only declare flavor_id and service_profile_id in FlavorServiceProfileBinding object, since the relationships ('flavor' and 'service_profile') is not used anywhere, only ids.
Secondly, nobody right now is working on improving the situation. I have two ideas how to fix it:
The example:
{
'network_id': 'id',
'agent_id': id
}
1) add a name of object to the value ('id' i.e.)
{
'network_id': 'Network.id',
'agent_id': 'Agent.id'
}
It would be kind of complicated to get this used in [1], where the foreign keys are accessed
2) get deeper structure like:
{
'Network': {'network_id': 'id'},
'Agent': {'agent_id': id}
}
It looks better, because you just add proper foreign key under the related object name. Then you can proceed without any issues in [1], just grab the proper object name value as dictionary of single foreign key, you can check the [2] to see how it should look like for second option.
Regards,
Artur
[1] <a class="moz-txt-link-freetext" href="https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/objects/base.py#L433">https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/objects/base.py#L433</a>
[2] <a class="moz-txt-link-freetext" href="https://review.openstack.org/#/c/357207">https://review.openstack.org/#/c/357207</a>
-----Original Message-----
From: taget [<a class="moz-txt-link-freetext" href="mailto:qiaoliyong@gmail.com">mailto:qiaoliyong@gmail.com</a>]
Sent: Thursday, August 18, 2016 5:08 AM
To: OpenStack Development Mailing List (not for usage questions) <a class="moz-txt-link-rfc2396E" href="mailto:openstack-dev@lists.openstack.org"><openstack-dev@lists.openstack.org></a>
Cc: Qiao, Liyong <a class="moz-txt-link-rfc2396E" href="mailto:liyong.qiao@intel.com"><liyong.qiao@intel.com></a>; Bhatia, Manjeet S <a class="moz-txt-link-rfc2396E" href="mailto:manjeet.s.bhatia@intel.com"><manjeet.s.bhatia@intel.com></a>; Korzeniewski, Artur <a class="moz-txt-link-rfc2396E" href="mailto:artur.korzeniewski@intel.com"><artur.korzeniewski@intel.com></a>
Subject: [neutron][ovo] Need help to understand the exception of NeutronSyntheticFieldMultipleForeignKeys
hi neutron ovo hacker:
Recently I am working on neutron OVO blue print, and found there are some blocking (slow progress) issues when tring to add new object to Neutron.
When I try to add Flavor related object on [1], I need to add 2 foreign_keys to FlavorServiceProfileBinding :
flavor_id: Flavor.id
service_profile_id: ServiceProfile.id
For ServiceProfile and Flavor object, FlavorServiceProfileBinding is a synthetic_fields, we refer FlavorServiceProfileBinding in [2], but in currently object base implementation, we only allow synthetic_fields to only have 1 foreignkeys[3].
can anyone help to clarify this? or give some guide on how to overcome [1]? If there's anyone who working on to fix it too?
P. S There are other use case for multiple foreign keys [4]
[1]<a class="moz-txt-link-freetext" href="https://review.openstack.org/#/c/306685/6/neutron/db/flavor/models.py@45">https://review.openstack.org/#/c/306685/6/neutron/db/flavor/models.py@45</a>
[2]<a class="moz-txt-link-freetext" href="https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/db/flavors_db.py#L86">https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/db/flavors_db.py#L86</a>
[3]<a class="moz-txt-link-freetext" href="https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/objects/base.py#L429-L430">https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/objects/base.py#L429-L430</a>
[4]<a class="moz-txt-link-freetext" href="https://review.openstack.org/#/c/307964/20/neutron/objects/router.py@33">https://review.openstack.org/#/c/307964/20/neutron/objects/router.py@33</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Best Regards,
Eli Qiao (乔立勇), Intel OTC.</pre>
</body>
</html>