ling-yun [Fri, 3 Jan 2014 08:51:50 +0000 (16:51 +0800)]
removed unused context in check_*** methods
Input parameter 'context' of Check_*** methods(check_attach,
check_detach, _check_metadata_properties, _check_volume_availability)
in cinder/volume/api.py are not being used, so remove this 'context'
parameter.
ling-yun [Fri, 3 Jan 2014 07:56:05 +0000 (15:56 +0800)]
add 'force' verification in _volume_upload_image
_volume_upload_image API should only support to upload 'in-use' volume to
image when assign 'force' parameter as true value. Now
_volume_upload_image API does not do verification for 'force' parameter,
so we can upload 'in-use' volume to image when assign 'force' parameter
with string value 'false' or 'false111'. This patch add verification for
'force' parameter.
Eric Harney [Fri, 13 Dec 2013 15:39:09 +0000 (10:39 -0500)]
LVM: Activate Thin Pool LV upon initialization
If the LVM thin pool is not active, space calculation fails,
as data_percent is not known. Activate the pool upon initialization,
since we intend to use it anyway.
Slightly refactors _get_thin_pool_free_space so that it is clear
which missing/unexpected value is breaking things if a similar error
occurs for some other reason.
Eric Harney [Thu, 19 Dec 2013 00:11:44 +0000 (19:11 -0500)]
GlusterFS: Use correct base argument when deleting attached snaps
When deleting the most recent snapshot, the 'file_to_merge' field
which translates into the base= field for libvirt's blockRebase
call in Nova must be set depending on whether other snapshots exist.
If there are no other snapshots, base = None, which results in
libvirt clearing the qcow2 backing file pointer for the active
disk image.
If there are other snapshots, pass the parent of the file being
deleted as the new base file. The snapshot info pointer for the
prior base file must also be updated in this case.
Matt Fischer [Thu, 2 Jan 2014 02:31:20 +0000 (19:31 -0700)]
Removed copyright from empty files
According to policy change in HACKING:
http://docs.openstack.org/developer/hacking/#openstack-licensing
empty files should no longer contain copyright notices.
Zhiteng Huang [Thu, 2 Jan 2014 01:17:32 +0000 (09:17 +0800)]
Remove unused fake_flags
fake_flags.py should have been removed in change
I3424d0a401b3ef7a3254d3e913263554361a52ff but somehow it's left
untouched in that change. This module has been replaced by
cinder/tests/conf_fixture.py, and shouldn't be around anymore.
Zhiteng Huang [Wed, 11 Dec 2013 13:46:38 +0000 (21:46 +0800)]
Add AllocatedCapacityWeigher
AllocatedCapacityWeigher is a weigher that weigh hosts by their
allocated capacity. The main purpose of this weigher is to simulate
the SimpleScheduler's behavior, which sorts hosts by the size of
all volumes on them. So by allocated capacity, it equals to the
sum of size of all volumes on target host.
In order to keep track of 'allocated' capacity, host state is updated
to add a 'allocated_capacity_gb' attribute to record the value, which
means each back-end must report one extra stats to scheduler.
Fortunately, the 'allocated' capacity we are interested in here is
pure Cinder level capacity, the volume manager can take all the burden
to calculate this value without having to query back-ends. The volume
manager does the initial calculation in init_host() by the time when it
has to query all existing volumes from DB for ensure_export(). After
initial calculation, volume manager/scheduler will keep track of every
new request that changes 'allocated_capacity' and make sure this value
is up to date.
!DriverImpact! Cinder driver developers, please read on:
This patch contains a change that might IMPACT volume drivers: volume
manager now uses 'stats' attribute to save 'allocated_capacity_gb'.
And this information will be merged with those stats drivers provide
as a whole for scheduler to consume. If you plan to report any form
of allocated space other than the apparent Cinder level value, (e.g.
actual capacity allocated), Please choose a key name other than
'allocated_capacity_gb', otherwise it will *OVERWRITE* the value volume
manager has calculated and confuse scheduler.
ling-yun [Tue, 24 Dec 2013 03:45:16 +0000 (11:45 +0800)]
Handle terminate_connection() exception in volume manager
Due to the fact that we sometimes need to manually terminate a volume's
connection through volume api, it's possile that these backend drivers
throw exceptions while doing that. Currently exceptions are bubbled up to
volume API not being handled. This patch logs exception in volume manager
and then raises VolumeBackendAPIException to caller.
Alan Meadows [Thu, 26 Dec 2013 19:12:37 +0000 (11:12 -0800)]
Bugfix missing foreign key removal for mysql
Downgrading the cinder schema fails when running 018_add_qos_specs.py
under MySQL. The upgrade path of this schema patch adds the foreign
key volume_types_ibfk_1 on table volume_types, and the downgrade does
not correspondingly remove it before attempting to drop the
qos_specs_id column. This update removes the foreign key when
the engine is mysql prior to dropping the column.
Add additional metadata as key-value pairs in 3PAR
Track status of openstack volumes on 3PAR through
additional metadata added as key-value pairs. During volume attach
and detach, corresponding instance metadata is updated onto the
cinder volumes.
Zhiteng Huang [Mon, 2 Dec 2013 09:05:08 +0000 (17:05 +0800)]
Handle initialize_connection() exception in volume manager
Due to the fact that several drivers require backend communication to fetch
connection information for a volume, it's possile that these driver throw
exceptions while doing that. Currently exceptions can bubble up to volume
API not being handled. This patch logs exception in volume manager and
then raises VolumeBackendAPIException to caller.
John Griffith [Sat, 21 Dec 2013 00:33:23 +0000 (17:33 -0700)]
Add qos_specs support to solidfire driver
We've added a new qos_specs object to Cinder that allows creation
and management of qos settings separate from volume-types.
Now instead of embedding the qos info in the extra-specs of the
volume-type we associate the desired qos-spec to a volume-type.
This change implements the capability of the SolidFire driver to
take advantage of that feature.
Zhiteng Huang [Wed, 11 Dec 2013 15:56:14 +0000 (23:56 +0800)]
Fix QoS information in initialize_connection() result
Currently the entire QoS information (if any) is included in the result of
initialize_connection() even if the consumer of the QoS is 'back-end'. Also
the format for QoS specs also is changed so that front-end (Nova) can
parse correctly. Add unit test to cover initialize_connection().
ling-yun [Fri, 20 Dec 2013 02:55:18 +0000 (10:55 +0800)]
Only reverify backing lun when create backing lun
In TgtAdm, we alway do twice _verify_backing_lun whether backing lun
exists or not.
If backing lun exists, it doesn't need to call _verify_backing_lun
function again.
It only needs reverify whether backing lun exists or not when recreate
backing lun.
Ann Kamyshnikova [Thu, 10 Oct 2013 12:37:16 +0000 (16:37 +0400)]
Set volume_dd_blocksize configurable on per-driver basis
Allow volume_dd_blocksize config option to be configurable on a
per-driver basis.
This allows drivers used in multi-backend configurations
to define their own values. We port this to the LVM and block_device
drivers here but it can easily be ported to others as and when
needed.
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).
Dirk Mueller [Thu, 12 Dec 2013 17:05:31 +0000 (18:05 +0100)]
Remove dynamic default on sf_account_prefix
A dynamic default makes it difficult to generate
a proper cinder.conf.sample template. Make it
default to the hostname when the option is unset
or left at default.
DocImpact: default of sf_account_prefix changed to "None", which
however preserves behavior of a previously unset option: use
the current hostname.
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
RBD backend only supports booting from images in raw format. A volume
that was cloned from an image in any other format is not bootable. The
RBD driver will consider non-raw images to be uncloneable to trigger
automatic conversion to raw format.
Includes conversion of the corresponding unit test to use mock (instead
of mox) and expanded comments and error messages based on change #58893
by Edward Hope-Morley.
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.