Allow name argument to flavor-access-add

Administrator cannot use the flavor name in arguments of
"nova flavor-access-add" and "nova flavor-access-remove".

This patch fixes this problem.

Change-Id: I68b267dc071382f1978efc2088cd8e837455e8b4
Related-Bug: #1205298
Add delete method to Flavor class

In tempest, some tests use delete() method of each resource class
(Server, SecurityGroup, etc.) for cleaning up when each test finishes.
Now we are adding some tests, which create a Flavor instance, to tempest
and we need the delete() method of Flavor class.

Fixes bug #1218156

Change-Id: I210d62aa45510858346315046cf57ea7b1de7b7b
python3: Fix Traceback while running unit tests

Python3 uses the the concepts of text and (binary) data
instead of Unicode strings and 8-bit strings. In python3
all text is unicode; however encoded unicode is represented
as binary data.

Use the six module to use six.binary_types and six.text_types
where apporiate:
- six.text_type unicode() in python2 and str in python3.
- six.basestring() in python2 and str in python3.

blueprint python3-novaclient

Change-Id: Ie7b393abe6beac22eaf127b7fc7bbc372c338211
Signed-off-by: Chuck Short <chuck.short@canonical.com>
python3: Fix traceback while running unit tests

While running unit tests with python3, we get the following traceback:

TypeError: 'map' object is not subscriptable

In python3, a map returns an iterable object of type map,
and is not subscriptable.

Refactor to not use indicies so that it is python2 and python3
compat.

blueprint python3-novaclient

Change-Id: Iaf0de19f08fa3e91ee79c174ccc86a8bbe4acdc8
Signed-off-by: Chuck Short <chuck.short@canonical.com>
python3: Compatibility for iteritems differences

In python3 dict.iteritems(), dict.iterkeys(), and
dict.itervalues() are no longer supported. So use
six.iteritems() where it is appropriate.

blueprint python3-novaclient

Change-Id: I8c39bfe426d08d36215b55c3245dcfc69ec72517
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Add a block device for the image when using BDMv2

Right now the cli was already adding a block device when it was passed
an image_id to boot from and more than one block device mapping v2. This
is done because nova expects the image to be another block device
mapping and would ignore it otherwise.

This patch moves this functionality from the cli to the base module so
users of the module can benefit from this and also to prevent some
misunderstandings that may arise when using BDMv2 and the image gets
ignored by nova. In the future we should handle this in the nova side
assuming a new BDM when an image is provided.

Fixes bug #1225061

Change-Id: I29f31c24f958cfa8b68b33edc63e0d7031aa241f
Modify --num-instances flag description to clarify limit upper bound

Closes Bug:#1220703

Modified --num-instances flag description in shell.py to clarify that
number of instances spawned are limited by the quota.

Change-Id: I29fa175f310ab1e073dca5f453a3540dcdde933d
Signed-off-by: Abhishek Lahiri <aviostack@gmail.com>
Small bugfix for client v3

Client.__init__ method used self.os_cache variable in an internal method call
though this variable had not been initialized earlier.
In addition, unittests added for full coverage of client v3.

Change-Id: I421f82932b65f137932d933e04d42064bec0d08d
assertEquals is deprecated, use assertEqual

assertEquals is deprecated in Python 2.7 , need drop it

http://docs.python.org/2/library/unittest.html#deprecated-aliases

Change-Id: I5aeeb3b289e1d29f6338fc9fd47e680909f0a133
Fix the print order of quota-show

Current "nova qouta-show" prints quotas by random order like the
following:

 $ nova quota-show
 +-----------------------------+-------+
 | Property                    | Value |
 +-----------------------------+-------+
 | metadata_items              | 128   |
 | injected_file_content_bytes | 10240 |
 | ram                         | 51200 |
 | floating_ips                | 10    |
 | key_pairs                   | 100   |
 | instances                   | 10    |
 | security_group_rules        | 20    |
 | injected_files              | 5     |
 | cores                       | 20    |
 | fixed_ips                   | -1    |
 | injected_file_path_bytes    | 255   |
 | security_groups             | 10    |
 +-----------------------------+-------+
 $

This patch fixes its order for fitting to the option order of
"nova quota-update" like the following:

 $ nova quota-show
 +-----------------------------+-------+
 | Quota                       | Limit |
 +-----------------------------+-------+
 | instances                   | 10    |
 | cores                       | 20    |
 | ram                         | 51200 |
 | floating_ips                | 10    |
 | fixed_ips                   | -1    |
 | metadata_items              | 128   |
 | injected_files              | 5     |
 | injected_file_content_bytes | 10240 |
 | injected_file_path_bytes    | 255   |
 | key_pairs                   | 100   |
 | security_groups             | 10    |
 | security_group_rules        | 20    |
 +-----------------------------+-------+

Fixes bug #1223233

Change-Id: I482fd26b9114ac718dc4a16753e7692213bd3690
Merge "Fix the print order of quota-show"
Merge "Add a block device for the image when using BDMv2"
Merge "Modify --num-instances flag description to clarify limit upper bound"
Merge "python3: Fix traceback while running unit tests"
Merge "python3: Compatibility for iteritems differences"
Merge "python3: Fix Traceback while running unit tests"
Merge "Allow name argument to flavor-access-add"
Merge "Add delete method to Flavor class"
Merge "assertEquals is deprecated, use assertEqual"