Add the rule of separate plugin for Nova REST API in devref

This patch adds the describe how to separate plugin when adding new
resource or some extended for existed resource.

Change-Id: Ib356aa9df0a3b85580ea2869ce4d043a6850967a
This commit is contained in:
He Jie Xu
2015-03-10 16:39:58 +08:00
committed by Lei Li
parent 322c6f398a
commit b5b86ae090

View File

@@ -97,6 +97,31 @@ another one in the future. Note that a 'discoverable' policy needs to be added
for each plugin that you wish to appear in the ``/extension`` output. Also
look at the authorize call in plugins currently merged.
Modularity
~~~~~~~~~~
The Nova REST API is separated into different plugins in the directory
'nova/api/openstack/compute/plugins/v3/'
Because microversions are supported in the Nova REST API, the API can be
extended without any new plugin. But for code readability, the Nova REST API
code still needs modularity. Here are rules for how to separate modules:
* You are adding a new resource
The new resource should be in standalone module. There isn't any reason to
put different resources in a single module.
* Add sub-resource for existing resource
To prevent an existing resource module becoming over-inflated, the
sub-resource should be implemented in a separate module.
* Add extended attributes for existing resource
In normally, the extended attributes is part of existing resource's data
model too. So this can be added into existing resource module directly and
lightly.
To avoid namespace complexity, we should avoid to add extended attributes
in existing extended models. New extended attributes needn't any namespace
prefix anymore.
Support files
-------------