If the async call to the manager/driver failed, the API still updated
the quota and volume size in the DB. Solution is to move these tasks
down to the manager, where we know if the extend succeeded.
Fixes race condition in LVMVolumeDriver create_cloned_volume method
When we create a clone volume, LVMVolumeDriver will firstly create a temp
snapshot for copying, the temp snapshot name is
"clone-snap-%s" % source_volume['id']. When we create multiple clone volumes
of the same volume simultaneously, which would trigger the race issuse.
I changes the temp snapshot name template to "clone-snap-%s" % volume['id'],
so temp snapshot name will be unique.
This patch adds the required code to do
Fibre Channel attach and detaches of volumes.
This code has been pulled over from Nova's
implementation of FC attach/detach.
Also adds a new driver config entry to enable
multipath support for iSCSI and FC attaches
during volume to image and image
to volume transfers.
John Griffith [Wed, 17 Jul 2013 00:27:19 +0000 (18:27 -0600)]
Increase timeout period for clone volume.
Current timeout value for clone volume in the
SolidFire driver is 20 seconds, this is fine
in many cases however there seems to be a
number of customers doing clones of
volumes >= 400G.
A populated 400G volume is taking upwards of
35 seconds to clone in some cases resulting in failure.
There's no reason not to bump this timeout value up
significantly to a worst case scenario (ie multi-terrabyte volume).
John Griffith [Fri, 12 Jul 2013 23:43:27 +0000 (17:43 -0600)]
Be sure to check deleted types on quota update.
If a volume-type is deleted, and later a volume
that's assigned that type is deleted the quota
update will fail and result in a trace for
VolumeTypeNotFound exception.
The volume is succesfully deleted, however the
quota information for the volume-type let alone
the other quota items for the volume are not
updated.
Jim Branen [Wed, 10 Jul 2013 19:34:09 +0000 (12:34 -0700)]
Adds multiple iSCSI port support to 3PAR
Added support to the 3PAR iSCSI OpenStack driver to provide the
ability to select the best fit target iSCSI port from a list of
candidate ports. The first time a volume is attached to a host,
all iSCSI ports configured for driver selection, are examined for
best fit. The port with the least active volumes attached will
then be selected as the path to the 3PAR array. Any subsequent
volume attach, to the same host, will use the established target
port.
In the swift driver the three methods prepare_nbackup, backup_chunk
and finalize_backup are used internally in the class only and are
not meant to be used from outside. Thus marked with prefix "_"
John Griffith [Mon, 15 Jul 2013 21:16:25 +0000 (15:16 -0600)]
Catch additional connect fail cases.
When fixing bug/1195910, some other failure
cases weren't considered (ie not authorized,
unreachable dest etc).
We should fix this up to handle the various
connection error states accordingly and also
add some hints to the log output to help
determine where to look in case of failure.
Jay S. Bryant [Wed, 19 Jun 2013 19:52:41 +0000 (14:52 -0500)]
Add flag argument to 'cinder-manage config list'
Unlike other cinder-manage 'list' commands the 'config list'
option doesn't allow users to specify a filter to limit
the output. This commit adds the ability to specify
the flag the user wishes to display.
If no flag is specified the default behavior is still to
display all the configured flags. If the flag requested
is not found, cinder-manage reports that the flag was not
found.
Mike Perez [Mon, 15 Jul 2013 01:48:54 +0000 (18:48 -0700)]
Use base ISCSI driver to fulfill some driver requirements
Cinder has a list of minimum features that must be implemented by each
driver. This uses the copy_volume_to_image and copy_image_to_volume
implementation from the base ISCSI class. Also use the base for raising
NotImplementedError. This touches the Nexenta and Zadara driver.
Joe Gordon [Fri, 12 Jul 2013 15:47:01 +0000 (16:47 +0100)]
Cleanup and make HACKING.rst DRYer
Reference the OpenStack hacking guide in HACKING.rst and remove
duplicate entries. Add placeholder section for cinder specific rules.
cinder specific rules can be created using hacking's local check
support.
Enable zero the snapshot when delete snapshot in LVMVolumeDriver
Because snapshot without 'size' field, So clear_volume method in
LVMVolumeDriver will skip secure deleting. Get the size of snapshot from
'volume_size' filed, So it can zero the snapshot.
Remove the 'size_in_g' parameter in _delete_volume method, because it never
used. Add a unittest for clear_volume method.
Errors raised by extend_volume aren't handled by the manager.
This means the volume status will not be updated to 'error_extending'
when an error is raised during the process.
* Handle such errors and update volume status accordingly
* Add logging for the extend volume process
Minor reorg for (array resource usage and backend options naming)
1. Use HUS target/initiator resources efficiently.
2. Command options aligned with openStack scheme of using dashes.
3. Self tests modified to accomodate #1 and #2.
In previous code we didn't check whether we have an enabled
backup service there before we send out the rpc request,
results that if no enabled backup service there,the volume will
stays in "backing-up" state and the backup will stays in "creating".
This patch fixed this issue, we exam whether at least an appropriate
(same host,az as the volume and is_alive) backup service available
before we do the rpc request.
Julia Varlamova [Fri, 5 Jul 2013 11:33:56 +0000 (15:33 +0400)]
Add tests for cinder/api/urlmap.py
Add tests for unquoting and parsing functions in
TestParseFunction class
Add tests for Accept class methods:
- TestAccept class - test cases for processing content types
- TestUrlMapFactory - test cases for urlmap factory
Add tests for URLMap class methods except __call__ method in TestURLMap
Kun Huang [Thu, 11 Jul 2013 04:04:52 +0000 (12:04 +0800)]
remove improper assert usage
There're many talks about it. An assert should be used for `never
happen` cases, not common paramaters validating.
With grep, we could many all assert statement used in none-test codes:
cinder/volume/drivers/san/solaris.py:110:
cinder/volume/drivers/san/solaris.py:116:
cinder/volume/drivers/san/solaris.py:161:
cinder/volume/drivers/san/solaris.py:162:
cinder/volume/drivers/san/solaris.py:163:
cinder/volume/drivers/san/solaris.py:164:
cinder/volume/drivers/san/solaris.py:170:
checking cmd output which should never changed, so leave it
cinder/db/sqlalchemy/migration.py:113:
ensure file existence from impossible cases, so leave it
cinder/utils.py:
used for functional flow, so use ValueError instead
John Griffith [Wed, 10 Jul 2013 21:34:26 +0000 (15:34 -0600)]
Enable setting blocksize on volumes.
Some back-ends support blocksizes other than the default 512 (like 4096),
this change adds a provider_geometry column to the volumes table,
format is "physical_block_size logical_block_size".
This can then be used by libvirt to determine if it should pass in
non-default block_size info, and there's a method for future
geometry/disk info that might be needed.
David Ripton [Tue, 9 Jul 2013 17:32:08 +0000 (13:32 -0400)]
Make String column creation compatible with SQLAlchemy 0.8
3 migration scripts used the convert_unicode, unicode_error, and
_warn_on_bytestring arguments when creating String columns. These
seem to cause problems with SQLAlchemy 0.8. Nova excised all use
of such arguments in commit 93dec58156e when squashing migrations
for Grizzly, and seems to have no problems with SQLAlchemy 0.8.
Last usage of suds was removed in
https://review.openstack.org/#/c/33168/. suds is
meanwhile unmaintained and has pending security issues,
so better remove references to it.
Key functions include efficient creation of snapshots and clones using
file system level copy-on-write mechanism. Copying of image blocks is
also avoided in case Glance backend repository happens to be on GPFS.
This change is required for future works in the SolidFire driver.
New SolidFire features (such as extend) are only available in
the latest version of the SolidFire API.
Default to '1.0' for backward compatibility. SolidFire still supports
the '1.0' version in its latest release.
Refactor reschedule in exception handling of volume manager
Previous exception handling has a pitfall that may potentially clear
the sys.exc_info() (by calling SQLalchmey to update db). This patch
refactors some part of exception handling in create_volume() to make
sure sys.exc_info() is retrieved so that we can log and reraise it;
also we make sure exception be reraised at the end of exception handling
no matter the request is rescheduled or not.
As a side effect, we fixed a bug in unittest which didn't provide
correct argument to db API but previously this exception has been wrongly
consumed by volume manager's exception handling (not reraise exception
when request is rescheduled).
Roman Podolyaka [Thu, 27 Jun 2013 15:34:21 +0000 (18:34 +0300)]
Don't pass 'session' arg to public DB API methods
DB API is an abstraction layer, which is used to make it
possible to switch DB backends easily (though we've got only
SQLAlchemy backend at the moment).
Public methods of DB API should not accept any backend-specific
arguments (i. e. a Session instance, that is an SQLAlchemy entity
to work with DB transactions).
This patch removes 'session' argument from all DB API public methods
(except volume_data_get_for_project() and snapshot_data_get_fro_project(),
which are a bit tricky and will be fixed by another patch).
If a DB API method must be called by another one in the context of a started
transaction, a private method is used. It accepts the same arguments as the
corresponding public method plus one additional argument to pass the transactional
context (in case of SQLAlchemy backend it's a Session instance).
Marc Koderer [Thu, 27 Jun 2013 10:05:56 +0000 (12:05 +0200)]
Add interface class for backup drivers
This fix introduces an interface class to define the structure of all backup
drivers. It also renames backup/service to backup/driver.
To be backward compatible a mapping functionality is introduced to map old
backup services to backup drivers.
Current codes in create_volume() may exists a scenario that
a context which is not elevated but after it fails in volume
creation, it becomes elevated. This patch saves original
context, so that if it fails in volume creation simply use the
original context for further scheduling.