[openstack-dev] [Zun]Use 'uuid' instead of 'id' as object ident in data model

Wenzhi Yu wenzhi_yu at 163.com
Mon Feb 20 06:14:20 UTC 2017


Hi team,

I need your advice on this patch[1], which aims to implement etcd DB data model and API
for 'ResourceClass' object.

As you may know, in mysql implementation, mysql will generate a 'id' field, which is an
unique and auto increase integer. The 'id' is also used as 'primary key' or 'foreign key'
in mysql[2].

However, in etcd implementation, etcd will NOT generate this 'id' itself, so I intend to
use the 'uuid' attribute of the object instead of 'id', and modify the DB API method to use
'uuid' as object ident instead of 'id', like[3]. Personally I feel using 'uuid' is more
reasonable because 'id' is a specific field in DB like mysql, seems it does not have actual
meaning in data model, right?

An alternative way Hongbin suggested is to generate an unique 'id' like mysql by ourselves
and insert the 'id' into etcd data model. But he said he's OK with the idea to replace 'id'
with 'uuid' if it does not break anything.

What's your opinion on this issue? Thanks in advance!

[1]https://review.openstack.org/#/c/434909/
[2]https://github.com/openstack/zun/blob/c0cebba170b8e3ea5e62e335536cf974bbbf08ec/zun/db/sqlalchemy/models.py#L200
[3]https://github.com/openstack/zun/blob/c0cebba170b8e3ea5e62e335536cf974bbbf08ec/zun/db/etcd/api.py#L209 <https://github.com/openstack/zun/blob/c0cebba170b8e3ea5e62e335536cf974bbbf08ec/zun/db/etcd/api.py#L209>

Best Regards,
Wenzhi Yu (yuywz)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170220/88435ba2/attachment.html>


More information about the OpenStack-dev mailing list