Flavio Percoco [Thu, 5 Dec 2013 12:48:24 +0000 (13:48 +0100)]
LVM migrate: Use keywords for the brick instance
In the `migrate_volume` method a new instance is created when the
dest_vg is not equal to the source vg. This new brick instance is
created using positional arguments instead of keywords. However, some of
those arguments are passed in the wrong positions.
This patch uses keywords for the misplaced arguments.
The patch also changes `test_lvm_migrate_volume_proceed` in order to
fully test the happy path and catch things like this.
Jon Bernard [Thu, 21 Nov 2013 22:58:13 +0000 (17:58 -0500)]
LVM: Create thin pools of adequate size
Thin pools in LVM are quite different from volume groups or logical
volumes and their differences must be taken into account when providing
thin LVM support in Cinder.
When you create a thin pool, LVM actually creates 4 block devices. You
can see this after thin pool creation with the following command:
In the above command, a thin pool named 'volumes-1-pool' was created in
the 'volumes-1' volume group. Despite this, the 'lvs' command will only
show one logical volume for the thin pool, which can be misleading if
you aren't aware of how thin pools are implemented.
When you create a thin pool, you specify on the command line a size for
the pool. LVM will interpret this size as the amount of space requested
to store data blocks only. In order to allow volume sharing and
snapshots, some amount of metadata must be reserved in addition to the
data request. This amount is calculated by LVM internally and varies
depending on volume size and chunksize. This is why one cannot simply
allocate 100% of a volume group to a thin pool - there must be some
remaining space for metadata or you will not be able to create volumes
and snapshots that are pool-backed.
This patch allocates 95% of a volume group's free space to the thin
pool. By doing this, we allow LVM to successfully allocate a region for
metadata. Additionally, any free space remaining will by dynamically
used by either data or metadata if capacity should become scarce.
The 95/5 split seems like a sane default. This split can easily (and
probably should) be made user-configurable in the future if the user
expects an abnormal amount of volume sharing.
Catch ImageBusy exception when deleting rbd volume
If we try to delete an rbd volume that has 'watchers' on it
i.e. client connections that have not yet been closed
possibly because a client crashed, the remove() will throw an
ImageBusy exception. We now catch this exception and raise
VolumeIsBusy with a useful message.
If the volume delete fails in this way it will now stay as
'available' instead of going to 'error_deleting' so that the
delete can be retried (since it is expected to work on a
retry after waiting for the connection to timeout).
huangtianhua [Fri, 29 Nov 2013 08:56:35 +0000 (16:56 +0800)]
Fixes case insensitive for resp body
Create metadata for a snapshot with key-value set, which key in uppercase
and lowercase(e.g.{"key": "v1", "KEY": "V1"), the server accept the
request and return the key-value set {"key": "v1", "KEY": "V1"}. But the
server just add one metadata because the server is not case sensitive.
The patch will modify the resp body with the one which the server added.
ling-yun [Tue, 3 Dec 2013 08:19:17 +0000 (16:19 +0800)]
All API controllers inherit from wsgi.Controller
Most of the Cinder Public API Controllers inherit from wsgi.Controller,
but still some Cinder Public APIs controllers directly inherit from
object. So it's necessary to unify all the Cinder Public API Controllers
inherit from wsgi.Controller.
1. For code cleanup.
2. When we try to do body valid check in api's put/post method later, we
can use the helper function is_valid_body instead of using try...catch
block.
Avishay Traeger [Tue, 3 Dec 2013 07:44:35 +0000 (09:44 +0200)]
Update hacking to hacking>=0.8.0,<0.9
Update hacking version to match version specified in requirements repo.
Fixed the following issues, which the newer version checks for:
print "" -> print("")
self.assertEquals -> self.assertEqual
self.assertNotEquals -> self.assertNotEqual
Avishay Traeger [Tue, 3 Dec 2013 08:47:33 +0000 (10:47 +0200)]
Add more logging to migrate_volume_completion
Add a debug message on entering the function, and an info message if
it was called to clean up an error. This is useful because Nova copies
the data of in-use volumes, and if it fails there will only be a
message in the Nova logs.
ling-yun [Sat, 30 Nov 2013 09:09:28 +0000 (17:09 +0800)]
Use model_query() in db.*****_destroy
Use model_query() instead of session.query in db.volume_destroy,
db.volume_type_destroy, db.transfer_destroy and db.snapshot_destroy as
other methods use.
model_query function is the query helper which is used in most part of
cinder/db/sqlalchemy/api.py.
Mike Perez [Mon, 2 Dec 2013 21:42:52 +0000 (13:42 -0800)]
Adjust RBD delete log level
Set notice of volume no longer existing in RBD backend when attempting
to delete to log INFO level. Also move a comment next to related code.
This is a follow-up to suggestions from 3de7da12d1098ef777305099e5f4a039e536bf99.
Eric Harney [Mon, 2 Dec 2013 19:58:57 +0000 (14:58 -0500)]
Don't stop volume service for failed re-export operations
Commit b71570 "Set vol driver initialized before deleting volumes"
changed the manager behavior to call set_initialized() before
attempting to re-export volumes.
Drivers should not be considered initialized before re-export has
succeeded. Otherwise a failure to export causes the volume
service to stop, when that failure should be handled like any other
failure to initialize.
Sergio Cazzolato [Fri, 29 Nov 2013 05:38:44 +0000 (00:38 -0500)]
Use assertAlmostEqual instead of failUnlessAlmostEqual in unit tests
The method failUnlessAlmostEqual 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
failUnlessAlmostEqual therefore we should use assertAlmostEqual instead.
Andres Buraschi [Thu, 28 Nov 2013 14:35:07 +0000 (11:35 -0300)]
Fixing check order for empty body in get_body()
Cinder API logged the following debug message for each request with
empty body:
"Unrecognized Content-Type provided in request get_body"
Check order was fixed in get_body function to follow the correct flow
and display the right message (empty body).
Sushil Kumar [Thu, 28 Nov 2013 07:42:52 +0000 (07:42 +0000)]
Updates .gitignore
To ignore swap files from getting into repository
currently the implemented ignore is *.swp
however vim adds more swap files if .swp exists,
so improving this with .*.sw?
Rushi Agrawal [Tue, 26 Nov 2013 06:18:38 +0000 (11:48 +0530)]
Fix suppressed exceptions for migration downgrade
In SQLAlchemy migration versions 009, 010 and 020, we missed
reraising exceptions while logging errors in case of a downgrade.
We don't want exceptions to pass silently. This patch fixes that.
john-griffith [Wed, 27 Nov 2013 23:38:22 +0000 (16:38 -0700)]
Parse out '@' in volume['host'] to do discovery
The backup method of getting iscsi info is to use
iscsiadm discovery, however currently that method
just uses volume['host'] which in the case of
multi-backend will use "host@backend-name".
This will cause the discovery to fail of course, so
this change just parses out the '@' symbol if it's present
and avoids the problem in the first place.
This also beefs up the error logging and exception catching
a bit.
Parsing out the '@' symbol all the time should be safe as
the accepted valid chars for hostnames are digits, a-z and
hyphens.
john-griffith [Wed, 27 Nov 2013 21:02:48 +0000 (14:02 -0700)]
Handle NotFound exception in snapshots API code
Passing tests in the gate leave unhandled trace/error messages
for a VolumeNotFound issue.
These are caused by the test_volumes_snapshots_negative test
which requests a non-existent volume and the tests pass however
the log files are a bit messed up due to the unhandled exception.
This change just adds a try/catch block around the volume get calls
in the snapshot modules and raises HTTPNotFound as appropriate.
Avishay Traeger [Tue, 26 Nov 2013 19:10:22 +0000 (21:10 +0200)]
Fix Storwize terminate_connection with no host
Nova may pass a connector to Cinder with no 'host' field, which was
causing a KeyError in the Storwize driver. This patch resolves this case
by doing the following:
1. If the volume is mapped to only 1 host, unmap it
2. If the volume was not mapped or mapped to multiple hosts, print a
warning but don't raise an exception
Make volume_glance_metadata_create compat with DB2
As DB2 does not support SQL insert via raw number type if
table column data type is "CLOB" ("TEXT" in sqlalchemy), we need
to convert numerical values to string before insert operations.
This problem was discovered through the
test_volume_create_get_update_delete_from_image test case in
tempest.api.volume.test_volumes_get. The test case fails with
a DBError without this change in place.
Eric Harney [Tue, 19 Nov 2013 23:01:55 +0000 (18:01 -0500)]
GlusterFS: Ensure Cinder can write to shares
Ensure the Cinder user can write to the GlusterFS share. This
is required for snapshot functionality, and means the admin
does not have to set this permission manually.
zhangyanzi [Mon, 25 Nov 2013 11:33:49 +0000 (19:33 +0800)]
The param 'readonly' is incorrect checked
In the function os-update_readonly_flag, the param 'readonly' is incorrect
checked, without the param in request, i think it should raise exception
with message like "Must specify readonly in request."
zhangyanzi [Fri, 22 Nov 2013 08:41:39 +0000 (16:41 +0800)]
Ensure 'status' in update_snapshot_status
The function os-update_snapshot_status doesn't check whether the param
"status" is in request body. It throws 500 error. We should catch the
KeyError and return 400 (HTTPBadRequest) instead.
huangtianhua [Fri, 22 Nov 2013 09:02:32 +0000 (17:02 +0800)]
Initialize and terminate connection raise 500 err
Initialize and terminate connection should check whether "connector" is
in request body. It throws 500 error if "connector" is not present. We
should catch the KeyError and transfer it to 400 (HTTPBadRequest)
instead of.
Zhiteng Huang [Thu, 21 Nov 2013 09:02:23 +0000 (17:02 +0800)]
Pull latest service module from Oslo
Get latest service module from Oslo to prepare for multi-process API service implementation.
Below are the commits included in this pull.
Changes being pulled into in service module are:
* e7bc8c9 2013-11-20 | Merge "os._exit in _start_child may cause unexpected exception"
* 96a2d4e 2013-11-07 | os._exit in _start_child may cause unexpected exception
* 1771a77 2013-11-05 | Adjust import order according to PEP8 imports rule
* 3110c0f 2013-10-17 | Use multiprocessing.Event to ensure services have started
* b5fba9e 2013-09-18 | Move comment in service.py to correct location
* 11cc74f 2013-08-26 | Fixes issue with SUGHUP in services on Windows
* 825ace5 2013-06-17 | Add service restart function in oslo-incubator
* c935d1c 2013-07-16 | Merge "Allow launchers to be stopped multiple times"
* dc8aa79 2013-07-08 | Allow launchers to be stopped multiple times
* 1a2df89 2013-06-25 | Enable H302 hacking check
* 52e857a 2013-06-19 | Ignore any exceptions from rpc.cleanup().
* 5518ad3 2013-05-16 | Add graceful service shutdown support to Launcher
And these dependent modules
- cinder/openstack/common/eventlet_backdoor.py
* 1dcc747 2013-07-15 | Fix stylistic problems with help text
* 1a2df89 2013-06-25 | Enable H302 hacking check
* c7c55b2 2013-06-20 | Improve usability when backdoor_port is nonzero
- cinder/openstack/common/gettextutils.py
* 3970d46 2013-11-02 | Fix typos in oslo
* 88db9c8 2013-10-03 | When translating if no locale is given use default locale
- cinder/openstack/common/jsonutils.py
* 3d7504b 2013-09-23 | Ensure that Message objects will be sent via RPC in unicode format
* 1807d32 2013-08-22 | jsonutils: make types py3 compatible
* bdef862 2013-08-22 | jsonutils: do not require xmlrpclib
* ded9bd6 2013-08-04 | Make dependency on netaddr optional
* 7b7566b 2013-06-25 | Add netaddr.IPAddress support to to_primitive()
- cinder/openstack/common/local.py
* cb2a2b6 2013-06-28 | Modify local.py to not be dependent on Eventlet
* 547ab34 2013-03-11 | Fix Copyright Headers - Rename LLC to Foundation
- cinder/openstack/common/log.py
* a82e889 2013-11-14 | Merge "Do not name variables as builtins"
* 2251cb5 2013-11-13 | Do not name variables as builtins
* 25c5854 2013-11-13 | Adds admin_password as key to be sanitized when logging
* cbfded9 2013-11-11 | Default iso8601 logging to WARN
* 76b0cd1 2013-11-04 | Add mask password impl from other projects
- cinder/openstack/common/loopingcall.py
* 1a2df89 2013-06-25 | Enable H302 hacking check
- cinder/openstack/common/threadgroup.py
* 9d3c34b 2013-10-25 | Add a link method to Thread
* 1a2df89 2013-06-25 | Enable H302 hacking check
- cinder/openstack/common/timeutils.py
* f3b5f17 2013-11-12 | Add helper method total_seconds in timeutils.py
* 53ebd30 2013-10-18 | python3: use six.text_types for unicode()
* 3bc6f79 2013-09-19 | Fix timeutils.set_override_time not defaulting to current wall time
* af76064 2013-08-29 | Optimize timeutils.utcnow_ts()
* df3f2ba 2013-07-26 | BaseException.message is deprecated since Python 2.6
* d28fa69 2013-06-27 | python3: Add python3 compatibility.
scott-dangelo [Fri, 22 Nov 2013 16:28:07 +0000 (16:28 +0000)]
Add greenthread.sleep() to parent wait()
Add an eventlet.greenthread.sleep() to wait() to keep
cinder-volume parent from looping after catching SIGTERM
and hogging the CPU. This was already added to the running
state but is missing from the SIGTERM caught state when
the parent waits to reap the child.