Commit Graph

60 Commits

Author SHA1 Message Date
Sean Dague 89cd6a0c49 move all tests to nova/tests/unit
As part of the split of functional and unit tests we need to isolate
the unit tests into a separate directory for having multiple test
targets in a sane way.

Part of bp:functional-tests-for-nova

Change-Id: Id42ba373c1bda6a312b673ab2b489ca56da8c628
2014-11-12 15:31:08 -05:00
Dheeraj Gupta cc17991d1a Support message queue clusters in inter-cell communication
Since cells use oslo.messaging to specify and store the message queue URL,
multiple hosts can be specified by manually modifying that URL in the database.
However, there is no way to specify multiple hosts during cell creation phase.
This patch adds a --broker_hosts option to `nova-manage cell create` command,
which is analogous to the rabbit_hosts option in nova.conf and can be used to
specify multiple message queue servers as a comma separated list. Each server
is specified using hostname:port with both being mandatory. The existing
--hostname and --port options continue to remain but are only considered if no
--broker_hosts is specified.
Internally, each host is converted to a oslo.messaging.TransportHost
and added to the generated TransportURL.
This patch also adds unit tests for creation of the TransportHosts from
user given input.

Change-Id: I14de860b1d12f3e2c0169b58651d580792d6ce0e
Closes-Bug: 1178541
2014-10-07 15:14:06 +00:00
Matt Riedemann 84612137ac Remove the nova-manage flavor sub-command
The nova-manage flavor sub-command was deprecated in Juno milestone-1
via commit a601556684 with a note that it
will be removed in Kilo.

This removes it.

Change I4e2399f2fbab2c20299dd62c104b9220c1d36fb2 is to remove the
related Tempest tests.

Change-Id: I1798c8a0697009b3dcebeb818580c8323880e395
2014-10-01 19:36:42 -07:00
Davanum Srinivas 826aed0ec7 Use oslo.i18n
oslo.i18n provides the i18n functions that were provided by
oslo-incubator's gettextutils module. Some tests that were
using internal details of the library were removed.

Change-Id: I44cfd5552e0dd86af21073419d31622f5fdb28e0
2014-07-18 14:28:09 -04:00
Davanum Srinivas f3dc6eefe7 Fix and gate on H305 and H307
Both H305 and H307 are part of the OpenStack style guide.

Ensure that there are 3 groups of imports, stdlib,
third-party and project specific. Within each category
ensure that imports are in alphabetical order.

Change-Id: Id4994551c135c3c1a4982153f0c6cacba6176b95
2014-07-15 01:13:26 +00:00
Sergey Nikitin 543a03d438 Replace assertTrue/False with assertEqual/NotEqual
The following replacements were done in tests to have
clearer messages in case of failure:
- assertTrue(* == *) with assertEqual
- assertTrue(* != *) with assertNotEqual
- assertFalse(* == *) with assertNotEqual

Change-Id: Idbb1a292cf8545b87728fa2b815c67f923ef6efa
2014-06-20 13:36:50 +04:00
gengjh e251535eaa Fix the wrong dest of 'vlan' option and add new 'vlan_start' option
* Allow to specify vlan tag when create nova network, the dest of vlan
option should be 'vlan' instead of 'vlan_start'
* Provide new option 'vlan_start' when create nova network
* test case is updated.

DocImpact
Closes-Bug: #1288609
Change-Id: I8dd858e4cf17d8f689613554d1fbc3e56f220886
2014-06-12 15:30:37 +00:00
Mohammed Naser 1722378c85 Remove utils.reset_is_neutron() to avoid races
If a unit test does not call utils.reset_is_neutron() when
it is complete, it may introduce a race condition because
the utils.is_neutron() value is cached to the old result.

This patch removes the utils.reset_is_neutron() and instead
makes sure that we never have a cached value for it.  It
also refactors _is_neutron out of vmwareapi.VMOps because
it cache the result unnecessarily.

Change-Id: I2440e308b00979b31c750513d14608808a295c33
Closes-Bug: #1309043
2014-04-17 23:09:32 +00:00
Mohammed Naser a581823ece Disable nova-manage network commands with Neutron V2
When using nova-manage with neutron v2 API, all CRUD operations
should be done directly against the neutron API, rather than
using nova-manage.

Change-Id: I663bd06eb50872f16fc9889dde917277739fefce
Closes-Bug: #1019895
2014-04-16 14:00:15 +00:00
liu-sheng 74f953a1d7 Remove vi modelines
We don't need to have the vi modelines in each source file,
it can be set in a user's vimrc if required.

Also a check is added to hacking to detect if they are re-added.

Change-Id: I347307a5145b2760c69085b6ca850d6a9137ffc6
Closes-Bug: #1229324
2014-02-03 14:19:44 +00:00
Dan Smith 71f3056ddf Make nova-network use Network object for remaining "get" queries
This makes nova-network manager use the Network object for the
remaining single-item "get" queries.

Related to blueprint nova-network-objects

Change-Id: I6b1764e3c95337982cf4fbf503ddcb755e33cf2b
2014-01-30 09:27:33 -08:00
Zhongyue Luo d815bbd4df Replace assertEquals with assertEqual - tests/etc
The method assertEquals has been deprecated since python 2.7.
http://docs.python.org/2/library/unittest.html#deprecated-aliases

Also in Python 3, a deprecated warning is raised when using assertEquals
therefore we should use assertEqual instead.

This is part of blueprint assertequal

Change-Id: I5ecb36332b9353b7010a4f977813ff0295738014
2013-11-12 14:51:29 +08:00
Zhongyue Luo 184dfaaaa8 Utilizes assertIn - tests/etc
Using assertTrue and the 'in' operator to test
if an element is in a sequence is too python2.4.
Our unit testing framework supports assertIn,
which was created for these types of tests.
Adapting assertIn will enhance the readability
of the test scripts.

Change-Id: Ib44d57e75238691234c5290d13c54c526a6ae64b
2013-10-21 10:01:20 +08:00
Jenkins 0ae9a6dfa8 Merge "Clarify instance_type vs flavor in nova-manage" 2013-07-29 22:07:33 +00:00
Alex Gaynor cd9d8e45c6 Remove the monkey patching of _ into the builtins
Previous _ was monkey patched into builtins whenever
certain modules were imported. This removes that and
simply imports it when it is needed.

Change-Id: I0af2c6d8a230e94440d655d13cab9107ac20d13c
2013-07-26 07:31:17 -07:00
Joe Gordon a607aa3316 Clarify instance_type vs flavor in nova-manage
Make it clear that we are only using the term flavor now.

Partially implements bp flavor-instance-type-dedup

Change-Id: Ic26349d70fd99a20635f3ae45041c66b300a0513
2013-07-25 17:35:59 -04:00
Joe Gordon 952a26a851 Use db.flavor_ instead of db.instance_type_
We are removing instance_type as a synonym for a flavor. This fixes that
for the db.ap.

Partially implements bp flavor-instance-type-dedup

Change-Id: Id41b3b86a7af476622c70415080f4982c267a646
2013-07-16 12:42:52 -07:00
Michael Still 5cced7a314 Allow listing fixed_ips for a given compute host.
nova.db.fixed_ip_get_all_by_instance_host was removed in commit
bb867ce394, but was still used in
nova-manage. This patch works around the removal of the foreign
key that led to this method being removed.

Resolves bug 1163660.

Change-Id: Ieccd37c752e245558827615c098604d11ad3d945
2013-04-15 03:39:44 +10:00
Monty Taylor 799a925c1f Move console scripts to entrypoints.
As part of the move of plugins to entrypoints, take advantage of the
entrypoints based console scripts, which will make our command line scripts
available for unittesting.

Part of blueprint entrypoints-plugins

Co-authored-by: Michael Still <mikal@stillhq.com>

Change-Id: I5f17348b7b3cc896c92263dd518abb128757d81f
2013-04-04 13:14:27 +11:00
David Ripton 34de8d1529 Raise rather than generating millions of IPs.
Fixes bug #1163394

Formerly if we tried to create many millions of floating IPs with a
range like "192.168.2.224/2", address_to_hosts would happily iterate
over all of them (which would take a long time) and then nova-manage
would eventually crash with an OutOfMemoryError when we tried putting
all of them in a list.  Or, if the initial list wasn't quite big
enough to use all memory, it would blow up later (even more slowly)
when we tried to put them in the database via SQLAlchemy.

Now, raise exception.InvalidInput if the number of IPs is a million
or more.  (A million is erring on the side of caution.)

Change-Id: Ifc6b6a8faadc2e97e09f9f6c975e52229f705789
2013-04-02 14:51:16 -04:00
gengjh 1fefa25461 Show quota 'in_use' and 'reserved' info
We need show all the quotas related info, including 'in_use' and
'reserved'--not just the limit--when executing 'nova-manage project
quota'.

Fix bug 1160752

Change-Id: I25e10e58c6af705e2189550ad762e6f39bca342e
2013-03-28 10:02:37 +08:00
Hans Lindgren 071a41f1d0 Fix: nova-manage throws uncaught exception on invalid host/service
Add a test case for this too.

Fix bug 1154089.

Change-Id: I3a60e581a9fac945fddf72c4f037ca5cae0005fc
2013-03-12 15:06:07 +01:00
Joe Gordon abc0c94791 Make nova-manage db archive_deleted_rows more explicit
* max_rows must be positive
    Provide a better error message of 'nova-manage db archive_deleted_rows
    --max_rows=' is negative.
* Requires a max_rows
* No hidden default of 5000

Fix bug 1145609
Fix bug 1151064

Change-Id: I9078ff2700a0329ac4aff68bb434be5f16a5a3f1
2013-03-08 01:32:30 +00:00
Kurt Taylor d17f9ab13d Update OpenStack LLC to Foundation
Update all references of "LLC" to "Foundation".

Change-Id: I009e86784ef4dcf38882d64b0eff484576e04efe
2013-02-26 19:15:29 -05:00
Joe Gordon 29f7bdc045 Remove nova-volume DB
*  Remove volume calls from nova.db.api
*  Remove volume calls from nova.db.sqlalchemy.api
*  Remove tables from nova/db/sqlalchemy/models.py
*  Remove Xen Storage Manager Volume Driver code
*  No migration to preserve data in unused tables
*  Remove quota support for volumes

DocImpact

part of bp delete-nova-volume

Change-Id: I2c82c96d67f3746e5de28f917dd8ceb0c8037e27
2012-11-08 21:31:31 +00:00
vijaya-erukala 82d8ffec5b nova-manage doesn't validate key to update the quota
nova-manage doesn't validate the key value supplied to
update the quota, as a result unnecessary records will be
created in db and user will be under the impression that
quota value got updated.
This patch validates the input value given to the key.

fixes bug 1064359
Change-Id: I9928f30881aa2780a23005b5f69aa67a44f314c5
2012-10-09 19:31:46 +05:30
vijaya-erukala 98f782f818 Update 'unlimited' quota value to '-1' in db
Updates quota value to -1 in db rather than None
if the user specify the quota limit as "unlimited".

Fixes bug 979087
Change-Id: I0ec412189ad9630c4a875655294c1e77886108f5
2012-09-18 14:14:15 +05:30
Alessio Ababilov e00a398f84 Implement network creation in compute API
Implements blueprint os-api-network-create

The ability to create new networks is currently only exposed by the
nova-manage CLI. Here we add support for network creation in the
os-networks API extension.

With the exception of num_networks and network_size, all the parameters
supported by 'nova-manage network create' are supported. Only a single
network may be created by each API call.

To avoid code duplication, the nova-manage code is refactored and moved
into NetworkManager so that it can be re-used by the API.

DocImpact
Change-Id: I682d498ab35ea43b553b64e13e677fe9eeb8e08b
2012-08-21 16:10:24 +03:00
Yunhong, Jiang 9575a426fa Flavor extra specs extension use instance_type id
bug 1031263

The nova database API use instance_type id as parameter to access flavor
extra spec. However, the flavor extra_specs API extension use flavor_id as
parameter wrongly.

As the instance_type ID is a purely nova internal ID, the database should
not expose it and instead use flavor_id as the parameter

Change-Id: I5f509cb7c4457d8c399df32f559a874d498be762
Signed-off-by: Yunhong, Jiang <yunhong.jiang@intel.com>
2012-08-06 18:26:15 +08:00
Yunhong, Jiang 8644584eb6 Enhance nova-manage to set flavor extra specs
blueprint update-flavor-key-value

Enhance nova-manage so that it can add, delete and list key/value pairs for
flavors extra specs.

Change-Id: I0665bec6aecd7f7a1d8e845fd930f4bd5a841522
Signed-off-by: Yunhong, Jiang <yunhong.jiang@intel.com>
2012-07-26 08:49:43 +08:00
Joe Gordon 17389ec61b Fix RuntimeWarning nova_manage not found
fix bug 1024516

Change-Id: Ia24cc5c48f15f033c2cf610b8c68a3fd14fbd257
2012-07-13 12:28:24 -07:00
John Tran 1684c95568 Floating_ip create /31,32 shouldn't silent error
Fixes bug 1017682 the netaddr.IPNetwork.iter_hosts
method doesn't return any IPs when /32 or /31 and
should throw an exception instead of silent error

Change-Id: Id8875b6016a4dbb40b29d2f7687e6c35491e0129
2012-07-12 11:31:18 -07:00
Brian Waldon 822208fd34 Remove deprecated auth code
* Remove nova.auth.manager -- AuthManager, User, Role, Project, etc.
* Remove nova.auth.dbdriver
* Remove nova.auth.ldapdriver
* Remove nova.auth.signer
* Remove arbitrary scripts and schemas in nova/auth/
* Remove nova/auth/novarc.template
* Remove or update affected tests
* Related to bp remove-deprecated-auth

Change-Id: Ide0fefd0ddf79ae1b3bb74cb242c2893575839e7
2012-07-09 23:30:21 -07:00
Brian Waldon f953091dfe Remove auth-related nova-manage commands
Drop support for management of deprecated auth by deleting
the following nova-manage commands:
* role *
* export *
* project/account * (except scrub and quota)
* shell export
* user *

Additionally, delete relevant documentation and tests.

Related to bp remove-deprecated-auth.

Change-Id: Iad9787f696cb55d4673d68fc60851c7f5bd25805
2012-07-05 09:16:29 -07:00
Zhongyue Luo 6228acd7ff Unused imports cleanup (folsom-2)
Fixes bug #1008023

Change-Id: Ifb8ecbb7430fdabd7b5d81ab23df66942abd9cb7
2012-06-03 13:26:35 +08:00
Mark McLoughlin 283ea4a166 Export user id as password to keystone when using noauth
Fixes bug #969208

When using noauth, a user's password is her user id (e.g. in novarc).

When we export to keystone, we should make sure the same credentials
keep working rather than effectively switching all the passwords to
random UUIDs which users would never have seen before.

Change-Id: Ie77c622ce1952d03e836bb64167184022a02e902
2012-03-30 14:36:59 +01:00
Johannes Erdfelt a6589d313a Remove unnecessary setting up and down of mox and stubout
test.TestCase already sets up self.mox and self.stubs as well as calling
self.mox.UnsetStubs(), self.stubs.UnsetAll(), self.stubs.SmartUnsetAll()
and self.mox.VerifyAll() during tearDown.

Change-Id: I74f0824ca1e8daa7b0ee7d7a62b226ba51206e6f
2012-03-02 01:42:35 +00:00
Johannes Erdfelt 2034692653 Remove unnecessary variables from tests
Change-Id: Id83ea12ee89ee6511277aa2f0929f9bedb8f638b
2012-03-01 23:45:45 +00:00
Brian Waldon 0f9326a1ad Add 'nova-manage export auth'
* Introduce ability to dump auth data to json blob for consumption by keystone
* Implements bp keystone-export-rewrite

Change-Id: Ic8c0ade8350daa449fb6df7ad3c55c3ae2b0c2c7
2012-02-21 13:21:21 -08:00
Zhongyue Luo fc69f038bb Backslash continuations (nova.tests)
Fixes bug #925285

Backslash continuations removal for package nova.tests

Change-Id: I089dfb9a06a807e58ebb21329800a4eff40ed2bb
2012-02-17 06:12:04 +08:00
Vishvananda Ishaya 20b4d89512 Remove a whole bunch of unused imports
Change-Id: I6759e5b6250c48cc0deb4b198b44c948c64c47d1
2012-01-13 13:55:38 -08:00
Brad Hall 38172d5587 Add DHCP support to the QuantumManager and break apart dhcp/gateway
This introduces a new flag "quantum_use_dhcp=<boolean>" which indicates whether
or not to enable dhcp for all of the networks.  If it is set then we start
dnsmasq (and provide it with the IP/MACs from Melange) similar to how this was
done in linux_net before.

Prior to this if you enabled dhcp then you would also get a gateway device..
some people may not want that so we now require that you specify the gateway
when creating the network in order to end up with a device that will act as a
gateway.  If you're using Melange IPAM and you don't specify the gateway you
still end up with one because it doesn't allow you to not have one.  This lays
the groundwork for the option of not having one in the future, at least :)

Also, fix quantum/melange ipam interaction

We now query for the subnets by net_id/vif_id instead of searching through all
the blocks to find the right one.  Both of the allocate and deallocate for
instance calls are now using the vif_id -> network_id mapping instead of
searching the quantum networks.  get_port_by_attachment was also changed to
take a net_id so that we don't have to search through all of the quantum
networks to find the corresponding port.

Change-Id: I6a84da35237b6c5f5cdee91ada92642103439a97
2011-11-04 20:11:53 -07:00
Brad Hall c32258c77d Change network delete to delete by uuid or cidr
With melange it will be possible to have overlapping cidrs so it would be
better to specify the uuid of the network to delete.

Change-Id: I6781225d587952cbab3387cd40164d8ac77c58d6
2011-11-04 15:00:21 -07:00
Hisaharu Ishii 156f2fb689 Add names to placeholders of formatting 2011-08-24 13:10:56 -07:00
Hisaharu Ishii e51c73a2d9 Removed unused imports 2011-08-24 11:10:05 -07:00
Hisaharu Ishii 5ab769daf3 split test_modify() into specific unit tests 2011-08-24 10:47:11 -07:00
Hisaharu Ishii 390f35f8e7 Fix flag override in unit test 2011-08-24 09:11:57 -07:00
Hisaharu Ishii 9fbdfa5061 Fix pep8 2011-08-23 15:40:28 -07:00
Hisaharu Ishii 2fc6837064 Merged from trunk 2011-08-23 15:32:44 -07:00
Hisaharu Ishii 8cd7dcca1c Stub out the DB in unit test.
Fix 'nova-manage network modify' to use db.network_update()
2011-08-23 15:06:24 -07:00