1214 Commits

Author SHA1 Message Date
Dirk Mueller
ebee5e91b7 assertEquals is deprecated, use assertEqual
Change-Id: I9b2aaed969b046e0203ffa0c7278dff206cb8cd2
2013-09-30 22:25:17 +02:00
Jenkins
2ab334435f Merge "Fix AttributeError in Keypair._add_details()" 2013-09-24 21:12:11 +00:00
Roman Podolyaka
9e8dd063c6 Fix AttributeError in Keypair._add_details()
_add_details() method copies keypair attributes retrieved
from Nova to an instance of Keypair class. Trying to set
attribute 'id' fails with AttributeError, because Keypair
class has a read-only property 'id'.

We can safely omit setting of attribute 'id', because it's
just an implementation detail (the id of a table row in a
database), and keypairs for a given tenant are uniquely
identified using attribute 'name'.

Fixes bug 1223934

Change-Id: I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e
2013-09-24 10:32:04 +03:00
Alex Gaynor
991ab62ef1 Fixed several test failures on Python3
- Corrected places where `dict.keys()` was being treated as a list
- Corrected usage of `urllib.urlencode()`

Change-Id: I0a24b2f64fab6c905e20073ff7ebaa3c5ffe7c90
2013-09-23 17:55:24 -07:00
Jenkins
7a041f903a Merge "Make nova CLI use term "server" where possible" 2013-09-24 00:27:34 +00:00
Jenkins
46418534ff Merge "Update pbr usage" 2013-09-24 00:27:06 +00:00
Jenkins
4a68e2f42c Merge "Corrected several usage of keys() for Python 3" 2013-09-24 00:24:21 +00:00
Jenkins
e1dcf8f982 Merge "py33: dict.keys() is not a list in python3" 2013-09-24 00:24:20 +00:00
Jenkins
935e1fe167 Merge "py33: 'dict_keys' object does not support indexing" 2013-09-24 00:23:01 +00:00
Jenkins
4dfe753a6a Merge "Corrected usage of len(filter(...))" 2013-09-24 00:22:59 +00:00
Jenkins
122df7b798 Merge "Clean up a little cruft" 2013-09-23 23:52:30 +00:00
Jakub Ruzicka
aee366cc50 Make nova CLI use term "server" where possible
nova client was using terms "server" and "instance" interchangeably
which was very confusing.

This patch uses "server" where possible without touching the API.

Note that there are actions (instance-action, instance-action-list) and
arguments (--instance-name, --num-instances, ...) with "instance" in their
name which can't be changed easily.

Closes bug 1156648

Change-Id: I0570aa1c4dc9ad1852af307a2a4896f16073a6ab
2013-09-23 19:50:49 +02:00
Kui Shi
ac79703213 py33: dict.keys() is not a list in python3
Cast the dict.keys() to list when comparing its value with list.

Closes-Bug: #1228993

Change-Id: I59d13258935de3e9286845f857eaa602a5b690fb
2013-09-23 00:16:33 +08:00
Alex Gaynor
35e03a92e2 Corrected several usage of keys() for Python 3
Under Python2 dict.keys() returns a list, under Python 3 it returns an
iterator. Some places assumed that if they called keys() then it was
safe to modify the dict in a loop. Corrected this by calling list().

Change-Id: I7638263f288dd20590bd751d09194a919b921545
2013-09-22 09:04:20 -07:00
Kui Shi
f1c3b79c2b py33: 'dict_keys' object does not support indexing
In python 3, dict.keys() is a class of 'dict_keys', it does not
support indexing.

Cast the dict to list to get the "first" value of dict, which is
compatible with python 2&3.

Closes-Bug: #1229005

Change-Id: I561b7ada9e5ad936659a657b3161a9b93a15a788
2013-09-22 23:55:46 +08:00
Alex Gaynor
0ab364a98c Corrected usage of len(filter(...))
filter() returns an iterable, not a list on Python 3.

Change-Id: I8afb2962bcd193ab67017c98376359c0f28afc66
2013-09-22 08:38:54 -07:00
Monty Taylor
ce89f7b12a Update pbr usage
We've discovered that having versions in setup_requires leads to evil
and death. Also, the setup-hooks in setup.cfg are completely unnecessary
anymore.

Change-Id: I8878e635e0828bbddb81d9c6321a9f10ad3b89fe
2013-09-20 16:02:57 -07:00
Monty Taylor
c7e62d4c57 Clean up a little cruft
OpenStack runs a git service now, so instead of linking to github URLs,
link to git.openstack.org.
Versions for pbr in setup.py actually wind up being an error (and a very
odd one) Remove them.
The setup hook in setup.cfg is no longer needed.

Change-Id: I8f48ac194e6c01e9bb06fa5df6f2b2bf28c01636
2013-09-20 16:02:48 -07:00
Phil Day
8deaf3769d Novaclient shell list command should support a minimal server list
The Nova API supports both a basic (id and name) and detailed server
list, and this is supported in the client by the "detailed=True"
argument to servers.list().  However the shell do_list() method always
leaves this to its default value.  For administrators on a large
system, or where the tenants has a lot of instances a detailed list
can be painfully slow.

This change adds support for a --minimal option to list.

Fixes bug: 1228137

Change-Id: I3126ee6b372606a98f0d7a4e344556f8c05ae224
2013-09-20 13:59:14 +00:00
Jenkins
cafd5bf810 Merge "Add v3 HostManager" 2013-09-18 14:37:46 +00:00
Jenkins
0fd1ccc478 Merge "Create v3 tests directory" 2013-09-18 14:36:18 +00:00
Jenkins
45fcd6f7ba Merge "assertEquals is deprecated, use assertEqual" 2.15.0 2013-09-17 21:20:37 +00:00
Ben Nemec
57a22ec99c Add v3 HostManager
Some of the host code required changes to work with the v3 API.
This change adds a v3-compatible HostManager that inherits from
the 1_1 HostManager to make use of the functions that didn't
need to change.

bp v3-api

Change-Id: I3ef7ab4619d49c20ab1bdeb1185ad28b411d37a1
2013-09-17 14:35:43 -05:00
Ben Nemec
615ad3de54 Create v3 tests directory
Create a basic framework that inherits from v1_1 and can be
overridden as necessary in extension commits

bp v3-api

Change-Id: I611451e50a9e553a18777fa48f32e368b919605e
2013-09-17 14:35:43 -05:00
Jenkins
4e8caf8ed6 Merge "Add delete method to Flavor class" 2013-09-17 18:43:30 +00:00
Jenkins
ecb9b8bf3c Merge "Allow name argument to flavor-access-add" 2013-09-17 18:43:00 +00:00
Jenkins
ff97f4de78 Merge "python3: Fix Traceback while running unit tests" 2013-09-17 18:42:53 +00:00
Jenkins
0af541c727 Merge "python3: Compatibility for iteritems differences" 2013-09-17 18:42:19 +00:00
Jenkins
607e6e9aae Merge "python3: Fix traceback while running unit tests" 2013-09-17 18:42:17 +00:00
Jenkins
e9f2620a3e Merge "Modify --num-instances flag description to clarify limit upper bound" 2013-09-17 18:10:21 +00:00
Jenkins
ed817c8dc7 Merge "Add a block device for the image when using BDMv2" 2013-09-17 18:10:20 +00:00
Jenkins
80eb82792a Merge "Fix the print order of quota-show" 2013-09-17 17:37:33 +00:00
Ken'ichi Ohmichi
043ef5b757 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
2013-09-17 09:49:39 +09:00
Chang Bo Guo
889f5680a9 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
2013-09-16 17:20:54 -07:00
Vitaliy Kolosov
7edda206b1 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
2013-09-16 11:38:00 +03:00
Abhishek Lahiri
aeef15d6d3 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>
2013-09-14 05:38:55 +00:00
Xavier Queralt
2e8900b6dc 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
2013-09-13 18:27:45 +02:00
Chuck Short
450f02efe3 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>
2013-09-13 10:54:19 -04:00
Chuck Short
4f3c2c92a4 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>
2013-09-13 10:52:47 -04:00
Chuck Short
605a7ed2f2 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>
2013-09-13 10:51:13 -04:00
Jenkins
9a1304bfab Merge "Python3: Use six.StringIO for io.Bytes()" 2013-09-11 22:07:13 +00:00
Jenkins
447cf8d6e5 Merge "Python3: Fix traceback while running unit tests" 2013-09-11 18:09:43 +00:00
Jenkins
500bb6244d Merge "Add support for os-assisted-volume-snapshots" 2013-09-10 16:47:32 +00:00
Vitaliy Kolosov
3523ba90f6 Unittests added for client v1_1
Unittests test_client_set_management_url_v1_1 and
 test_client_get_reset_timings_v1_1 added.
 New methods covered:
 * client.set_management_url()
 * client.get_timings()
 * client.reset_timings()

Change-Id: I46cac01864a11fbaffc284d26f63b8e00f2631f0
2013-09-09 12:14:09 +03:00
Chuck Short
9d8869e01c Python3: Fix traceback while running unit tests
While running the unit tests with python3 the following
traceback appears:

TypeError: can't use a string pattern on a bytes-like object

This is due to the way that python2 and python3 handles unicodes.

Change-Id: I401f1cefed69780073222cae98d8da4c3d8031a8
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-09-07 12:35:13 -04:00
Chuck Short
28f9773420 Python3: Use six.StringIO for io.Bytes()
The newer version of six (1.4.1) provides six.StringIO which
is a fake file object for textual data. It's an alias for StringIO.StringIO
in python2 and io.StringIO in Python3.

Use the fake object where approiate.

Change-Id: I364001933b4f2305ac27b293a9a4a3fec36c8a49
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-09-07 12:28:46 -04:00
Chuck Short
cab4617225 Update oslo from oslo-incubator
Update oslo from oslo-incubator includes various python3
fixes.

Change-Id: Ie30a4c319125c3d4fb704254f8553bc8fd960eae
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-09-06 08:03:22 -04:00
Ken'ichi Ohmichi
bec4e51df4 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
2013-09-06 08:30:47 +09:00
Xavier Queralt
6a85c954c5 New syntax to boot from a block device mapping
Add new arguments and syntax for booting from a block device mapping
that use the new os-block-device-mapping-v2-boot extension. These
allow to:

 * boot from an image, volume or snapshot (--image, --boot-volume, --snapshot)
 * attach any type of block device (--block-device).
 * attach an swap disk on boot (--swap).
 * attach an ephemeral disk on boot (--ephemeral).

blueprint: improve-block-device-handling

DocImpact

Change-Id: I1aadeafed82b3bd1febcf0d1c3e64b258d6abeda
2013-09-04 17:12:21 +02:00
fujioka yuuichi
97da33fcf5 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
2013-09-03 02:07:35 +09:00