git-harry [Tue, 25 Nov 2014 14:20:26 +0000 (14:20 +0000)]
Match mock.patch decorator with appropriate param
mock.patch and mock.patch.object can be used as decorators for mocking
within the scope of the function they decorate. When there are multiple
decorators it is important the function parameters relate to the
corresponding patch objects i.e. that the parameter order matches the
decorator order.
It is easiest to explain this with an example:
So the decorator closest to the function definition must correspond to
the first (left-most) patch parameter. Note, if the decorator is given a
third argument, the kwarg new, then the decorated function is not
passed an extra argument by that decorator.
ChangBo Guo(gcb) [Mon, 24 Nov 2014 06:13:01 +0000 (14:13 +0800)]
Don't use module importutils from oslo-incubator
* Syncs latest module service
Removes its dependency for oslo-incubator module importutils.
Removes code which was never executed after switched to oslo.messaging.
Include changes: 5d40e14 Remove code that moved to oslo.i18n 6ede600 rpc, notifier: remove deprecated modules
* config.genrator has been removed from oslo-incubator, so update
config.generator to use importutils from oslo.utils directly.
git-harry [Sat, 22 Nov 2014 10:16:22 +0000 (10:16 +0000)]
Fix calls to assert_called_once in unit tests
Mock has a method called assert_called_once_with to check that a mock
was called and the arguments it took were as expected. Mock does not
have a method called assert_called_once and calling it just creates a
mock bound to that name. This means that not only is nothing tested
when assert_called_once is used, the tests also don't warn about this.
This commit attempts to address this in two ways:
- all occurrences of assert_called_once are replaced with a real
assertion.
- the hacking check that nova uses to guard against this has been
copied to cinder's local hacking checks.
Fixing the assert_called_once issues also highlighted other mistakes
in certain tests which were addressed to make the tests pass.
Due to the nature of mock, this issue is also possible if a method is
misspelt or just mistakenly used and so the hacking check is only
addressing one very specific case. That said, it does appear to be a
common mistake and so is worth singling out.
Clinton Knight [Wed, 17 Sep 2014 00:23:52 +0000 (20:23 -0400)]
Refactoring to allow addition of NetApp FibreChannel drivers
NetApp's five Cinder drivers have been in continuous development
for nearly 3 years, and it is now necessary to do some house-
cleaning. This commit splits long files that contain multiple
classes, fixes the class hierarchies to enable subclassing
different driver classes (ISCSIDriver, FibreChannelDriver),
and renames classes. It also begins the process of moving
unit test files into a matching hierarchy in the "tests" tree.
Sean McGinnis [Tue, 4 Nov 2014 11:15:26 +0000 (12:15 +0100)]
Add ability to create volume from image by image name.
Some cli commands allow specifying an image by either
its name or its ID. Creating a volume from an image
currently requires knowing the image ID. The request
was made to add the ability to create a volume using
the image name instead.
This patch adds the ability to accept either name or ID.
It will attempt to locate the image based on this input
and fail if neither can be matched. If found by name, it
will also verify there are not multiple images of the
same name. If this is the case it will require using the
ID to be explicit.
Will update python-cinderclient in a separate patch once
this has been merged to allow ID or name.
The backing VM corresponding to a volume is cloned during create volume
from another volume, snapshot or image. The backing VM is also cloned
during retype and backup restore. Currently, the target ESX host is
unset while calling vCenter CloneVM_Task API and hence the source ESX
host is used as the target. If the destination datastore returned by
the datastore selection logic is not accessible to the source host,
clone fails. This patch fixes the problem by setting the target ESX
host (returned by datastore selection logic) while invoking clone.
Vincent Hou [Mon, 17 Nov 2014 06:33:35 +0000 (22:33 -0800)]
Convert the DateTime into ISO8601 format for Ceilometer
The fields of DateTime type should be converted to the time in
ISO8601 format, when they are put in the usage information to be
reported to Ceilometer.
Alex Meade [Thu, 17 Apr 2014 14:34:38 +0000 (10:34 -0400)]
NetApp NFS and iSCSI: move zapi client logic into modules
This patch moves the logic for constructing zapi requests
into its own modules in order to reduce coupling with
driver logic, improve testability, and improve readability.
This patch also adds unit tests around the zapi request
logic.
Zhiteng Huang [Fri, 21 Nov 2014 18:53:40 +0000 (02:53 +0800)]
Context cleanup
Before the fix of bug #1386932 (285cfaf0954d4c3e320b205c288240c1828476fe)
was committed, there are a few hacks in Cinder where an original copy
of (un-elevated) context has to be saved before doing
context.elevated(). Now that we have the fix in place, it's time to
clean up those old hacks.
Jay S. Bryant [Wed, 19 Nov 2014 21:01:10 +0000 (15:01 -0600)]
Fix messages in EMC VMAX driver with no translation
There were a number of messages in the EMC VMAX driver
for LOG.info, LOG.error and LOG.warning that had no translation
marker on them. This patch adds the appropriate _LI, _LE or _LW
marker so that the message will be translated. Since there is
a separate effort to add in the log level markers going on I
did not attempt, in this patch, to address that issue. Just
thought we should get translation on the messages that were missing it.
Patrick East [Fri, 21 Nov 2014 16:39:45 +0000 (08:39 -0800)]
Fixup regressions in PureISCSIDriver log statements.
There were some conflicting patches that went in to fix i18n helpers,
and in the merge resolution we lost some changes that previously removed
all uses of .format() from the driver. This puts back in the updated
log statements originally added in
https://review.openstack.org/#/c/135047/
Mike Mason [Tue, 11 Nov 2014 09:11:29 +0000 (09:11 +0000)]
Implementing the use of _L’x’/i18n markers
Placing the _Lx markers back into the code. No other cleaner solution has
has been implemented. Patches will be submitted in a series of sub
directories and in a fashion that is manageable.
This is the fourth commit of this kind
ChangBo Guo(gcb) [Fri, 21 Nov 2014 11:53:19 +0000 (19:53 +0800)]
Sync policy from oslo-incubator
Sync latest policy module at ddd63a7346bb57a47b0cd031608fc9475d68e241 to
help remove it's dependency for jsonutils. It also fixes some
bugs and introduces new option "policy_dirs", allow developer to add
some policy files in multiple directories.
ChangBo Guo(gcb) [Fri, 21 Nov 2014 08:47:31 +0000 (16:47 +0800)]
Sync latest versionutils from oslo-incubator
Sync latest versionutils to let us add warning for deprecated class in
Kilo. This also syncs its dependency module log and _i18n.
versionutils: 5d40e14 Remove code that moved to oslo.i18n 1c3ecfc Enhance versionutils.deprecated to work with classes 9a46271 Add Kilo release name to versionutils a2ad3a2 Allow deprecated decorator to specify no plan for removal 05ae498 Add JUNO as a target to versionutils module de4adbc pep8: fixed multiple violations
log: ac4330d Make use_syslog=True log to syslog via /dev/log df774ff Import PublishErrorsHandler from oslo.messaging a3220c5 add list_opts to all modules with configuration options 6c706c5 Delete graduated serialization files 5d40e14 Remove code that moved to oslo.i18n 6ff6b4b Switch oslo-incubator to use oslo.utils and remove old modules aa74411 log: add missing space in error message
In file "image_utils.py", "tmp" variable initialized in try
block. So, if any exception occurred in the try block, then
"tmp" would not be assigned with any value. Because of this
finally block will raise an exception like "local variable
tmp tried to use before the assignment".
This patch resolves that issue by defining "tmp" variable before
try block.
Patrick East [Sat, 13 Sep 2014 00:09:42 +0000 (17:09 -0700)]
PureISCSIDriver needs to disconnect hosts before deleting volumes.
Some error conditions can cause a situation where the volume is
“connected” to a Purity host, but the volume failed to attach on the
initiator side. If we then try to delete this volume it will cause
errors and leave orphaned volumes behind on the Flash Array.
The solution is to check for any connections and then remove them prior
to making a call to delete the volume.
Jay S. Bryant [Thu, 20 Nov 2014 17:06:48 +0000 (11:06 -0600)]
context.elevated() should use copy.deepcopy()
Currently context.elevated is just doing a copy.copy(self).
This needs to be changed to use copy.deepcopy so that the
list reference is not shared between objects which leaves
the possibility of an admin role leak.
This fix changes context.elevated use copy.deepcopy.
ChangBo Guo(gcb) [Mon, 10 Nov 2014 12:45:12 +0000 (20:45 +0800)]
Switch Cinder to use oslo.concurrency
Let's switch to the newly released oslo library for the
processutils and lockutils. We use the config fixture(s) to
specify disable_process_locking and lock_path in the CONF
variable of oslo.concurrency library for correctly setting the
flags.
ChangBo Guo(gcb) [Mon, 10 Nov 2014 08:53:18 +0000 (16:53 +0800)]
Use oslo.utils
oslo.utils library now provides the functionality previously in
oslo-incubator's excutils, importutils, network_utils, strutils
timeutils, units etc. Some of these outdated modules will still be
around for a while until all other oslo modules that use them have been
updated in future commits.
Lucian Petrut [Fri, 14 Nov 2014 16:22:04 +0000 (18:22 +0200)]
Change CHAP secret default length
Some of the iSCSI initiators have a limit regarding the maximum
CHAP secret length. For example, the MS iSCSI Initiator
does not allow CHAP secrets longer than 16 characters, smaller
than the actual default 20 characters length.
This patch simply changes the default length to 16 characters,
value which is already used by default by some of the volume
drivers. In fact, the iSCSI specs state that: "Implementations
MUST support use of up to 128 bit random CHAP secrets".
Mike Mason [Mon, 17 Nov 2014 09:58:10 +0000 (09:58 +0000)]
Implementing the use of _L’x’/i18n markers
Placing the _Lx markers back into the code. No other cleaner solution has
has been implemented. Patches will be submitted in a series of sub
directories and in a fashion that is manageable.
This is the sixth commit of this kind
ChangBo Guo(gcb) [Mon, 10 Nov 2014 06:32:44 +0000 (14:32 +0800)]
Switch to oslo.serialization
Very simple import change in each file, just touches a whole
lot of files. jsonutils has graduated into a standalone library
and has been removed from the oslo-incubator repository.
We should be using the library for all projects.
This commit doesn't change files synced from oslo-incubator, and
doesn't remove the 'module=jsonutils' in openstack-common.conf.
Another sync commit will cover that.
John Griffith [Tue, 18 Nov 2014 19:37:11 +0000 (12:37 -0700)]
Fix typo in SolidFire xDBVersionMismatch label
The retryable errors list in the SolidFire driver includes
an xDBVersionMismatch error that can be emitted from the
device. During some recent work however the spelling of
the error was incorrect, so it's never deteceted/retried
as it should be.
This patch fixes the typo from 'xDBVersionMisMatch' to
xDBVersionMismatch'.
rick.chen [Wed, 12 Nov 2014 03:50:37 +0000 (11:50 +0800)]
Fix a problem in creating consistency group in ProphetStor driver.
a.Failed to create CG in the storage:
Storage site cannot accept CG uuid including "-" word. Before
sending API to back-end storage, the "-" word in the CG uuid
needs to be removed.
b.Failed to delete volume of CG:
Corrected api leaving group operation key.
Xing Yang [Tue, 18 Nov 2014 04:28:39 +0000 (23:28 -0500)]
Disable Cgsnapshot APIs by default
Currently consistency group APIs are disabled by default because there are
only a very small number of drivers that have implemented them. In
cinder/etc/cinder/policy.json, there are the following entries:
Note that Cgsnapshot related APIs are not disabled by default. They should be
disabled to be consistent. So the policy entries will be changed to the
following in this patch:
When we provide invalid GlusterFS share format in GlusterFS shares
configuration file (glusterfs_shares_config), it will log a
Warning message in the volume log file, which not easily discover
able while debugging.
So, this patch changing Invalid GlusterFS share Warning message to
Error message.
Pascal Wehrle [Mon, 17 Nov 2014 22:20:17 +0000 (23:20 +0100)]
allow image_id for imageRef in create volume API v2
The create volume request for the V2 API has a property named
"imageRef" with the ID of the image to be used when creating the
volume.
The name of this property is inconsistent as all multi word
properties use snake case and the property in the reponse is named
"image_id".
This adds support for aliasing the imageRef key with image_id when
creating a volume in v2 of the Cinder API in a backward-compatible
way.
Jay S. Bryant [Mon, 17 Nov 2014 19:11:03 +0000 (13:11 -0600)]
Update cinder.conf.sample to fix max db conn retries
Another external library change (oslo.db) has broken the gate
because cinder.conf.sample appears to be out of date. The change
was just to a message string:
Maximum number of database connection retries during
startup. Set to -1 to specify an infinite retry count. (integer value)
->
Maximum db connection retries during startup. Set to -1 to
specify an infinite retry count. (integer value)
This patch updates cinder.conf.sample to get beyond this failure. The
Cinder team will be talking about how to avoid these issues in the future.