Xing Yang [Mon, 10 Aug 2015 02:41:21 +0000 (22:41 -0400)]
Handle missing temp volume and snapshot during cleanup
When backup service is started, we try to clean up temp volumes
and snapshots in previously failed backups. If the temp volume
or snapshot is already deleted, we will get VolumeNotFound or
SnapshotNotFound exceptions. These exceptions should be handled.
Also temp_volume_id and temp_snapshot_id should be set to None
after they are deleted.
This patch changes the way we handle volume detach
attempts when the attachment_id is already detached
and/or when the volume has no attachments. We now
handle this the same way we do with deleting volumes
that don't exist. We return success.
This patch also takes care to make sure we safely reset
the volume status to what it should be depending on if
there are other attachments. If the attachment_id is
passed in and that attachment is detached, but there are
other attachments, we want to make sure that the volume is
left in an in-use state, not available.
There are test cases that require oslo.vmware and the change made in the
commit for tox doesn't cover the case where run_tests.sh is used. Without
including oslo.vmware in the test-requirements file there are a number of
test cases that fail without the library installed.
This patch resolves the issue by move oslo.vmware over to the
test-requirements file.
Skyler Berg [Tue, 4 Aug 2015 21:44:58 +0000 (14:44 -0700)]
Fix argument order for assertEqual in tests
Some tests incorrectly use the order assertEqual(observed, expected)
instead of the correct order, assertEqual(expected, observed). This
patch corrects this issue.
James Carey [Thu, 6 Aug 2015 05:13:15 +0000 (05:13 +0000)]
Fix order of parms in assertEqual for scheduler ut
When assertEqual is used it should be assertEqual(expected, observed).
Constant values are always the expected. This patch makes them the
first parameter and fixes some other non-constant cases.
Matthew Edmonds [Fri, 17 Jul 2015 20:42:35 +0000 (16:42 -0400)]
mark oslo.vmware as optional dependency
Driver-specific requirements are not hard requirements, since the
choice of drivers is up to the operator. The oslo.vmware module is
herein moved out of requirements.txt and instead listed as an optional
dependency using the extras functionality in setup.cfg.
A check is added to the vmdk driver to gracefully handle import errors
if the vmdk driver is used and oslo.vmware is not found.
is_public should be checked when creating volume type, otherwise DBError
will be raised in cinder-api, and the user will receive a 500 Internal
server error.
John Griffith [Sun, 9 Aug 2015 16:00:51 +0000 (10:00 -0600)]
Ignore InsecureReq warning in SolidFire Driver
The python requests package logs the use of Insecure as
a warning. Currently the use of http vs https is a
configurable option, and for those that use http, the
log files include a Warning message for every single
request to the SolidFire Cluster.
In our case we're explicitly providing the
option to use http instead of https, so we can safely
ignore this message and remove it from the logs.
Xing Yang [Fri, 7 Aug 2015 18:49:30 +0000 (14:49 -0400)]
Attach snapshot - driver only
This patch is a continuation of adding support for
non-disruptive backup. It provides a more efficient way
to backup an attached volume by creating a temp snapshot.
Since this is used internally for backup, the attach
snapshot interface is added in the driver only. For
drivers not implementing the attach snapshot interface,
backup will still be done using a volume.
Xing Yang [Fri, 7 Aug 2015 22:02:21 +0000 (18:02 -0400)]
Remove bad tests for the VMAX driver
There are a few tests for the VMAX driver that are causing lots of
unit test failures on various patches. I think the reason is several
tests are using the config file with the same name which is created
during setup and deleted at cleanup. When concurrency is > 1, one test
could have deleted the file while another test is trying to read from
it. So the unit tests need to be re-designed to isolate the impact on
each other. This will be worked on. For the short term, I want to
remove the bad tests to reduce the number of unit test failures on
other patches.
Anna Sortland [Tue, 14 Jul 2015 19:51:51 +0000 (14:51 -0500)]
Update authorization actions for services API
Previously, the services extension used generic authorization check
"volume_extension:services" for both index and update APIs.
This change creates separate rules for index and update APIs
so that it is possible to assign different rules to different users.
The sample /etc/cinder/policy.json is also updated to include new rules:
"volume_extension:services:index": "",
"volume_extension:services:update" : "rule:admin_api"
ankitagrawal [Tue, 4 Aug 2015 11:20:12 +0000 (04:20 -0700)]
Fix list comparison for empty list
Replaced boolean expression with 'not fields' in "_filter" method.
Also updated unit test cases which calls "_filter" method with
expected value of fields in restore methods.
The unit test "test_restore_vol_meta" was failing for empty list
because after updating the volume metadata, container was passed
to the "_restore_vol_meta" method where "metadata" is expected.
So fixed this unit test by passing the expected value to the
"_restore_vol_meta" method.
Xi Yang [Thu, 21 May 2015 08:09:21 +0000 (04:09 -0400)]
Snap copy feature for EMC VNX Cinder driver
Currently in VNX Cinder driver, a full-copy will be performed
when creating a volume from snapshot or volume and it is
time-consuming. This patch is going to address this issue by
providing an alternative way which is performing a snap-copy
when creating a volume from snapshot or volume. This can
accelerate the proccess a lot. And if the user wants to perform
a full-copy on the snap-copy volume, migration or retype can be
triggered on it. And we implement update_migrated_volume to
support migration and retype on the snap-copy volume.
This patch adds the connector object as a parameter
to all driver create_export calls. This will enable
drivers to actually use create_export method for doing
what they are now doing inside of initialize_connection.
Sean McGinnis [Thu, 6 Aug 2015 21:46:27 +0000 (16:46 -0500)]
Remove unit test migration logging
DB migration unit tests output a bunch of 'Loading script'
messages that are of little to no value. This patch raises
the default migrations module logging level to WARNING to
prevent these debug messages from cluttering the output.
Change-Id: Ib1bb5a0efc791a41f2d4cb1ea0e6eba4658097a8 Co-Authored-By: John Griffith <john.griffith@solidfire.com>
James Carey [Wed, 29 Jul 2015 22:55:03 +0000 (22:55 +0000)]
Sync scheduler module from oslo-incubator
The scheduler and scheduler.weights modules have not been
updated since early in the Icehouse release cycle. This
patch brings the version in Cinder up to date with what is in
oslo-incubator.
Current HEAD in OSLO:
---------------------
commit 20d7dc57819a70abdff967299542068946d75ac1
Date: Wed Jul 29 03:49:46 2015 +0000
Updated from global requirements
Patches included with sync by file:
---------------------
base_filter.py
- 2fbf5065 - Remove oslo.log code and clean up versionutils API
- 5d40e143 - Remove code that moved to oslo.i18n
- 2af88ece - Use _LI instead of _ for info message translation
- 4a47188e - Allow filters to only run once per request if their data is static
- fcf517d7 - Update oslo log messages with translation domains
- cae33101 - Stop looping all filters if no objects return
base_handler.py
- 6fa29aee - Trivial: Make vertical white space after license header consistent
- 35660dac7 - Enable hacking H401 test
- 5dcc43b1 - Break out common functionality for filters and weights
base_weight.py
- 825cb870 - Upgrade to hacking 0.10
- a2fa4878 - Fix common.scheduler.base_weight.BaseWeigher to be Python3 compat
- e47bc70e - Normalize Scheduler Weights
Note: Key changes were made that impact cinder:
(1) The weigher base class changed the name of _weight_mulitipler() to
weight_multiplier() which impacted cinder/scheduler/weights/capacity.py
and cinder/scheduler/weights/volume_number.py.
(2) Application of the weight multiplier was moved from the weigher to the
handler and normalization of the weights prior to applying the weight
multiplier was added. This impacted cinder weigher test cases which
were checking for non-normalized weights.
(3) The normalization does not support the use of infinite weights which
are used by the cinder capacity weigher. When an infinite value is
used, it is not known what the other weights will be, so this adds an
override to CapacityWeigher for the weigh_objects() method that wraps
the parent method to use the returned complete set of weights to
replace any infinite weights with values that are much larger than
the largest non-infinite weight.
The VolumeLimitExceeded exception contains the wrong limit when
the number of volumes exceeds the quota corresponding to a volume
type. It always contains the limit of quota 'volumes'. This patch
fixes the limit in both exception and log message. It also adds
the quota name to exception and log message for better clarity.
This patch refactors api.v2.volumes unit tests to use helper
methods added in commit I7c4225de5d32ecd0ad78fc7c0ff847a8bee7b7da.
It also fixes the order of assertEquals in refactored tests.
Sean McGinnis [Mon, 27 Jul 2015 14:18:44 +0000 (09:18 -0500)]
Dell SC: Add check of current value on retype
The recently merged retype code for the Dell Storage
Center driver does not check if the new Storage Profile
value is different than the currently set value. While
this is mostly harmless since there isn't a lot of overhead
to setting the Storage Profile to its existing value, it
is still extra overhead and API calls that need to be
performed to complete the operation.
This adds a simple check to compare the current value against
the requested value to decide whether or not to perform the
retype operation. We only support retyping of the Storage
Profile, so if they are the same, just return true to
prevent a migration from happening.
Sonia Ghanekar [Tue, 4 Aug 2015 22:08:21 +0000 (15:08 -0700)]
Update snap-quota to unlimited in Nimble driver
Change the snap-quota from limited fix size of the volume
to unlimited on the Nimble driver. This applies to creating
a new volume, extending an existing volume and creating a
clone from an existing volume snapshot.
Lin Yang [Mon, 3 Aug 2015 07:28:15 +0000 (15:28 +0800)]
Fix status comparison for attached volume backup
1) When do backup for an attached volume, its previous_status should be
'in-use' instead of 'in_use'.
2) Added more assertions in corresponding unittest case for this function
to make sure it enter this if-block. Previous test case was passed even
with the incorrect status.