Joshua Harlow [Tue, 17 Dec 2013 23:20:02 +0000 (15:20 -0800)]
Add exception logging if flow creation fails
If the create_XYZ_flow fails in being created
its useful to log exactly what the error was in
detail (instead of trapping it and only raising
a generic error). The more detailed error shows
what the real problem was during the flows
construction (which usually is some larger
problem).
Sean Dague [Tue, 17 Dec 2013 12:29:46 +0000 (07:29 -0500)]
make delete recovery messages debug level
lvm.delete has recovery logic within it to do a second attempt
if it should fail the first time. It is currently however logging
those second attempts at error and warn levels. However, as this
is normal flow these should be debug level instead.
This is currently causing a few resets in the gate because this
is a non whitelisted error.
Eric Harney [Mon, 16 Dec 2013 22:29:32 +0000 (17:29 -0500)]
Pylint fixes for Brick iSCSI/LVM
Fixes a few of the more straightforward pylint errors
in these files. (anomalous-backslash-in-string,
attribute-defined-outside-init, and bad-indentation)
Jim Branen [Fri, 6 Dec 2013 23:32:53 +0000 (15:32 -0800)]
3PAR FC: add ability to add WWNs to host
When a host is created on the HP 3PAR array,
at initialize connection time, the host is
created with all WWNs provided in the connector
structure. However, the driver did not have
the ability to add new WWNs after a host is created.
This patch adds the ability to add WWNs to a
host, at initialize connection time, if a new
WWN is provided in the connector structure.
Jay Lau [Sat, 14 Dec 2013 15:54:16 +0000 (10:54 -0500)]
Adjust import order according to PEP8 imports rule
This patch just adjust import order to follow PEP8 imports rule.
See http://www.python.org/dev/peps/pep-0008/#imports
Imports should be grouped in the following order:
1) Standard library imports
2) Related third party imports
3) Local application/library specific imports
Dirk Mueller [Thu, 12 Dec 2013 13:17:43 +0000 (14:17 +0100)]
[Netapp/Nexenta] Move registration of config options
This doesn't really make a difference in practice, but
makes it possible for the sample config generator to figure
out the config group relationship when options are in one
file.
Zhiteng Huang [Fri, 13 Dec 2013 14:20:47 +0000 (22:20 +0800)]
Remove test that was no longer used for long
test_too_big_volume() case in test_volume.py was legacy from nova-
volume, it was never actually testing anything. This change removes
this case for good.
Avishay Traeger [Tue, 10 Dec 2013 08:43:07 +0000 (10:43 +0200)]
Use mock for scheduler tests
In our effort to move from mox to mock, this patch will convert the
scheduler unit tests to use mock exclusively. Also fixed some pylint
errors along the way.
When the manager call tries to update the driver
stats, it checks to ensure the driver is initialized.
When the driver hasn't been initialized, it logs
a warning without the driver name. This is confusing
for multiple backends. This patch adds the driver
name, version and the config group name, to the log output,
so the admin can see which driver is failing.
huangtianhua [Wed, 11 Dec 2013 09:35:13 +0000 (17:35 +0800)]
Fix KeyError while generating a WSGI response
The KeyError exception raised while generating a WSGI response based on
the 413 exception. Because there may be no "Retry-After" attribute in the
exception headers.
john-griffith [Mon, 9 Dec 2013 23:00:20 +0000 (16:00 -0700)]
Catch TypeError when new_size is None on extend
The volume_actions extend method does not catch/handle TypeError
exceptions. The tempest volume_actions test includes a negative
test that doesn't pass in a new-size so the result is we get an
unhandled exception/trace in the log files for these runs.
Mike Perez [Fri, 6 Dec 2013 19:13:09 +0000 (11:13 -0800)]
Add RBD test for volume not existing during delete
For cases when the volume does not exist in the backend, but Cinder
still knows about it, we just return from the rbd driver and let Cinder
do its thing.
Giulio Fidente [Tue, 3 Dec 2013 12:44:20 +0000 (13:44 +0100)]
Returns thin pool free space calculated from actual usage
This change adds a hidden method which calculates the thin
pool free space from the data_percent LVM options and reports it
accordingly in _update_volume_stats()
Flavio Percoco [Thu, 5 Dec 2013 16:05:33 +0000 (17:05 +0100)]
LVM migration: Check if name is equal to dest_vg
The existence check of the destination volume group is wrong. It
currently checks if there's a VG with a name equal to the source's vg
name instead of checking if it's equal to the dest_vg.
Flavio Percoco [Thu, 5 Dec 2013 15:14:39 +0000 (16:14 +0100)]
Convert lvm_mirrors to int
When the location_info is parsed and `lvm_mirrors` extracted, it is not
being converted to int. This causes some boolean checks to return True
even when there are not mirrors enabled because of the u'0'.
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.
Eric Harney [Thu, 5 Dec 2013 18:45:46 +0000 (13:45 -0500)]
GlusterFS: Remove glusterfs_disk_util option
The glusterfs_disk_util option lets one choose whether to
use df or du to calculate space usage. This serves no real
useful purpose. Should remove this option to simplify things.
Since this does not meaningfully impact behavior, removal of
this option shouldn't require any special deprecation efforts.
(This same change was made for the NFS driver in 5bf7b9be.)
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).
Adds lock for create from vol/snap to avoid race conditions
This patch protects create from volume/snapshot by using a
lockfile to protect the operation from concurrent deletes of
the volume/snapshot used in the create operation.
Currently, if a volume/snapshot is deleted while a volume is
being created from it that delete may complete during the
create operation thus leaving the new volume in error or stuck
state. This lock will ensure that:
(a) if a create of VolA from snap/volB is in progress, any
delete requests for snap/volB will wait until the create
is complete.
(b) if a delete of snap/volA is in progress, any create from
snap/volA will wait until snap/volA delete is complete.
huangtianhua [Thu, 5 Dec 2013 03:15:11 +0000 (11:15 +0800)]
Fixes case insensitive for resp body
Create metadata for a volume 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.
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.
Jay S. Bryant [Wed, 4 Dec 2013 03:31:17 +0000 (21:31 -0600)]
delete.start/delete.end notification for hostless
Third party GUIs may rely on notifications to track the
progress of volume creation and deletion. In the case that
a volume is being deleted after a failed attempt to create
(the volume is listed in the database but is not actually
resident in a backing store) the path that is taken in
volume.api.delete() makes no notifications of deletion
occurring.
This patch adds a volume_utils.notify_about_volume_usage
call to the beginning and end of the delete with a
delete.start and delete.end respectively. The notifications
serve as triggers for GUIs to refresh the state of the
volume. This change makes the hostless delete path's
functionality more consistent with the other paths through
the delete code.
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.
Eric Harney [Tue, 19 Nov 2013 21:25:47 +0000 (16:25 -0500)]
GlusterFS: Complete snapshot_delete when info doesn't exist
The snapshot_delete operation will fail if the snapshot info file
doesn't contain a record for the snapshot, or does not exist.
This happens in cases such as when snapshot_create fails to commit
anything to disk.
The driver should allow the manager to delete the snapshot
in this case, as there is no action required for the driver
to delete anything.