John Griffith [Wed, 12 Dec 2012 22:23:56 +0000 (15:23 -0700)]
Implement ability to Clone volumes in Cinder.
This implements the capability to create usable volume clones in Cinder,
for the LVM case we create a temporary snapshot to copy from so that
volumes can remain attached during cloning. This works by passing
in a source-volume-id to the create command (similar to create-from-snapshot).
Currently we limit clone to the same Cinder node, and only for the base LVM driver.
All other drivers should raise NotImplemented, most inherit from the SANISCSIDriver,
so move the function there and raise until we have a general implementation
for SANISCSI based drivers.
Those drivers that inherit from ISCSI directly instead of SANISCSI,
add the function explicitly and raise NotImplementedError there as well.
Xing Yang [Fri, 14 Dec 2012 05:05:14 +0000 (00:05 -0500)]
Add EMC Volume Driver in Cinder
Add support for EMC storage in the Cinder-Volume service.
This driver is based on the existing ISCSIDriver, with the ability to
create/delete and attach/detach volumes and create/delete snapshots, etc.
The Cinder Driver executes the volume operations by communicating with the
backend EMC storage. It uses a CIM client in python called PyWBEM to make
CIM operations over HTTP.
EMC CIM Object Manager (ECOM) is packaged with the SMI-S Provider. It is a
CIM server that allows CIM clients to make CIM operations over HTTP, using
SMI-S in the backend for EMC storage operations.
SMI-S Provider supports the SNIA Storage Management Initiative (SMI), an
ANSI standard for storage management. It supports VMAX/VMAXe and VNX
storage systems.
Commit cbcd340 changed from NamedTemporaryFile to mkstemp, but
mkstemp returns a file descripter, not a file object. We therefore
need to close the fd using os.close(). This was tested using
devstack.
The 3par driver, for both iSCSI and Fibre Channel,
that I will commit soon, needs the lockutils to ensure thread safety in
each of the driver entry points. The driver uses a single shared http
session for all of it's connections to the 3par drive array.
This is required for the driver because of the limitation on the
3par's WSAPI only supporting a very small number of open connections.
For example without this, the driver will have problems when 2 users try and
create a volume at the same time. I've discovered this in my threaded
stress test tool.
When a VHD created by Cinder using the iSCSI Target Server is deleted
manually, at the next startup the cinder-volume service terminates with an
exception.
This fix adds a check to verify if the disk exists.
Adds a new configuration option called lvm_mirrors. If this is
set to a value > 0, it will create the specified number of mirrors
when creating volumes. Note that lvm_mirrors + 2 pvs are required
in the volume group for lvm mirroring to work properly.
Avishay Traeger [Thu, 29 Nov 2012 10:22:00 +0000 (12:22 +0200)]
CHAP support for IBM Storwize/SVC driver.
This implements support for CHAP authentication of hosts by the IBM
Storwize/SVC controller. A host entity was created on the controller for
each server that logs in with iSCSI. Now a randomly-generated CHAP
secret is added to the host entity on the controller (passed via the
controller CLI over SSH).
Nikola Dipanov [Fri, 7 Dec 2012 14:53:28 +0000 (15:53 +0100)]
Add image metadata API extension
This patch introduces an API extension that will expose the volume
metadata inherited from the image if the volume was created from an image.
This data will be used by Nova when booting from volume without any
image supplied.
In addition, the patch introduces a helper method on the volume.API
class for accessing the image metadata and also updates the policy.json
files to be aware of the new extension.
This patch is part of the blueprint improve-boot-from-volume
This patch also introduces DocImpact as it extends the cinder API
Raise NotImplementedError on copy_image_to_volume and
copy_volume_to_image on drivers that inherit from
driver.ISCSIDriver that don't support this feature yet.
Mike Perez [Sat, 8 Dec 2012 20:16:43 +0000 (12:16 -0800)]
Changing display_name to name in v2 api
This allows the v2 api responses to be more consistent with other
projects. This approach is making the idea compatible in v2, rather
than changing the model.
john-griffith [Tue, 4 Dec 2012 04:02:19 +0000 (21:02 -0700)]
Make copy_to_volume a bit more useful.
The current implementation of cinder.driver.copy_to_volume
does not take in to account image type and is only valid
for raw images. This doesn't do much good for the majority
of cases, and rather than require folks to have a raw version
uploaded to Glance, let's just do a convert if needed on the fly.
This simply creates a temp file, does the conversion and then
writes the temp file directly to the volume.
John Griffith [Thu, 6 Dec 2012 20:36:23 +0000 (13:36 -0700)]
Delete type call in api needs update to use ID.
https://github.com/openstack/cinder/commit/51a438c8f3f0d13c6779602264d72cde82feab9c
Introduced UUID's for volume_type ID and also changed delete to use ID
instead of name.
That changed neglected to update the call in contrib/types_manage,
this patch fixes that.
john-griffith [Sun, 2 Dec 2012 07:01:49 +0000 (00:01 -0700)]
Convert volume_type id from int to uuid.
This converts the volume_type id from int to uuid. In
addition, this also corrects an issue of deleting volume_types
by name. Even though the client/api is taking the id, it was
converting to the name of the volume_type for the db access.
We also want to continue enforcing that the name is unique on creation
so as to avoid any confusion and for clarity in Horizon. The api
has also been enhanced to allow you to specify the type by name
or by uuid.
This does NOT modify the things like the volume details display field
(currently shows the type 'name' not 'uuid'), these types of changes
will go in to V2 of the API.
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.
Mike Perez [Thu, 29 Nov 2012 11:18:08 +0000 (03:18 -0800)]
attaching volumes will set instance_uuid instantly
This change allows the instance_uuid field to be set instantly when
beginning an attach action. The user will no longer have to wait for the
attachment to be complete to know what it is attaching to. If attaching
fails on the driver layer, we got error state and keep the instance_uuid
set for troubleshooting purposes.
John Griffith [Wed, 28 Nov 2012 19:19:14 +0000 (12:19 -0700)]
Revert changes to monkey_patch.
As a work-around to deal with bug 1075838, we modified
monkey_patch in the Cinder binaries. The root cause of the
issue is/was actually a bug in eventlet but this was a quick
work-around.
Since the change Change-Id: I69ba75136e32e95c6fdf108f0c4fe21a5e3bdbe6
to do this landed, the problem has also been addressed in Keystone.
So, let's revert this patch to get back the greenthread performance
that we may have lost with this change. For now, everything should
be addressed as long as we don't implement multi api worker in Cinder,
if we do and the evenlet fix hasn't been released we'll need to turn
the modification back on for bin/cinder-api.
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.