49 Commits

Author SHA1 Message Date
Gabriel Ramirez
176907f70e Allow openstack flavor set to update flavor description using name
Modified take_action() method for SetFlavor to use
flavor id instead of flavor name when setting description

Closes-Bug: #1844708 
Story: #2007781
Task: #40019

Change-Id: If6798c89fef4c9feb4ebb460722b891f5655037d
2020-06-10 22:49:44 +00:00
lihaijing
d15bbada73 Replace six.iteritems() with .items()
1. As mentioned in [1], we should avoid using six.iteritems to achieve
   iterators. We can use dict.items instead, as it will return iterators
   in PY3 as well. And dict.items/keys will more readable.

2. In py2, the performance about list should be negligible,
   see the link [2].

[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85
Implements: blueprint replace-iteritems-with-items
2020-01-09 18:41:29 +09:00
melissaml
aabc67f3a2 Rename review.openstack.org to review.opendev.org
There are many references to review.openstack.org, and while the
redirect should work, we can also go ahead and fix them.

Change-Id: I82e3797dd4c05e4944f40c950b4fafe9a5334cbf
2019-05-12 04:41:27 +08:00
tianhui
4a68ba625c Compute: Add description support for flavor
Co-Authored-By: Fan Zhang <zh.f@outlook.com>
Change-Id: I0dc80bee3ba6ff4ec8cc3fc113b6de7807e0bf2a
Story: 2002196
Task: 21681
2018-06-20 09:11:05 +00:00
Chen Hanxiao
e438c34eaa flavor: clarify --swap description
--swap will add a additional storage device,
which not affect the original swap partition/device.

This patch will clarify this misleading description.

Change-Id: Ic079c069985d39cc969b97876901007a81883f57
Signed-off-by: Chen Hanxiao <chenhx@certusnet.com.cn>
2017-12-28 14:56:13 +08:00
Dean Troyer
1686dc54f0 Help/docs cleanups: marker, limit, ip-address metavars
Cleanup help strings and docs for clarity and to keep things consistent:
* --limit metavar should be <num-resource> to indicate what is being counted
* --marker metavar should be <resource> or <resource-id> to indicate the
  type of value being specified
* <*-ip-address> metavars should be just <ip-address> as there is no difference
  in format between fixed and floating IPs
* Move all occurances of '(name or ID)' to end of help text

Change-Id: I2c31746ed6ded3845244e03e57d809f8bc0e6b9d
2017-04-04 03:56:19 +00:00
Jenkins
f945cf7b5c Merge "Handle log message interpolation by the logger in compute/" 2017-02-14 01:28:54 +00:00
Gábor Antal
1c91e9828d Handle log message interpolation by the logger in compute/
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Change-Id: Ib7b5fb5f794026fc8a84260c4803afea321a9cf5
Closes-Bug: #1596829
2017-02-13 18:43:12 +01:00
Reedip
6a3c7c2a68 Overwrite/Clear Flavor property
This patch adds support to overwrite/clear the flavor's
property using the new ``--no-property`` option in the
``flavor set`` command.

Change-Id: I873c96fcf223bbd638a19b908766d904a84e8431
Implements: blueprint allow-overwrite-set-options
Co-Authored By: zhiyong.dai@easystack.cn
2017-02-13 15:16:09 +00:00
Pavlo Shchelokovskyy
e637e9c6c8 Fix flavor create help re swap size units
nova actually expects and uses swap size in MB, while in openstackclient
currently help states that swap must be specified in GB and passes this
value to nova without changes.

Fix the help string.

Change-Id: I95f46246c072961ce77f818d80d75e6a51f728d0
Closes-Bug: #1656018
2017-01-12 18:27:14 +02:00
Jens Rosenboom
d8749f9148 Fix creating a private flavor with ID auto
When a private flavor is created with ID auto (=default) and a project
is specified for it, instead of trying to add the project to the flavor
called "auto" the ID of the newly created project should be used.

Change-Id: I19f7a0ec26bd5d147f00ecba3312240e3601567e
Closes-Bug: 1654221
2017-01-05 15:58:47 +01:00
Steve Martinelli
0ef8535036 translate all command help strings
Leverage the new cliff command class attribute (_description)
to get the help of a command, this allows us to mark strings
for translation. We could not do this before since the help
was grabbed from the docstring.

This also depends on a new release of cliff and a bump to the
minimum level in osc's requirements.

Closes-Bug: 1636209
Depends-On: Id915f6aa7d95a0ff3dc6e2ceaac5decb3f3bf0da
Change-Id: I8673080bb5625e8e3c499feaefd42dfc7121e96f
2016-11-17 02:33:42 +00:00
Huanxuan Ao
b0c317ebdd Add Support for showing flavor access list
Add a attribute "access_project_id" for flavor object to
display the access project id list by using "flavor show"
command.

Change-Id: I7f0c152b816e0ca2e32e47f9b5c1aa7663d33b6d
Closes-Bug:#1575461
2016-07-22 10:20:18 +08:00
Huanxuan Ao
dbed97a24d Add "--property" option to "flavor create" command
Add "--property" option to "flavor create" command to support
adding properties to a new falvor.

Change-Id: I4f06b364375d5a81584fe41122d48e9568fa712a
Closes-Bug: #1596798
2016-06-29 19:16:35 +08:00
Jenkins
775b1acccd Merge "Make set/unset commands in compute/image/common return normally when nothing specified" 2016-06-22 14:37:44 +00:00
Jenkins
de909e4afc Merge "Support bulk deletion for "flavor/aggregate delete"" 2016-06-22 06:48:50 +00:00
Huanxuan Ao
014835930d Add "--project" option to the "flavor create" command.
Add ``--project`` and ``--project-domain`` options to the
``flavor create`` command. We can use these options to add
the flavor access to a givin project when we create the flavor.

Change-Id: Ic1907272c1d1ae526f9c9e86f32ba06c6da147c0
2016-06-21 16:28:18 +00:00
Tang Chen
9c62af8a42 Make set/unset commands in compute/image/common return normally when nothing specified
After this patch, all set/unset commands will return normally
when nothing specified.

Change-Id: Id94d0329faa1a674006a9aae901f834b41917317
Close-bug: #1588588
2016-06-21 15:15:18 +08:00
Huanxuan Ao
640014fa91 Support bulk deletion for "flavor/aggregate delete"
Support bulk deletion and error handling for "aggregate delete"
and "flavor delete" commands.

Change-Id: I3f6105cbeeab1c9f8cd571c63ce0e7ac3d4252b3
Partially-Implements: blueprint multi-argument-compute
Partial-Bug: #1592906
2016-06-21 11:04:13 +08:00
Tang Chen
047cb68493 Standardize logger usage
Use file logger for all command specific logs.

This patch also fixes some usage that doesn't
follow rules in:
http://docs.openstack.org/developer/oslo.i18n/guidelines.html

After this patch, all self.log and self.app.log
will be standardized to LOG().

NOTE: In shell.py, we got the log in class OpenStackShell,
      which is also known as self.app.log in other classes.
      This logger is used to record non-command-specific logs.
      So we leave it as-is.

Change-Id: I114f73ee6c7e84593d71e724bc1ad00d343c1896
Implements: blueprint log-usage
2016-06-20 15:16:51 +00:00
Dean Troyer
9e2b8e6730 osc-lib: command
Leave command.py and test_command.py as a sanity check during the
deprecation period.

Change-Id: I24e1b755cbfbcbcaeb5273ec0c9706b82384fc85
2016-06-13 11:00:22 -05:00
Dean Troyer
be192676bd osc-lib: parseractions
Leave parseractions.py and test_parseractions.py as a sanity check during the
deprecation period.

Change-Id: I1a7469b6d872284e0276502a1a287bc0b87f8f83
2016-06-13 10:55:44 -05:00
Dean Troyer
e5e29a8fef osc-lib: utils
Use osc-lib directly for utils.

Leave openstackclient.common.utils for deprecation period.

Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
2016-06-13 10:50:44 -05:00
Dean Troyer
d20c863ebc osc-lib: exceptions
Use osc-lib directly for exceptions.

Leave openstackclient.common.exceptions for deprecation period.

Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
2016-06-13 10:50:01 -05:00
Huanxuan Ao
22c60f3ac7 Add support for removing flavor-access
Add "--project" and "--project-domain" options in
"flavor unset" command to remove flavor access.

Change-Id: Ia5c5a80d9890d5af066b75b4e202647c18c7d915
Partial-Bug: #1575461
2016-06-02 12:40:43 +08:00
Huanxuan Ao
c46a5597be Add support for setting flavor-access
This patch adds "--project" option in "flavor set" command to support
for setting flavor access.

Change-Id: I75b473600080d8ab1dd6ad01561c4f989ed3c3bd
Partial-Bug: #1575461
2016-05-30 16:26:09 +08:00
Tang Chen
5398c96e2a Fix i18n support for help and error messages in compute
Change-Id: Id6eebcb48d1b7b49b6636524506294edbc44a83f
Partial-bug: #1574965
2016-05-24 11:03:49 +08:00
Huanxuan Ao
681d6dc2de Make "flavor show" command to show a private flavor properly
The "flavor show" command could not show a
private flavor by flavor name becauce it could
not find a private flavor by flavor name.
In "until.find_resource(parsed_args.flavor)",
If parsed_args.falvor is a name of a flavor,
"flavors.find(name=parsed_args.flavor)"will be
called to find a flavor.But the default value of
"is_public" is "Ture" in "flavors.find()" so that
we can only find public flavors.If we want to find
all flaovrs by flavor name,we should add
"is_public=None" in "flavors.find()".

So I tried to change
"until.find_resource(parsed_args.flavor)" to
"until.find_resource(parsed_args.flavor, is_public=None)",
but then I could not find any flavor by flavor id
because "is_public" is an unexpected argument of
"flavors.get()" in "until.find_resource()".

In this case,I think "until.find_resource()"
can not find a private flavor properly,and
we should combine "manager.get(flavor.id)" and
"manager.find(name=flavor.name, is_public=None)"
by ourselve to find a flavor.

Also,this bug affects other flavor commands like
"flavor set/unset/delete",so I fix them in this patch too.

Change-Id: I4a4ed7b0a2f522ee04d1c3270afcda7064285c39
Closes-Bug: #1575478
2016-05-02 16:47:53 +08:00
Huanxuan Ao
4524b3605f Fix error in flavor set/unset command
In the "flavor set/unset" command,the "flavor" parameter
can be a name but can not be a id of a flavor.
I think we should find a flavor by using "utils.find_resource()"
in these commands.

Change-Id: I5836788f7ed18813f1ebde31bb808b7c3f932b80
Closes-Bug: #1575624
2016-04-28 19:59:53 +08:00
Sean Dague
97492c168f rxtx factor should be a float
The rxtx factor on compute flavors is a float in the API. OSC is
currently blocking float values.

Change-Id: Ifa9c14825f388d2821ff4b63ab8ae83fa9c8d88b
2016-04-04 16:18:31 -04:00
Yang Hongyang
37c0e57d11 Trivial: Reorder flavor op order in flavor.py
Classes should be in alphabetical order.

Change-Id: I7a35c3a2dd6d36c49f0d54dec5c14609a9168bd0
2016-03-01 11:21:47 +08:00
Tang Chen
f37eda3a27 Make SetFlavor and UnsetFlavor inherit from cliff.Command
set/unset comamnd classes should inherit from cliff.Command class.

Change-Id: I54e5608ac0768d7d94b7f7d516ea1948daefdc1b
Partial-Bug: 1546065
2016-02-27 03:46:30 +08:00
Brandon Palm
f49f0fead2 Fixed a bunch of spacing
Nothing too complicated here.  I fixed a bunch of spacing issues
that I saw in OSC.

Change-Id: I935ab48e7c5bac5f88ecdb3a05f73fb44fc9f41d
2016-02-23 10:38:58 -06:00
Akihiro Motoki
258c1102cc log take_action parameters in a single place
Previously each command logs take_action parameters explicitly
by using @utils.log_method decorator or log.debug().
Some commands have no logging.

This commit calls a logger in the base class and
drops all logging definition from individual commands.

Closes-Bug: #1532294
Change-Id: I43cd0290a4353c68c075bade9571c940733da1be
2016-02-02 09:58:32 +09:00
Akihiro Motoki
0e6b86ad94 Set up logger of each command by metaclass
compute.v2.flavor is changed in this commit as an initial example.

Partial-Bug: #1532294
Change-Id: I262af6ade0ae03fbe1cd2ad198faf4ebb4ecf7ce
2016-01-20 22:02:19 +09:00
Tang Chen
494659fbe4 Trivial: Remove useless return from files in compute.
Change-Id: I9dc6749256fcd53d292d7f658912c032e9ce9df5
2015-12-17 09:34:12 +08:00
liyingjun
9471115a9a Support pagination params for flavor list
Missing 'marker' and 'limit' params for `openstack flavor list` shell
command. It would be nice to have this when there are many flavors.

Closes-bug: #1505874
Change-Id: I088ac5d24f0d7595f5cbce14f063e296a449eb26
2015-10-21 08:24:58 +08:00
jiaxi
2fc800aace Making --property as required when openstack flavor unset
When using openstack flavor unset, the --property is needed,
so the --property should be a required parameter.

Close-Bug: #1474237
Change-Id: Id6913e1b263eddeb5dd44c3edb957206b68f816c
2015-07-18 08:29:54 -04:00
Marek Aufart
621434451f Add the ability to set and unset flavor properties
Added flavor set and unset command which allow manage flavor
properties called extra_specs.

Command flavor show output was extended with these properties.

Closes-Bug: 1434137
Change-Id: Ie469bade802de18aab9d58eda3fff46064008163
2015-03-19 13:54:19 -04:00
Igor_Bolotin
6d4678185d Added capabilities/options to 'openstack flavor list'
command to match capabilities already provided by
'nova flavor-list':

—public | --private | --all options allows to list
public only (default), private only or all flavors.

—long displays more field. This option also fetches
properties (extra-specs) for each flavor using separate
API call for each flavor and it’s too slow to be done by
default. However as an administrator - sometimes I need
to be able to see them for all flavors.

Removed empty “Extra Specs” column as well as "Swap" and
"RXTX Factor" from default output.

DocImpact
Closes-Bug: #1416780

Change-Id: I30cfa2c75e28daf17b936543a177c23ae1743c37
2015-02-03 07:57:20 -08:00
Steve Martinelli
019c155e9b Fine tune some of the helps commands
try and add some consistency with the show and delete commands.

replace 'show x' with 'display x'
change 'delete a y' with just 'delete y'

Change-Id: I47dfa8ee23ac5c41b355796415eb515155832f65
2015-01-13 00:58:57 -05:00
Dean Troyer
0720c78199 Command docs: flavor
Change-Id: Ie85ff7706ef08b70ab8ba99533465d90904cf393
2014-12-31 12:09:50 -06:00
Dean Troyer
5bb6c72ef7 Normalize more help strings
Change-Id: I2b21bc904e35c1cc50da369d148e607fe3e8cf90
2014-07-24 11:22:29 -05:00
Christian Berendt
3b485de6b0 replace string format arguments with function parameters
There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.

Change-Id: Ic749ac9eb55564ed631d57055a5a4dfc3aebd169
2014-05-20 13:49:56 +02:00
Dean Troyer
dfb0e3e3c1 Begin Python 3 compatability
* use six.iteritems()
* replace basestring with six.string_types
* convert print statements to functions (they're all debugging and should
  be removed eventually anyway)

* clean up OpenStack copyright: LLC -> Foundation

Change-Id: Icb14212bcb408e63816bfec3922a697bc1a6c946
2013-07-29 19:12:29 -05:00
Steve Martinelli
1a0d5ccc68 Remove api = apiName calls from each method
As discussed in https://review.openstack.org/#/c/36352/ for each
command, we were setting api = identity or volume... etc,
this was for an old way of calling commands that are is no longer
used.

Also removed openstackclient/common/command.py

Change-Id: I2705f35d343f2ae729dc22d6aed0b852b2f8ca19
2013-07-12 11:07:33 -05:00
Josh Kearney
f54012cf8e Removed unused imports.
Change-Id: Ib1bae16f996559c008fb1fe0b74f26b152854ea8
2013-03-15 11:10:46 -05:00
Dean Troyer
989485c7f9 Change create flavor to use default arguments
Most of the arguments required by the create flavor API can have
reasonable defaults and therefore can be made optional in the CLI.
This brings create flavor in line with the documented args in the
wiki at https://wiki.openstack.org/wiki/UnifiedCLI/Mapping#flavor

Change-Id: Iecb3baf72f9dc3981742ff7989780894e37921c9
2013-03-06 14:02:13 -06:00
Josh Kearney
f67daad716 Added compute flavor support.
Change-Id: Idb1eb2f838074ce5fb3d4aa7b72fd747ac6915c7
2013-02-28 11:49:11 -06:00