[openstack-dev] [neutron][ovo] Need help to understand the exception of NeutronSyntheticFieldMultipleForeignKeys
Korzeniewski, Artur
artur.korzeniewski at intel.com
Thu Aug 18 13:20:34 UTC 2016
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:qiaoliyong at gmail.com]
Sent: Thursday, August 18, 2016 5:08 AM
To: OpenStack Development Mailing List (not for usage questions) <openstack-dev at lists.openstack.org>
Cc: Qiao, Liyong <liyong.qiao at intel.com>; Bhatia, Manjeet S <manjeet.s.bhatia at intel.com>; Korzeniewski, Artur <artur.korzeniewski at 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.
More information about the OpenStack-dev
mailing list