hi Artur,

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 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.

[1]https://review.openstack.org/306685
[2]https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/objects/base.py#L434
[3]https://review.openstack.org/#/c/357207

Thanks Eli.

On 2016年08月18日 21:20, Korzeniewski, Artur wrote:
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] 
https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/objects/base.py#L433
[2] https://review.openstack.org/#/c/357207
-----Original Message-----
From: taget [mailto:qiaoliy...@gmail.com]
Sent: Thursday, August 18, 2016 5:08 AM
To: OpenStack Development Mailing List (not for usage questions) 
<openstack-dev@lists.openstack.org>
Cc: Qiao, Liyong <liyong.q...@intel.com>; Bhatia, Manjeet S 
<manjeet.s.bha...@intel.com>; Korzeniewski, Artur <artur.korzeniew...@intel.com>
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]https://review.openstack.org/#/c/306685/6/neutron/db/flavor/models.py@45
[2]https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/db/flavors_db.py#L86
[3]https://github.com/openstack/neutron/blob/9.0.0.0b2/neutron/objects/base.py#L429-L430
[4]https://review.openstack.org/#/c/307964/20/neutron/objects/router.py@33


--
Best Regards,
Eli Qiao (乔立勇), Intel OTC.

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to