Jay S. Bryant [Thu, 26 Jun 2014 21:22:17 +0000 (16:22 -0500)]
Explicitly import _() in Cinder code
To ensure that logs are properly translated and logged to
the Cinder log files (using the Cinder message catalogs)
we need to explicitly import _() in any python files that
use the _() function.
John Griffith [Tue, 15 Jul 2014 17:45:17 +0000 (11:45 -0600)]
Update cinder generate_sample script
Cinder's generate sample script has fallen a
bit out of date and was no longer working properly
in local venv.
This patch updates it with a working version that
reads the rc file and makes some other updates.
Even better, we'll update the tox.ini file here so
that it actually works, and finally add some more
info to the error message when update check fails
to make is obvious how to run these appropriately.
Zhiteng Huang [Tue, 28 Jan 2014 06:23:04 +0000 (14:23 +0800)]
Add affinity/anti-affinity filters
Cinder has done a good job hiding the details of storage backends from end
users by using volume types. However there are use cases where users who
build their application on top of volumes would like to be able to 'choose'
where a volume be created on. How can Cinder provide such capability without
hurting the simplicity we have been keeping? Affinity/anti-affinity is one
of the flexibility we can provide without exposing details to backends.
The term affinity/anti-affinity here is to to describe the relationship
between two sets of volumes in terms of location. To limit the scope, we
describe one volume is affinity with the other one only when they reside in
the same volume back-end (this notion can be extended to volume pools if
volume pool support lands in Cinder); on the contrary, 'anti-affinity'
relation between two sets of volumes simply implies they are on different
Cinder back-ends (pools).
This affinity/anti-affinity filter filters Cinder backend based on hint
specified by end user. The hint expresses the affinity or anti-affinity
relation between new volumes and existing volume(s). This allows end
users to provide hints like 'please put this volume to a place that is
different from where Volume-XYZ resides in'.
This change adds two new filters to Cinder - SameBackendFilter and
DifferentBackendFilter. These two filters will look at the scheduler hint
provided by end users (via scheduler hint extension) and filter backends by
checking the 'host' of old and new volumes see if a backend meets the
requirement (being on the same backend as existing volume or not being on
the same backend(s) as existing volume(s)).
For example:
Volume A is on 'backend 1', to create Volume B on the same backend as A,
use:
cinder create --hint same_host=VolA-UUID SIZE
To create Volume C on different backend than that of A, use:
cinder create --hint different_host=VolA-UUID SIZE
Now, to create Volume D on different backend other than those of A and C,
use:
cinder create --hint different_host=VolA-UUID --hint
different_host=VolC-UUID SIZE
or:
cinder create --hint different_host="[VolA-UUID, VolC-UUID]" SIZE
liuqing [Mon, 30 Jun 2014 15:18:05 +0000 (23:18 +0800)]
Fix the section name in CONTRIBUTING.rst
The name of the section "If you're developer, start here"
has changed in the wiki, now is "If you're a developer".
This commit updates it to correctly refer to the
proper section.
After adding reset method when SIGHUP signal is sent to
wsgi service parent process,then it sends SIGHUP signal
to all of its child processes. Each child process handles
SIGHUP signal by first stopping the service and then calls
service start method again. When it stops the service, it
kills the eventlet thread, which internally closes the wsgi
server socket object. This server socket object is now not
usable again and it throws following error, while restarting
the service:
error: [Errno 9] Bad file descriptor
To resolve 'Bad file descriptor' error, creating duplicate
socket object, every time service starts.
John Griffith [Wed, 9 Jul 2014 21:34:50 +0000 (21:34 +0000)]
Clean up base Volume Driver
This is a preliminary cleanup of the base
Volume Driver to prepare for adding new
architecture which keeps the Control calls
and connection portions of the drivers
seperated from each other.
This doesn't break existing compatability or drivers
but just makes some of the necessary tweaks and additions
to enable implementation of decoupled Control and Data
sides of the Volume drivers.
POC for this proposal is here:
https://review.openstack.org/#/c/104701/
FYI check-up2-date is going to be the death of us all!
rajinir [Fri, 27 Jun 2014 19:53:07 +0000 (14:53 -0500)]
Fixes EqualLogic volume live migration.
Fixes the issue by enabling the multihost flag for the volume and also
discovering the correct access record to delete when terminating
the connection from the source vm and then deleting the record.
Jay S. Bryant [Mon, 7 Jul 2014 20:21:58 +0000 (15:21 -0500)]
Sync gettextutils.py from oslo-incubator
This pulls in the latest gettextutils.py from oslo-incubator.
The primary reason for this sync is to get commit 3d90045d2d1ce1df89f75937f415e3982e111063 which backports a
change from the new i18n library to check lazy enablement
at runtime. Adding this change makes it possible to remove
the global enablement of lazy translation through
gettextutils.install(). Instead we will use gettextutils.enable_lazy()
with explicit imports of _() in each file where _() is used.
The change to remove gettextutils.install() and to add the
explicit _() imports will come in a dependent patch.
Current HEAD in OSLO:
--------------------
Merge: 3d90045d2d1ce1df89f75937f415e3982e111063
Date: Mon, 07 Jul 2014 17:55:18 +0000
Merge "Backport code for i18n to check lazy at runtime"
--------------------
Additional changes being merged (newest to oldest):
-------------------- de4adbc4 - pep8: fixed multiple violations 9912e5df - Add API for creating translation functions 6cc96d05 - Fix test_gettextutils on Python 3
--------------------
related - blueprint: i18n-enablement
Change-Id: I4706b89b0b64c5816a1a022b6cd1dfa01b29b5dc
Cory Stone [Tue, 8 Jul 2014 20:01:04 +0000 (15:01 -0500)]
Remove $sqlite_db from default database connection
sqlite_db used to be a config option in the DEFAULT section. This
allowed it to be used in config template substitution. Now that it is in
the database section, the template substitution fails with a
NoSuchOptError.
The quick fix is to just hardcode the default connection option to refer
directly to 'cinder.sqlite' instead.
33afb20 Fix broken formatting of processutils.execute log statement 5e3d3a5 Mask passwords included without quotes at the ends of commands 6751b30 Remove extra whitespace
The most important part is '33afb20' which was broken cinder debug logging
on running commands after last oslo sync.
Tom Fifield [Tue, 24 Jun 2014 13:59:20 +0000 (21:59 +0800)]
Enhance docstring for iscsi_helper
The helptext for the iscsi_helper option did not mention the
potential to use lioadm (or fake). This patch simply amends
the text so this functionality is more discoverable.
This patch ensures that the FC ZoneManager
is called during for all cases in Cinder
that does a volume attach/detach for FC
enabled drivers.
The problem was that we had code in the volume
manager that manually called the ZoneManager,
after initialize_connection and terminate_connection,
but other places in Cinder were not calling the
ZoneManager.
This patch creates 2 new decorators that can
be used for any driver's initialize_connection
and terminate_connection call. The decorator
checks to make sure that the return value is for
a fibre_channel attachment and then calls the
ZoneManager's add_connection or delete_connection.
Change-Id: Ie3ae70785f500a140003ad3a8495e0ddc3516ea8
Closes-Bug: 1321798
Tom Cammann [Fri, 4 Jul 2014 08:22:46 +0000 (09:22 +0100)]
sync periodic_task fix from incubator
Set the value of time the periodic task was last run to a multiple of
the spacing value rather than the actual last time run. This ensures
tasks runs regularly but avoids synchronizing that interval with other
nodes.
This patch also removes the coalescing of tasks which are _nearby_ (0.2
seconds away).
Changes:
periodic_task
------------- 4dbd3aa Make periodic tasks run on regular spacing interval 21249f1 Fix parenthesis typo misunderstanding in periodic_task
The volume_image_metadata field was missing from the volume list
because we tried to filter VolumeGlanceMetadata against a non-existent
project_id field. Filtering should be done on the Volume associated
to the VolumeGlanceMetadata instead.
Move project_id filtering out of model_query as it assumes
the project_id field is in the queried model itself.
Build the filter ourselves against Volume.
Matt Riedemann [Fri, 27 Jun 2014 17:57:33 +0000 (10:57 -0700)]
Use (# of CPUs) osapi_volume_workers by default
This changes the default number of cinder API workers to be equal to the
number of CPUs available on the host, rather than defaulting to 1 as it
did before.
DocImpact: osapi_volume_workers will now be equal to the number of
CPUs available by default if not explicitly specified
in cinder.conf.
UpgradeImpact: Anyone upgrading to this change that does not have
osapi_volume_workers specified in cinder.conf will now be
running multiple API workers by default when they restart
the cinder-api service.
Zhiteng Huang [Fri, 27 Jun 2014 19:38:08 +0000 (03:38 +0800)]
Restore osapi_volume_workers config option
osapi_volume_worker was introduced when enabling multi-process API
support for Cinder. However, this config option was accidentally
dropped in commit 464277220ddb800ac69562649fde62e5ca9358c4
(https://review.openstack.org/#/c/67657/20/cinder/service.py).
As a result, the value in cinder.conf wouldn't be honored. This
change restore this config option.
Yaguang Tang [Mon, 23 Jun 2014 03:59:44 +0000 (11:59 +0800)]
Fix host option isn't set when using multiple backend
When using multiple volume backend, and volume driver is
cinder.volume.drivers.block_device.BlockDeviceDriver, host
option isn't set so a call to get volumes of a host returns none,
This patch changes to use self.host instead of self.configuration.host
Commit 971a63bd9cf675a00bce1244ec101577b5c17cac added a new
parameter 'optional_args' to execute method of QuotaReserveTask
and QuotaCommitTask. So the new parameter should be needed where
those Tasks are used. This changed volume create task flow to
provide the new parameter. We need the samiliar change to get_flow
method in cinder/volume/flows/manager/manage_existing.py
This patch checks to make sure that we don't
include the initiator_target_map in the return
of terminate_connection if there are volumes
still attached for a particular host. The
FibreChannel ZoneManager doesn't remove zones
if there isn't an initiator_target_map in the
return of terminate_connection.
If the rbd driver fails to connect to Ceph the exception
was not being properly caught resulting in the volume
remaining in the 'creating' state until the corresponding
task eventually times out (on top of the time it took
for the connect to fail).
Also added config option for rados connect timeout.
DocImpact: new config option 'rados_connect_timout'
Closes-Bug: 1211839
Change-Id: I5e6eaaaf6bed3e139ff476ecf9510ebe214a83f9
John Griffith [Sun, 29 Jun 2014 15:06:31 +0000 (09:06 -0600)]
Add cinder-manage cmd to update host column
If you deploy Cinder as per the default using the docs,
you can't later decide to add backends using the
multi-backend functionality. The reason is that multi-backend
is implemented by appending a backend-name to the host entry.
So if you convert the config to multi-backend the hostname
for any volumes that you have created are no longer
associated with a valid volume-driver (ie you can no
longer perform operations including delete on these
volumes).
In addition, in the case of using a SAN attached backend if
one redeploys their cinder-volume service to another node
they'll have the same issue.
This patch adds a cinder-manage command that will go through
volumes that are located on a specified host and update
the host column on each of them.
Matt Riedemann [Fri, 27 Jun 2014 16:50:56 +0000 (09:50 -0700)]
Sync processutils from oslo with deps
The main target for the sync is to pick up the get_worker_count()
method in commit 85f178489a128a04a7ee3ed44018403caa109ef0 so that we can
set osapi_volume_workers equal to the number of CPUs on the host.
Changes:
processutils
------------ 85f1784 Move nova.utils.cpu_count() to processutils module cdcc19c Mask passwords that are included in commands 8a0f567 Remove str() from LOG.* and exceptions 51778f9 Allow passing environment variables to execute() fcf517d Update oslo log messages with translation domains af41592 Catch OSError in processutils f773ea2 Fix i18n problem in processutils module 8b2b0b7 Use hacking import_exceptions for gettextutils._ 3b71f46 Fixed misspellings of common words 12bcdb7 Remove vim header a4dab73 Correct execute() to check 0 in check_exit_code
importutils
----------- 1173e46 Remove ValueError when accessing sys.modules
jsonutils
--------- 0d7296f Add kwargs to jsonutils.load(s) functions
log
--- 109e325 Use oslo.messaging to publish log errors de4adbc pep8: fixed multiple violations eac71f5 Fix common.log.ContextFormatter for Python 3 d78b633 Fixes a simple spelling mistake 621d831 always log a traceback in the sys.excepthook 90ae24b Remove redundant default=None for config options af36c2a Fix logging setup for Python 3.4 cdcc19c Mask passwords that are included in commands
strutils
-------- 8a0f567 Remove str() from LOG.* and exceptions fd18c28 Fix safe_encode(): return bytes on Python 3 302c7c8 strutils: Allow safe_{encode,decode} to take bytes as input
timeutils
--------- 250cd88 Fixed a new pep8 error and a small typo
The following changes are included with this patch:
-> 18f2bc1 Enforce unicode json output for jsonutils.load[s]()
--> cinder/openstack/common/jsonutils.py
Zhiteng Huang [Tue, 24 Jun 2014 07:59:10 +0000 (15:59 +0800)]
Bump minimum hacking version to 0.9.2
Take advantage of newer version hacking to automate a few style checkings.
A change included this hacking update was proposed by OpenStack Proposal Bot
in earlier patch sets (before 19) but somehow it was missed in latter
proposals. (https://review.openstack.org/#/c/96206/)
Modified/New rules in 0.9.2:
Rule changes:
* Report E129 instead of E125 for visually indented line with same indent
* as next logical line.
* Report E265 for space before block comment.
* Report E713 and E714 when operators ``not in`` and ``is not`` are
recommended (taken from hacking).
* Report E131 instead of E121 / E126 if the hanging indent is not consistent
within the same continuation block. It helps when error E121 or E126 is
in the ``ignore`` list.
* Report E126 instead of E121 when the continuation line is hanging with
extra indentation, even if indentation is not a multiple of 4.
- Dropped H901,H902 as those are now in pep8 and enforced by E713 and E714
New rules:
+ H104 File contains nothing but comments
+ H305 imports not grouped correctly
+ H307 like imports should be grouped together
+ H405 multi line docstring summary not separated with an empty line
+ H904 Wrap long lines in parentheses instead of a backslash
These rules (including changed rules) are all disabled in this change if they
caues any pep8 checking failure, and will be turned on in follow-up patches
if considered useful.
Original commit message in openstack/requirements:
Hacking 0.9.1 was out for a while (hacking 0.9.0 had a minor bug in it, so its
blacklisted), and we want to start supporting projects to migrate over
to 0.9.x. Expand the upper bound to allow 0.9.x while still
supporting 0.8.x series so we keep the old version in our mirrors as to
not break anything.
Joshua Harlow [Fri, 27 Jun 2014 00:52:04 +0000 (17:52 -0700)]
Only warn about deprecation warnings once
Instead of repeatly emitting data about which
modules are deprecated again and again just warn
about those deprecation once and then never warn
about them again.
This is a good thing to have, and will be needed
as taskflow moves one of its classes used in cinder
to a new and longer-term location and will emit
deprecation about the usage of the old location.
Eric Harney [Thu, 10 Apr 2014 16:57:50 +0000 (12:57 -0400)]
Fix dropped exception for create_export in vol manager
If self.driver.create_export() fails, model_update is
False and this exception is therefore not logged,
causing things to break later in the execution path in
unexpected ways.
ling-yun [Wed, 25 Jun 2014 02:40:38 +0000 (10:40 +0800)]
Support Volume Num Weighter
Currently cinder support choosing volume backend according to
free_capacity and allocated_capacity. Volume Num Weighter is
that scheduler could choose volume backend based on volume number
in volume backend, which could provide another mean to help
improve volume-backends' IO balance and volumes' IO performance,
see details in ref [1] and [2].
Tom Fifield [Thu, 26 Jun 2014 06:18:59 +0000 (14:18 +0800)]
Fix docstring for snapshots API
For some reason, the snapshots controller class' introductory
docstring stated that it was the volume API controller.
This patch changes it to say:
"The Snapshots API controller for the OpenStack API."
'with session.begin()' makes some operations in one transaction.
session.begin() returns a transaction instance, then does some operations,
and will commit or rollback automatically before leaving the block.
ModelBase.save() always submit a commit, and that is not expected.
When we get a persistent object from database, we just modify the
object inside of block 'with session.begin()' and sqlalchemy will
update it, don't need method session.add() or ModelBase.save().