john-griffith [Thu, 17 Jan 2013 01:49:07 +0000 (18:49 -0700)]
Move iscsi flags back to driver.py
During the lvm class create the iscsi flags were moved.
This is NOT correct, the flags belong with the ISCSI class
and should have been left in driver.py where ISCSIDriver
is defined.
Moving these breaks the inheritance structure for all those that
inherit from ISCSIDriver.
Add a clear_volume() method that is called from delete_method().
This is only implemented at present for the base LVM driver.
This new clear_volume() method now supports these config vars:
'zero' is the default method and unchanged from previously.
'none' is used if security isn't a concern, or there is
independent volume scrubbing.
'shred' is for more security conscious situations where
an overwrite count is required. Currently this defaults to 3 passes.
size_in_MiB can be used to limit the cleared area to the first
part of the volume, which can greatly speed up the operation,
and can be useful with encrypted volumes for example where
overwritting the encryption keys at the start is sufficient.
Sascha Peilicke [Tue, 15 Jan 2013 13:53:20 +0000 (14:53 +0100)]
Relax various version constraints.
The current 3rd-party module requirements for cinder are still from the
nova git import. Usually, having an upper bound for requirements makes
only sense where API-incompatible changes are expected (like WebOb). For
the others it is better the only require a minimum version because
usually distributions differ on the shipped versions of these Python
modules. For instance, openSUSE has newer versions for almost all of
those and running the testsuite there works flawlessly.
Davanum Srinivas [Sat, 12 Jan 2013 21:16:19 +0000 (16:16 -0500)]
Support for SSL in wsgi.Server
SSL are entirely optional. Support for SSL as well using code from glance. We
have some new options for configuring the SSL support. There are tests for
accessing a sample app w/o ipv6 or ssl, one with just ssl and one with
ipv6 and ssl
Davanum Srinivas [Thu, 10 Jan 2013 16:26:03 +0000 (11:26 -0500)]
Enhance wsgi to listen on ipv6 address
Check if the hostname is ipv6 and set the family appropriately.
Picking up the snippet from glance.
Picked up some code from nova as well to get the test case running
properly
Avishay Traeger [Wed, 9 Jan 2013 07:31:19 +0000 (09:31 +0200)]
Factor out LVM code.
Currently volume drivers inherit from VolumeDriver and ISCSIDriver,
which contain LVM-specific code. The LVM-specific functions are
generally overridden. The problem is that there is no place for
generic code for all drivers to inherit, which the LVM driver can
override. This patch basically makes the VolumeDriver and ISCSIDriver
classes mostly empty and moves the LVM-specific code to lvm.py. Also,
moved the global _iscsi_location() and _iscsi_authentication()
functions into the new LVMISCSIDriver class since nobody else used
them.
Zhiteng Huang [Fri, 5 Oct 2012 16:08:09 +0000 (00:08 +0800)]
Implement filter scheduler
In order to do more sophisticated scheduling (e.g. schedule based on volume
type), filter scheduler is introduced. Several changes are made to make this
possible, some of them are similar to the counterpart in Nova:
- add HostState class to host_manager in order to store volume capabilities
- implement get_volume_stats() method of iSCSIDriver as an example to
demonstrate how volume backend driver reports capabilities as well as status
- add scheduler_options.py and 'scheduler_json_config_location' flag to be
allow loading json configuration file for scheduler at run time
- port common filters/weights from oslo
- add capacity weigher (scheduler/weights/capacity.py) for picking up
target volume backend by weighing free capacity of the host. The default
behavior is to spread volumes across hosts; by changing the
'capacity_weight_multiplier' to negative number, volume placing behavior will
become stacking.
- add capacity filter which filters those hosts have insufficient storage space
to serve the request.
- add 'reserved_percentage' config option to indicate how much space is
reserved. Capacity reservation is needed when volume resize is enabled.
- add 'publish_service_capabilities()' method to volume RPC API to allow
scheduler to have volume service report capabilities. This bumps volume RPC
API to version 1.2
- remove 'volume_force_update_capabilities' config option, volume status will be
report to scheduler in every checking.
The implication of this change to storage/backend driver developer:
- implementation of get_volume_stats() of the driver is now a *MUST*, filter
scheduler heavily relies on the status/capabilities reported by backend driver
to makeplacement decision. To ensure Cinder works seamlessly on the storage
system, driver should at least report following capabilities/status:
----------------------+---------------------------+---------------------------
Capability/Status | Description | Example
----------------------+---------------------------+---------------------------
'volume_backend_name'| back-end name, string | 'Example_Storage_Backend'
----------------------+---------------------------+---------------------------
'vendor_name' | vendor name, string | 'OpenStackCinder'
----------------------+---------------------------+---------------------------
'driver_version' | version, string | '1.0a'
----------------------+---------------------------+---------------------------
'storage_protocol' | supported protocols, | 'iSCSI', 'RBD', 'FC', 'NFS'
| string or list of strings | ['iSCSI', 'NFS', 'FC']
----------------------+---------------------------+---------------------------
'total_capacity_gb' | capacity in GB, integer | 102400
----------------------+---------------------------+---------------------------
'free_capacity_gb' | available capacity in GB, | 1000
| integer |
----------------------+---------------------------+---------------------------
'reserved_percentage' | reserved space in | 0, 10
| percentage, integer |
----------------------+---------------------------+---------------------------
The implication of this change to Cinder administrator:
- the default setting for filter scheduler should work well with the benefits
of:
* being able to fully utilize capacity of backends (driver now has to report
actul total space and space utilization and scheduler uses these info) not
limited by the 'max_gigabytes' config option any more;
* being able to choose placement policy between spreading & stacking for
volume creation (by modifying the 'capacity_weight_multiplier' in
CapacityWeigher)
- with filter scheduler, Cinder is now able to utilize the advanced features/
capabilities provided by different storage back-ends via: defining different
volume types with proper extra_specs. Volume types can be considered as sets
of back-end capabilities requirement.
For example, a volume type which has 'storage_protocol':'FC' key/value pair
definition in its extra_spec can only be served by those back-ends who report
they support FiberChannel protocol. Another example is volume type has 'QoS'
requirement can only be served by back-ends support QoS.
Note/TODO:
* Currently scheduler makes its decision based on the status and capabilities
information reported by volume nodes, and these information is stored in memory
of scheduler process. More sophisticated way may be add on table in DB to
record status/capabilities of all volume nodes, like Nova does for compute nodes.
john-griffith [Mon, 31 Dec 2012 23:16:19 +0000 (16:16 -0700)]
Update SolidFire Volume driver
Adds support for clone volumes and set QoS use volume type / extra_specs.
Also includes some minor cleanup and some hardening for known pre-release
XDB issue in SolidFire Cluster API.
We have the driver broken into 2 files:
hp_3par_common.py and
hp_3par_iscsi.py
The reason we do this is because we have a fibre channel driver
that will be submitted shortly after this is committed. The
fibre channel driver and the iscsi driver share a lot of the same
code that talks to the 3PAR array for provisioning. So,
it made sense not to have duplicate code. The fibre channel driver
will be dependent on the fibre channel support I am actively working
on for nova/cinder grizzly release.
The driver uses a 2 mechanisms to talk to the 3PAR array:
1) a python REST client (hp3parclient) that lives in the pypi
repository here:
http://pypi.python.org/pypi/hp3parclient
2) SSH. We had to pull in some of the ssh code from the base san
driver to help fix an issue with executing commands on the 3PAR
array. The 3PAR has the ability to turn on CSV output for command
results, which makes this easier to parse. Unfortunately, there
is no way to turn CSV mode on permanently for all ssh requests.
So, we have to turn on the CSV output for every single ssh command
issued. Since we use ssh as well, we require the san_* options
to be set.
We use a dual mechianism because the REST API that ships with the 3.1.2
firmware doesn't support all of the capabilities a cinder driver needs
to export volumes.
When a newer version of the firmware comes out that supports host
management on the 3PAR array, then we will get rid of the SSH code.
Dan Prince [Tue, 8 Jan 2013 18:23:15 +0000 (13:23 -0500)]
Update exceptions to pass correct kwargs.
Updates a variety of Cinder exceptions so that they pass the correct
kwargs for proper exception message formatting. Previously
these exceptions would work but have incorrect error messages
because of how CinderException handled exception formatting errors.
Dan Prince [Tue, 8 Jan 2013 18:20:57 +0000 (13:20 -0500)]
Add option to make exception format errors fatal.
Adds a new fatal_exception_format_errors config option which
defaults to False. This option is use to control how the base
CinderException class handles errors which can occur when it
formats error messages.
The motivation for this change is to be able to enable exception
format checking in our tests by setting fatal_exception_format_errors=True.
Zhiteng Huang [Fri, 5 Oct 2012 16:08:09 +0000 (00:08 +0800)]
Implement filter scheduler
In order to do more sophisticated scheduling (e.g. schedule based on volume
type), filter scheduler is introduced. Several changes are made to make this
possible, some of them are similar to the counterpart in Nova:
- add HostState class to host_manager in order to store volume capabilities
- implement get_volume_stats() method of iSCSIDriver as an example to
demonstrate how volume backend driver reports capabilities as well as status
- add scheduler_options.py and 'scheduler_json_config_location' flag to be
allow loading json configuration file for scheduler at run time
- port common filters/weights from oslo
- add capacity weigher (scheduler/weights/capacity.py) for picking up
target volume backend by weighing free capacity of the host. The default
behavior is to spread volumes across hosts; by changing the
'capacity_weight_multiplier' to negative number, volume placing behavior will
become stacking.
- add capacity filter which filters those hosts have insufficient storage space
to serve the request.
- add 'reserved_percentage' config option to indicate how much space is
reserved. Capacity reservation is needed when volume resize is enabled.
- change default scheduler to 'filter.FilterScheduler'.
- add 'publish_service_capabilities()' method to volume RPC API to allow
scheduler to have volume service report capabilities. This bumps volume RPC
API to version 1.2
- remove 'volume_force_update_capabilities' config option, volume status will be
report to scheduler in every checking.
The implication of this change to storage/backend driver developer:
- implementation of get_volume_stats() of the driver is now a *MUST*, filter
scheduler heavily relies on the status/capabilities reported by backend driver
to makeplacement decision. To ensure Cinder works seamlessly on the storage
system, driver should at least report following capabilities/status:
----------------------+---------------------------+---------------------------
Capability/Status | Description | Example
----------------------+---------------------------+---------------------------
'volume_backend_name'| back-end name, string | 'Example_Storage_Backend'
----------------------+---------------------------+---------------------------
'vendor_name' | vendor name, string | 'OpenStackCinder'
----------------------+---------------------------+---------------------------
'driver_version' | version, string | '1.0a'
----------------------+---------------------------+---------------------------
'storage_protocol' | supported protocols, | 'iSCSI', 'RBD', 'FC', 'NFS'
| string or list of strings | ['iSCSI', 'NFS', 'FC']
----------------------+---------------------------+---------------------------
'total_capacity_gb' | capacity in GB, integer | 102400
----------------------+---------------------------+---------------------------
'free_capacity_gb' | available capacity in GB, | 1000
| integer |
----------------------+---------------------------+---------------------------
'reserved_percentage' | reserved space in | 0, 10
| percentage, integer |
----------------------+---------------------------+---------------------------
The implication of this change to Cinder administrator:
- the default setting for filter scheduler should work well with the benefits
of:
* being able to fully utilize capacity of backends (driver now has to report
actul total space and space utilization and scheduler uses these info) not
limited by the 'max_gigabytes' config option any more;
* being able to choose placement policy between spreading & stacking for
volume creation (by modifying the 'capacity_weight_multiplier' in
CapacityWeigher)
- with filter scheduler, Cinder is now able to utilize the advanced features/
capabilities provided by different storage back-ends via: defining different
volume types with proper extra_specs. Volume types can be considered as sets
of back-end capabilities requirement.
For example, a volume type which has 'storage_protocol':'FC' key/value pair
definition in its extra_spec can only be served by those back-ends who report
they support FiberChannel protocol. Another example is volume type has 'QoS'
requirement can only be served by back-ends support QoS.
Note/TODO:
* Currently scheduler makes its decision based on the status and capabilities
information reported by volume nodes, and these information is stored in memory
of scheduler process. More sophisticated way may be add on table in DB to
record status/capabilities of all volume nodes, like Nova does for compute nodes.
john-griffith [Mon, 7 Jan 2013 17:08:16 +0000 (10:08 -0700)]
Use tempdir for lock_path in tests.
Commit: 2331d3336a6adf4fc13a3b187e91a5d1b1f7c723
introduced use of lockutils but wasn't setting a lock_path, in the tests.
As a result we were polluting cinder/openstack/ with cinder-xxxx lockfiles.
This patch adds a tempfile and cleanup to the test so we don't leave any
junk behind.
Doug Hellmann [Thu, 3 Jan 2013 16:09:36 +0000 (11:09 -0500)]
Upgrade WebOb to 1.2.3
The version of WebOb being used in OpenStack was more than
1 year old. This change updates to the latest stable release.
Upgrading WebOb resolves a version conflict between OpenStack
and Pecan, the web framework used by the Ceilometer team for
version 2 of the ceilometer API.
Refer to http://docs.webob.org/en/latest/news.html
for the list of changes between 1.0.8 and 1.2.3.
Doug Hellmann [Mon, 7 Jan 2013 15:52:39 +0000 (10:52 -0500)]
Make WebOb version specification more flexible
Change the WebOb version to >=1.0.8 as an temporary
measure to allow the actual version update to 1.2.3
to roll out across the projects one at a time without
breaking the integration tests.
Chuck Short [Thu, 3 Jan 2013 15:50:57 +0000 (09:50 -0600)]
Add missing library
According to pyflakes:
cinder/api/common.py:246: undefined name 'minidom'
cinder/api/common.py:254: undefined name 'minidom'
cinder/api/common.py:272: undefined name 'minidom'
cinder/api/common.py:284: undefined name 'minidom'
Add from xml.dom import minidom
Change-Id: Iadb1586ac15c29bb1f2154324e529976f82c19f0 Signed-off-by: Chuck Short <chuck.short@canonical.com>
When running tempest on cinder on postgresql we get a number
of errors because this call was trying to set deleted = 0.
On mysql 0 == False, but on postgresql this is a type error.
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.
Rohit Karajgi [Fri, 28 Dec 2012 12:58:46 +0000 (04:58 -0800)]
Adds synchronization to attach volume.
This patch adds the following changes:
1. Move db update for volume status during attach to volume.manager
2. Add lock synchronization to volume attach operation
3. Related unit tests
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.