On 12/11/2012 01:01 AM, Akihiro MOTOKI wrote:
Hi,
I posted a patch for quantumclient: https://review.openstack.org/#/c/17345/
During the review a question is raised whether we need to support underscore
style (xxx_yyy) for new options?
I think it is good to share this and make some consensus among the core devs.
Previously we use underscore style options and just before Folsom release we
introduced dash style options to keep consistency with other OpenStack projects.
In my understanding dash style is recommended and underscore style
is deprecated, so it is reasonable new options only support dash style.
According to the review comment, Yong seems to have the same opinion.
Another question is: when should we drop underscore style option support?
My opinion is:
Not to care about the _. New options use '-'.
Some members talked about the _ when we use xx-update commands.
My opinion is:
1. xx-update commands are passing through to API with what it gets from
users. *It is convenient and flexible!*
It is helpful to remove lots of codes to configure arguments, and user
can get the arguments from xx-show command.
For example, If a user want to update a attr for a net named 'net1';
first of all, he typically will run 'quantum net-show net1' ,
gongysh@gongysh-laptop:~$ quantum net-show net1
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| id | d3cba5b5-0e6d-4995-a30e-7716b8044106 |
| name | net1 |
| provider:network_type | local |
| provider:physical_network | |
| provider:segmentation_id | |
| router:external | False |
| shared | False |
| status | ACTIVE |
| subnets | 697e7e7c-a05d-4c37-967a-997c4b7a2d4e |
| tenant_id | b7445f221cda4f4a8ac7db6b218b1339 |
+---------------------------+--------------------------------------+
After this command, he knows there are so much attrs for a network,
and he maybe want to update a attribute, assume 'router:external',
he just run the command with the attribute name as it is:
quantum net-update --router:external True
This is very flexible, in particular to extension features. Extension
often adds new attrs to existing resources,
we can use the unkown parts of our command lines to deal with them. *And
remember our extension can come and go according to
our plugin configured. Only the attributes that in core API can be fixed.*
2. We can not assume all the attribute are using '_' in quantum server.
Of course if we can, we can accept the '-' in unknown parts of our
quantum command lines:
For example, we can use both:
quantum net-create name1 --provider:physical-network danwent
and
quantum net-create name1 --provider:physical_network danwent
hopefully, it will not make salvatore dazzling.
with this assumption we can try to make use options anywhere after command:
quantum net-create --provider:physical-network test name1
quantum net-create name1 --provider:physical-network test
Thanks,
Akihiro
--
Mailing list: https://launchpad.net/~quantum-core
Post to : [email protected]
Unsubscribe : https://launchpad.net/~quantum-core
More help : https://help.launchpad.net/ListHelp