Patrick East [Fri, 4 Mar 2016 00:15:49 +0000 (16:15 -0800)]
Add backend id to Pure Volume Driver trace logs
With multi-backend deployments it was very hard to follow which backend
was making which calls. When there was an error it was often unhelpful
to look at the tracing to know which backend had the problem.
This will now print out the active backend id with the tracing log
messages.
Tom Barron [Wed, 2 Mar 2016 17:29:47 +0000 (12:29 -0500)]
Fix invalid uuid warnings in test_volume.py
Currently 'tox -epy27 -- -n cinder.tests.unit.test_volume'
emits 36 FutureWarnings from oslo.versionedobjects about invalid
uuids as documented here [1].
This commit changes this module to use valid uuids so that when its
tests are run these warnings are no longer emitted.
Gorka Eguileor [Thu, 3 Mar 2016 13:00:34 +0000 (14:00 +0100)]
Fix oslo.service config generation
Cinder generation configuration sample does not contain any of
oslo.service configuration options.
This is because we are not using the right namespace when calling
oslo-config-generator since oslo.service is not a valid entrypoint as
mentioned in the documentation:
Cinder v2 API allows creating a volume with a quoted (single or double
quotes or even unbalanced number of quotes) display name. But when we
try to get info for such volume, we end up getting an error message
saying that no volume with such a name or ID exists. This error is due
to the inadvertent stripping of quotes from the filter in the api layer.
The api call eventually comes to check_volume_filters() in
cinder/volume/api.py. The invocation of ast.literal_eval() inside this
method strips the quotes for certain quoted strings leading to this
incorrect filtering. ast.literal_eval() is used to convert string
representations into python objects which are then used to frame the
SQL queries in the db layer. For example, the string "[1,2]" for a
filter (not the display name filter) gets converted to a list object
and results in an "IN" operation being emitted in the SQL query as
opposed to an exact match.
When display_name does not contain any quotes or contains an unbalanced
number of quotes, then ast.literal_eval() throws (just like the Python
interpreter would throw for an unquoted string literal or one with
unbalanced number of quotes). We handle this by ignoring the exception
and using the raw input value as the filter and moving on. For string
containing balanced number of quotes, such as, '"foo"',
ast.literal_eval() succeeds and returns the input with the surrounding
quotes stripped (just like how the python interpreter strips quotes
from a string literal to initialize a string var's value in memory).
To always use the raw user input string as the filter value, we can
either not pass string inputs to ast.literal_eval() or encode the
string using encode("string-escape") so that we get the original string
back after passing through ast.literal_eval(). We choose the former as
the latter buys us nothing.
Tom Barron [Wed, 2 Mar 2016 02:43:17 +0000 (21:43 -0500)]
Don't run test_volume.VolumeTestCase twice
Currently the test_volume.VolumeMigrationTestCase class inherits
from test_volume.VolumeTestCase and therefore runs all the unit tests
in the former class in addition to the 29 tests defined in its
own class. This provides no gain in coverage and is costly since
the tests in VolumeTestCase are among the most expensive we have.
This commit refactors cinder/tests/unit/test_volume.py such that
VolumeMigrationTestCase inherits directly from BaseVolumeTestCase,
thereby reducing the number of tests run from test_volume from
557 to 412, and total execution time (on my system) from 335s to
202s. Only duplicate tests are removed.
Gorka Eguileor [Wed, 2 Mar 2016 13:21:31 +0000 (14:21 +0100)]
Fix test_create_volume_flow test issue
One of the tests in
cinder/tests/unit/volume/flows/test_create_volume_flow.py incorrectly
mocks time.time function which means that when there's a call to
time.time() it will raise an error because real time function doesn't
expect any arguments but the mock method does expect self as an
argument.
For some reason time.time function does not get called on every test
run, but when it does get called it will fail.
This patch fixes this by binding the mock method to the current self
instance.
Gorka Eguileor [Wed, 2 Mar 2016 12:23:31 +0000 (13:23 +0100)]
Fix test isolation issues related to versions
In cinder.rpc.RPCAPI methods _determine_rpc_version_cap and
_determine_obj_version_cap use global variables LAST_RPC_VERSIONS and
LAST_OBJ_VERSIONS to cache version values so we need to clear these
values between tests so one test values don't get passed to the next
test.
This was problematic for example when running some
cinder.tests.unit.api.contrib tests in a specific order:
Wilson Liu [Wed, 17 Feb 2016 04:48:17 +0000 (12:48 +0800)]
Huawei: Manage volume fails due to lower array version
When we try to import an existing volume to cinder, we try
to find whether the volume already exists in a hypermetro.
But if the array version is lower than V3R3, the request
to find the hypermetro info will fail because array version
lower than V3R3 does not support hypermetro.
LisaLi [Mon, 29 Feb 2016 07:12:18 +0000 (15:12 +0800)]
Fix exception during service update
The function objects.Service.get_by_args raises HostBinaryNotFound
exception, but in service update function, it catches ServiceNotFound
exception by mistake.
This patch is to remove HostBinaryNotFound and use ServiceNotFound to make
things simple and consistent.
Helen Walsh [Wed, 11 Nov 2015 21:52:18 +0000 (21:52 +0000)]
VMAX-Replacing deprecated API EMCGetTargetEndpoints
8.x version of Solution Enabler no longer supports
EMCGetTargetEndpoints InvokeMethod. Replacing with
an AssociatorNames call from protocol controller
to EMC_FCSCSIProtocolEndpoint. It will retrieve
the same information.
Alex O'Rourke [Wed, 3 Feb 2016 16:11:58 +0000 (16:11 +0000)]
3PAR: Update replication to v2.1
This patch updates replication to match the v2.1 spec. This makes it
so an entire backend can be replicated, and upon failover, all
replicated volumes will be failed over together.
Both sync and periodic replication modes are supported. Each
replication_device entry should have a replication_mode value set
to sync|periodic.
A volume type extra_spec value of replication:mode
should also be set. If replication:mode is periodic,
replication:sync_period should be set as well. Which replication_device
entry(s) are used is determined by the value of replication:mode set for
each volume type. NOTE: If no extra_specs are provided, periodic mode is
defaulted with a replication period of 900 seconds.
cinder.conf should have the replication config group:
Alex O'Rourke [Tue, 1 Mar 2016 00:42:16 +0000 (16:42 -0800)]
LeftHand: Update replication to v2.1
This patch updates replication to match the v2.1 spec. This makes it
so an entire backend can be replicated, and upon failover, all
replicated volumes will be failed over together.
cinder.conf should have the replication config group:
Patrick East [Fri, 5 Feb 2016 23:52:31 +0000 (15:52 -0800)]
Update Pure replication to cheesecake
Migration to cheesecake replication. This basically
modifies any of the existing replication code to work on the whole
backend instead of the specified volume.
It also completes the transition to allow swapping the underlying array
being managed by cinder upon failover. In the v2 implementation it was
conditional on some operations where things *could* be on the other
array. Now it is all driver operations.
This also switches the target_device_id to backend_id in the config for
replication devices.
Szymon Borkowski [Tue, 12 Jan 2016 10:32:22 +0000 (11:32 +0100)]
Fixed logging for oslo versioned objects
Earlier, when we wanted to log a message with an object as a parameter,
obj_attr_is_set method used to check name parameter, which was a wrong
approach. The reason was, that the oslo logger, when received a
versioned object as a resource parameter, is trying to get the 'name'
parameter, which is a property, so the obj_attr_is_set method will
return False and the logger will try to get the 'type' parameter, which
does not exist in some versioned objects (please take a look at
oslo.logging code [1]).
Now, when the parameter's name is present in obj_extra_fields
dict, we avoid calling obj_attr_is_set and simply get() it.
The other cause was a difference between fields names: size (in volume
object) and volume_size (in snapshot object), and inproper condition
statement in lvm driver.
Tom Barron [Sun, 21 Feb 2016 12:00:54 +0000 (07:00 -0500)]
Trim 50s from huawei ISCSIDriver unit tests
The HuaweiISCSIDriver unit tests take almost a minute to run
on my machine because several negative test cases wait for
timeouts.
This commit leverages the utility method introduced in [1]
as well as the ZeroIntervalLoopingCall for mocks in the Huawei
unit tests to reduce total execution time for this set of
tests from about a minute to under 10s
Ivan Kolodyazhny [Tue, 16 Feb 2016 16:49:54 +0000 (18:49 +0200)]
Add 'conf' param for TextGuruMeditation autorun setup
Guru Meditation Report (GMR) supports report generation to file
in a configured directory. By default it will genarate
report to stdout stream. To configure GMR you have to add the
following section to cinder.conf:
Surya Ghatty [Fri, 26 Feb 2016 19:49:24 +0000 (19:49 +0000)]
Fix sshpool.remove code
Currently, sshpool.remove function under cinder/ssh_utils.py
is broken. The function tries to locate the passed in
sshclient object inside sshpool.free_items.
However, since the sshclient object is set to “None” at the
beginning, it never finds the object and ends up decrementing
the current size, without actually removing the object.
Made the following changes to fix:
1. Removed reset to ‘None’ so that the attempt to locate object
goes through.
2. Fixed the code to use free_items.remove(ssh) to remove the ssh
object identified instead of free_items.pop(ssh)
3. Also updated the code to decrement current size only if a match
is found in free_items.
4. Added test case to test remove() of an ssh client that is in the
free_items
5. Added test case to test that remove code does not inadvertently
remove an object from the pool if no match is found.
XinXiaohui [Tue, 1 Mar 2016 02:20:41 +0000 (10:20 +0800)]
Remove an useless and wrong call
In cinder/objects/service.py, the method
obj_make_compatible() of Class Service is
useless and it called convert_version_to_tuple()
incorrectly from utils from Cinder instead of
from versionutils from oslo_utils, just remove it.
Matt Riedemann [Mon, 29 Feb 2016 17:31:22 +0000 (12:31 -0500)]
Copy StandardLogging fixture from Nova
This code was originally written for Nova by Joe Gordon
<joe.gordon0@gmail.com> and Sean Dague <sean@dague.net>.
This enables debug logging that is exercised by unit test
runs to be handled and detect formatting errors. The debug
logging does not actually go to the console unless the
OS_DEBUG environment variable is set.
As a result, a few formatting errors are detected and
cleaned up with this change.
This also fixes a problem where debug logging from stevedore
is dumped to the console every time an extension is loaded,
which in a gate-cinder-python27 job is 65K+ times.
John Griffith [Fri, 26 Feb 2016 01:09:21 +0000 (01:09 +0000)]
Add ability to failback for replication V2.1
Initially we had setup replication V2.1 (Cheesecake) to NOT
do fail-back at least in the initial version.
It turns out that fail-back in the Cinder code is rather easy,
we just enable calling failover-host on a host that's already
failed-over and use the *special* keyword of "default" as the
backend_id argument which signifies we want to switch back to
whatever is configured as the default in the cinder.conf file.
To do this we just add some logic that checks the secondary_backend_id
param in volume.manager:failover_host and set service fields
appropriately. Note that we're sending the call to the driver
first and giving it a chance to raise an exception if it can't
satisfy the request at the current time.
We also needed to modify the volume.api:failover_host to allow
failed-over as a valid transition state, and again update the
Service query to include disabled services.
It's up to drivers to figure out if they want to require some
extra admin steps and document exactly how this works. It's also
possible that during an initial failover that you might want to
return a status update for all volumes NOT replicated and mark
their volume-status to "error".
Expected behavior is depicted in the service output here:
http://paste.openstack.org/show/488294/
Jacob Gregor [Wed, 24 Feb 2016 17:06:32 +0000 (11:06 -0600)]
Storwize SVC multiple management IPs
Right now Storwize SVC does not support multiple management IPs.
This patch adds this feature so that if the primary IP fails, it
will switch to the secondary IP that the user sets.
Eric Harney [Thu, 25 Feb 2016 17:13:11 +0000 (12:13 -0500)]
Capture warnings into logs
Modules that issue warnings via the python
warnings module result in messages printed
to stderr.
This change results in them being captured
into Cinder logs instead. This means that
logs from production environments contain
all of the relevant info for debugging
issues.
Xiaoqin Li [Thu, 25 Feb 2016 08:36:11 +0000 (00:36 -0800)]
IBM Storwize with pool-aware-cinder-scheduler
Storwize cinder driver only supports config one pool
within one backend right now. This change adds support
for multi-pools aware for scheduler.
storwize_svc_volpool_name accepts a list of pools
separated by comma in cinder.conf now.
User-Visible Change
-------------------
DocImpact
The configuration flag storwize_svc_volpool_name
should be updated to a ListOpt.
Implements: bp Storwize-pool-aware-support
Change-Id: If6f1decf4d6244b1e04b05b8662d891fb16c6790
Angela Smith [Wed, 24 Feb 2016 19:18:42 +0000 (11:18 -0800)]
Fix HTTP sessions left open in Brocade zone driver
Add missing call to logout html page on FC switch to close the HTTP
session on the FC switch in HTTP connector. Also, move the session
cleanup calls in the zone driver so that it is invoked for all code
paths.
Tom Barron [Mon, 29 Feb 2016 13:27:02 +0000 (08:27 -0500)]
Fix invalid uuid warnings in block device unit tests
Currently 'tox -epy27 -- --regex cinder.tests.unit.test_block_device' emits
a dozen FutureWarnings from oslo.versionedobjects about invalid uuids
as documented here[1].
This commit changes these tests to use valid uuids so that when they
are run these warnings are no longer emitted.