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.
apoorvad [Wed, 23 Dec 2015 23:07:30 +0000 (15:07 -0800)]
Tintri image direct clone
Fix for the bug 1400966 prevents user from specifying image nfs
share location as location value for an image.
This broke Tintri's image direct clone feature.
This addresses the issue by using provider_location of image
metadata to specify image nfs share location.
When multipath is enabled, and the 3PAR driver is configured
to export a VLUN over N iSCSI IP(ports), we now use the same
LUN ID for each iSCSI IP export. Previously, when we would
export a volume over N iSCSI ports, we would get a new LUN ID
for each iSCSI port.
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:
Tom Barron [Sun, 21 Feb 2016 12:00:54 +0000 (07:00 -0500)]
Convert huawei ISCSIDriver unit tests to RFC5737 addrs
In the course an earlier review [1] it was suggested that
it would be good to change the live IPv4 addresses in these
tests to RFC5737 addresses [2], a range of addresses dedicated
for documentation, unit tests, and the like.
This commit makes these address substitutions without impacting
the function of the unit tests themselves.
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 [Tue, 26 Jan 2016 23:12:37 +0000 (23:12 +0000)]
EMC VMAX - Limit SG and MV to 64 characters
VMAX restricts storage group and masking view names to a maximum
length of 64 characters. This patch only adds extra unit tests to
prove that both MV and SG names are below the 64 chars in all
scenarios.
Helen Walsh [Sat, 13 Feb 2016 23:26:47 +0000 (23:26 +0000)]
EMC VMAX - Recreating SG when it has been deleted
The default storage group for VMAX3 can be deleted when
the last volume has been removed from it. Certain
scenarios require a volume to be returned to the default
storage group.
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.