Russell Bryant [Fri, 30 Nov 2012 14:19:05 +0000 (09:19 -0500)]
Ensure request_spec can be serialized.
request_spec includes some objects that must be converted to primitive
types to ensure they can be serialized by any of the rpc drivers. In
this case, it's the volume type. It's a sqlalchemy model.
to_primitive() will ensure that it gets converted to a dict so that it
can be serialized for messaging.
I saw this error in a smokestack log that was running tempest with qpid.
You won't see this error if you're using rabbit with the kombu driver.
We have some magic with the kombu driver that will fix these problems
automatically if they are missed.
Adam Gandelman [Wed, 28 Nov 2012 01:51:26 +0000 (17:51 -0800)]
Improve provider_location cleanup code for RBD.
The RBD driver does not make use of the 'provider_location' field
but the current cleanup code assumes it does. Ensure the field
is in use before testing whether or not it needs fixing.
Matthew Treinish [Tue, 27 Nov 2012 15:41:25 +0000 (10:41 -0500)]
Fix None being passed into as_int().
Currently when a create is received and the size is of NoneType
a stack trace is dumped because of the TypeError. This will
correct it so the functionality won't change, but the TypeError
is will be caught now.
Yaguang Tang [Tue, 27 Nov 2012 09:06:25 +0000 (17:06 +0800)]
Use auth_token middleware from keystoneclient.
auth_token middleware has been move from keystone to python-keystonecient,
so add python-keystoneclient dependence instead of keystone.Also adds
missing signing_dir option.
John Griffith [Tue, 27 Nov 2012 05:46:58 +0000 (05:46 +0000)]
Revert "use O_DIRECT when copying from /dev/zero too"
It turns out running oflag=direct against the LVM snapshot fails for an IO error every time. Works fine against the regular volume, but fails on snapshot.
John Griffith [Sun, 25 Nov 2012 03:17:32 +0000 (20:17 -0700)]
Make pep8 checks a bit stricter.
Along with moving to pep8 1.3.3, we also want to standardize
on what we ignore. This patch get's us most of the way there
by setting the ignore list to:
N4,E125, E126, E711,E712.
Almost all changes made here are white-space/indentation changes.
The removal of Hacking N4 errors from the ignore list will
be handled in a seperate patch.
Pádraig Brady [Fri, 23 Nov 2012 11:24:44 +0000 (11:24 +0000)]
use O_DIRECT when copying from /dev/zero too
We need to avoid trying O_DIRECT with virtual
devices like /dev/zero and /dev/urandom etc.
as it's not supported there, which because of
our later check, would cause O_DIRECT to be
not applied to the output device either.
Related to bug 937694
Possibly related to bug 1023755
Change-Id: I034d8345c3d00689c1f1fffcc2c110735c49ee01
john-griffith [Thu, 22 Nov 2012 16:44:53 +0000 (09:44 -0700)]
Add CONTRIBUTING file.
If the CONTRIBUTING[.md] file exists, Github will show a link to it to
anyone who files an issue on Github or opens a pull request on
Github. This files points folks to the OpenStack wiki page which
provides the proper instructions on how to contribute to OpenStack.
See also <https://github.com/blog/1184-contributing-guidelines>.
Mike Perez [Sun, 4 Nov 2012 08:34:27 +0000 (01:34 -0700)]
Moving common api code into cinder.api
This is progress for beginning to have separate versions of the
cinder api. Common code that would be shared by v1, v2 etc will use
these modules, so we'll just move them to a common place. Test directory
structure has also been updated.
Moved all the remaining drivers under
cinder.volume.drivers. Updated the tests with
the new module paths and add backwards compatibilty
for the existing paths.
Mike Perez [Mon, 19 Nov 2012 05:27:39 +0000 (21:27 -0800)]
Add volume bootable information to api response
If there is any glance metadata associated with a volume, we'll consider
the volume bootable. This will return the information for both /volumes
and /detail calls.
Mate Lakat [Mon, 5 Nov 2012 09:57:52 +0000 (09:57 +0000)]
Add XenAPINFSDriver
Related to blueprint xenapi-storage-manager-nfs
As xensm was not pulled to Cinder, this change shows an implementation
example for using an NFS export for volumes. This change contains the
volume create and delete functions, as a minimal set of functionality.
The connection information structure is compatible with the previous
xensm implementation.
Activate the driver with the following configuration entries in
cinder.conf:
Ollie Leahy [Thu, 15 Nov 2012 11:48:27 +0000 (11:48 +0000)]
Add db table for Glance Metadata
This commit implements the blueprint
https://blueprints.launchpad.net/cinder/+spec/retain-glance-metadata-for-billing
It creates the new table volume_glance_metadata in the cinder
database, provides the CRUD methods for it, and populates the table
when a volume or snapshot is created from a Glance image.
Patch set 2: remove superflous line
Patch set 3: Fix incorrect column types in sqlalchemy/models.py
Patch set 4: Define exception class GlanceMetadataExists
Zhiteng Huang [Tue, 20 Nov 2012 17:02:37 +0000 (01:02 +0800)]
Remove redundant db.volume_update() in volume manager create_volume()
Since scheduler has already updated db to set the 'host' field and
recorded 'scheduled_at' time, it's not necessary to do db.volume_update()
again in volume manager create_volume() method. Also let volume api
to update db when creating volume from snapshot while snapshot_same_host
is true, thus the behavior is consistent (updating db when placement
decision is made).
John Griffith [Tue, 20 Nov 2012 00:50:27 +0000 (00:50 +0000)]
Pass in correct volume_ref to create_from_snapshot.
The new rpc versioning change introduced a bug in the
create_from_snapshot code. The originating volume_ref
was being passed in instead of the newly created volume_ref
as expected.
John Griffith [Tue, 13 Nov 2012 19:03:50 +0000 (19:03 +0000)]
Add hosts extension to Cinder.
This adds the hosts extension to Cinder which is similar to
the extension by the same name in Nova.
This extension allows an admin user to check the status of
Cinder services on different hosts. In addition it also
provides the capability to get host and project specific information
regarding volume count and space allocated for volumes on a specified
host.
Dan Prince [Thu, 15 Nov 2012 16:27:06 +0000 (11:27 -0500)]
Make tox.ini run pep8/hacking checks on bin.
This updates the pep8 checks in our tox.ini file so that
we are also scanning the bin directory.
Additionally, it updates the main pep8 check so that it scans
cinder properly as well. Previously there were a bunch of files
getting skipped due to some of the pep8 pattern matching.
Zhiteng Huang [Fri, 9 Nov 2012 06:37:21 +0000 (14:37 +0800)]
Remove unused volume API method - remove_from_compute()
remove_from_compute() method in cinder.volume.api is never used
by others and it is also broken since the interface in Nova has
been changed to remove_volume_connection(), thus it should be
removed from Cinder.
Zhiteng Huang [Sat, 6 Oct 2012 17:11:41 +0000 (01:11 +0800)]
Scheduler API clean up and refactor
Unlike Nova scheduler, which has to consider serving compute and volume
scheduling, Cinder scheduler only serves volume scheduling, so there's no
need to keep generic interface 'schedule'. Instead, 'schedule_create_volume'
is added (if missing) to manager/driver class and chance/simple scheduler
driver implementation.
Also this patch changes the interface between API service and scheduler to
allow more information about volume is passed to scheduler for advanced
scheduling while maintained backward compatibility. And this change bumps
scheduler RPC API to version 1.2.
John Griffith [Tue, 6 Nov 2012 18:08:58 +0000 (11:08 -0700)]
Remove dm_setup(remove) call in volume_delete.
While it makes sense to perform the dm_setup(remove) before
performing the lvm remove, it seems to cause some buffer IO
errors as evident by kern.log.
I'm also a bit suspicous in that it seems the delete timeouts
we see seems to have increased in frequency with this addition.
I propose this step is removed until we completely understand the
impact of the kernel error on Precise kernels.
john-griffith [Tue, 6 Nov 2012 06:26:07 +0000 (23:26 -0700)]
Add ability to disable secure volume delete.
Due to gating issues caused by secure delete on LVM volumes,
add the ability to disable via flag.secure_delete.
Default will be set to True, but we add a way for the gate tests
to disable this until we can come up with a fix for
https://bugs.launchpad.net/cinder/+bug/1023755 OR implement an alternative
secure delete method that doesn' suck.
Rushi Agrawal [Sat, 3 Nov 2012 06:51:28 +0000 (12:21 +0530)]
Fix run_tests.sh ambiguous usage msg and behaviour for -x option
In commit
https://github.com/openstack/cinder/commit/ 50792c2ff41fdc7e73b3e3c51f4510366debfd14,
the committer wanted to add an option in run_tests.sh for generating XML
coverage report, but ended up accidentally overriding the default nose
option -x. But, the usage message still showed that using option -x will
'Stop running tests after the first error or failure'. So, I changed the
option to generate XML report to -X (capitalized 'x'). So now both -x and
-X options are available, with different purposes.
clayg [Thu, 25 Oct 2012 09:55:13 +0000 (02:55 -0700)]
Add admin only action for force detach
This action calls the same methods nova would after it successfully
detaches a volume. By exposing it to the administrator it makes it's
easier to repair un-syncronized state between services. Generally when
the host is no longer attached, but the volume state is wrong.
Future work: The Iscsi based drivers don't seem to use
initialize_connection and terminate_connection to create the export for
the volume. This would be more useful with drivers that do that.
I added the force parameter to terminate_connection for drivers that may
want to differintiate between a normal terminate and the force detach.
Future Nova work: Nova will want an admin action to update the bdm
tables - today it's a bit of nova-manage shell work.
The openssl popen call to verify the token returns an error code
of 2 when a file doesn't exist. Normally this is caught and the
relevant file is downloaded, but monkeypatching os causes this
error code to be eaten and cinder to return a 401. Note that this
is likely a race condition that depends on exactly when greenthreads
are switching that is causing the return code from Popen to get
overwritten.
It is possible that this is exposing an underlying bug in eventlet
but the workaround is simply to make sure that we don't monkeypatch
os.
Moved RBDDriver, SheepdogDriver into their own respective driver
files under cinder/volume/drivers/*. Moved FakeISCSIDriver and
LoggingVolumeDriver into a fake driver file under the tests,
since that's the only place where those are used.
Minor optimization in create_volume in HpSanISCSIDriver
Removing extra call to getClusterInfo in HpSANISCSIDriver
on every create_volume call. The cluster info is now
being lazily stored in a local variable.
Clay Gerrard [Wed, 31 Oct 2012 20:25:55 +0000 (15:25 -0500)]
Return volume type name on volume create
Update openstack api controller for volumes to fully inflate the
returned volume model on create to populate the volume_type fields so
the response serializer will return the name of the volume_type instead
of the id on volume create requests. Returning the name on create is
consistent with the show and index commands.
Sean Dague [Wed, 31 Oct 2012 14:10:29 +0000 (10:10 -0400)]
pin sqlalchemy to the 0.7 series
sqlalchemy 0.8 beta has hit mirrors, and changes dependencies, thus
breaking jenkins. This pins it to 0.7 series until all the projects
agree to move forward to 0.8.
Brian Waldon [Tue, 30 Oct 2012 22:06:12 +0000 (15:06 -0700)]
Add VolumeTenantAttribute API extension
Expose the ID of the project to which a volume belongs through a
new API extension. This is only presented to Admins by default.
Visibility can be controlled with the 'volume_tenant_attribute'
policy rule.
The inability to deduce an /action request from the logs
makes diagnosing integration with nova difficult. This change
logs the action method and arguments
John Griffith [Wed, 24 Oct 2012 22:28:02 +0000 (16:28 -0600)]
Detect and fix issues caused by vol ID migration
The migration from volume ID to UUID neglected to update the provider_location
field on the volume. As a result the iqn and volume name no long match and
existing volumes are no longer able to be attached after an upgrade
(essex -> folsom and then nova-vol->cinder).
This patch adds a method to the volume driver that will check for the
mismatch of volume name in the iqn during service start up. If
detected it will update the provider_location field in the database
to include the new ID. Also it will create a symlink to the device backing
file that also has the correct naming convention.
Note: We don't disturb an connections that are currently attached.
For this case we add a check in manager.detach and do any provider_location
cleanup that's needed at that time. This ensures that connections
persist on restarts of tgtd and reboot.
The SolarisISCSIDriver and HpSanISCSIDriver have been removed from
san.py and placed in their own files. The default SanISCSIDriver
implementing some common methods still resides in san.py. These
san drivers have now been grouped in the san module.
Brian Waldon [Sat, 27 Oct 2012 22:36:30 +0000 (15:36 -0700)]
Add VolumeHostAttribute API extension
Expose the host on which a volume resides through a new API
extension. This is only presented to Admins by default. This
can be controlled with the 'volume_host_attribute' policy
rule.
Zhiteng Huang [Wed, 3 Oct 2012 09:10:57 +0000 (17:10 +0800)]
Add default volume type flag
Where using volume type scheduler, 'volume type' is an essential input for
scheduler to perform sophysticated scheduling. This patch adds a new
flag 'default_volume_type to allow admin to set one volume type as the
default type for volume creation if user doesn't specify any.
Also add more clear 404 message to API if create request provided non-existing
volume type.
Note: Setting the 'default_volume_type' flag to non-existing volume type
is problematic and should be avoided, and the outcome of such behavior is
equivlant to setting default volume type to None.
This is part of patch set implementing 'volume-type-scheduler'.
jking-6 [Wed, 24 Oct 2012 17:15:03 +0000 (13:15 -0400)]
Allow the user to update a volume's metadata
The fix mainly involves updating the VolumeController's update method
to allow the 'metadata' key to be a valid key in a request body.
The _translate_volume_summary_view method is updated to check for a
'metadata' key in the vol parameter after checking first for
'volume_metadata'. This is to avoid making a third call to the
database after updating the volume model. This solution introduces
the least amount of new code.