60 Commits

Author SHA1 Message Date
Mark McLoughlin
68f28d257c Add CINDER_LOCALEDIR env variable
Part of fixing bug #995287

Syncs these two commits from oslo-incubator:

  Support overriding oslo localedir too
  Add a gettextutils.install() helper function

to get a new gettextutils.install() function which allows the default
localedir to be overwritten via an environment variable.

Note that gettextutils.install() must be called before any other cinder
modules are imported since some modules attempt to translate strings
at import time (e.g. in cinder.flags). This is broken and inefficient,
but fixing it involves adding something like sphinx's l_() function and
would be very invaisve.

Change-Id: I86562b3a65d371673bb21f7179eecc7602bc0775
2013-05-13 23:17:59 +08:00
Mark McLoughlin
7cfb0388ff Remove gettext.install() from cinder/__init__.py
The gettext.install() function installs a builtin _() function which
translates a string in the translation domain supplied to the install()
function. If gettext.install() is called multiple times, it's the last
call to the function which wins and the last supplied translation domain
which is used e.g.

 >>> import os
 >>> os.environ['LANG'] = 'ja.UTF-8'
 >>> import gettext
 >>> gettext.install('keystone', unicode=1, localedir='/opt/stack/keystone/keystone/locale')
 >>> print _('Invalid syslog facility')
  n無効な syslog ファシリティ
 >>> gettext.install('cinder', unicode=1, localedir='/opt/stack/nova/cinder/locale')
 >>> print _('Invalid syslog facility')
 Invalid syslog facility

Usually this function is called early on in a toplevel script and we
assume that no other code will call it and override the installed _().
However, in Cinder, we have taken a shortcut to avoid having to call it
explicitly from each script and instead call it from cinder/__init__.py.

This shortcut would be perfectly fine if we were absolutely sure that
nova modules would never be imported from another program. It's probably
quite incorrect for a program to use cinder code (indeed, if we wanted
to support this, Cinder code shouldn't use the default _() function) but
nevertheless there are some corner cases where it happens. For example,
the keystoneclient auth_token middleware tries to import cfg from
cinder.openstack and this in turn causes gettext.install('cinder') in
other projects like glance or quantum.

To avoid any doubt here, let's just rip out the shortcut and always
call gettext.install() from the top-level script.

However, there's a bit of an annoying detail here - by default,
nosetests starts in the current directly and tries to import all modules
it finds to look for tests. Without the _() builtin installed, importing
some modules like cinder.flags will fail.

Since it only ever makes sense to load tests from the cinder/tests dir,
we can ask nose to do that by using the --tests argument via setup.cfg.

Note, this means that if you previously did this:

  $> tox -- cinder.tests.foo cinder.tests.bar

then you must now do this:

  $> tox -- --tests cinder.tests.foo,cinder.tests.bar

Change-Id: If4125d6bcbde63df95de129ac5c83b4a6d6f130a
2013-05-13 18:45:25 +08:00
Stephen Mulcahy
1c77c54164 Add service list functionality cinder-manage
Adds functionality similar to nova-manage service list
to cinder-manage.

Change-Id: I9bcd6dcb551dbced2cfd6fcf0e63ffe4bb8754e8
2013-04-09 08:15:07 +00:00
Stephen Mulcahy
9d359c01f3 Fix cinder-manage backup list to work with uuids
Fixes bug #1164922

Change-Id: I8ed7ff7ca334b983d60445d96cd1f6c368766407
2013-04-05 09:55:40 +00:00
Davanum Srinivas
3a106f7e67 getLogger should be called after logging is configured
logging needs to be setup properly before we try to log
something. Fixed one spot from logging->LOG

Fixes LP# 1161038

Change-Id: I87743cff9062e47c1d5e989c2c0c05c3921b65c7
2013-03-28 08:54:50 -04:00
Stephen Mulcahy
e1561b8f8a Extend param2id() to work with uuids
Add uuid support to param2id() to allow commands including
cinder-manage volume delete to work with uuid style volumd ids

Fixes bug #1158409

Change-Id: I2d197320b61f44d1104ed0342a6b5b70f673468a
2013-03-21 18:10:31 +00:00
Walter A. Boring IV
eae0264782 Update Cinder's latest copy of OSLO grizzly stable
This patch updates all the files from oslo under
stable/grizzly but policy.py.  policy.py is a high risk
change at this date and it has lots of changes since the
last time we updated it.

Fixes bug #1157126

Change-Id: I399a1cd8474f718ed5196def90d2fea546fb01f5
2013-03-20 14:55:55 -07:00
Jenkins
5718774c3b Merge "Add snapshots to the volume usage audit report" 2013-03-20 18:23:19 +00:00
Sean Dague
b66c3361be remove cinder-rtstool because of rtslib dep
rtslib is AGPL, so cinder-rtstool is defacto AGPL by importing it.
Remove cinder-rtstool from the OpenStack repository.

Fixes bug #1157091

Change-Id: I30c9ee19d43107fa7f2e5e65d69049b8d69d2bdf
2013-03-19 15:32:05 -04:00
Michael Kerrin
f117a0e22a Add snapshots to the volume usage audit report
* Added tests for db api call volume_get_active_by_window called by the volume
usage audit report.

* Added new db api called snapshot_get_active_by_window & test it. This is
similar to the volume_get_active_by_window method but returns the snapshots
 active the supplied time window.

* Integrate the above into the cinder-volume-usage-audit script to report on
  all the active snapshots as well as volumes in the specified time frame.

Fixes: bug #1157110

Change-Id: I7597da20c62150a8f6c74cbfeec159f68064d2a6
2013-03-19 18:19:45 +00:00
Jenkins
15cd9ac742 Merge "Update oslo rpc libraries" 2013-03-11 11:54:52 +00:00
Michael J Fork
3d9a51efa7 Update oslo rpc libraries
Update oslo rpc libraries to capture changes, primarly motivated
by secret=True flag on password config options. Skipping broken,
invalid test case while working on correct fix.

Change-Id: Ibb979189b4a6215f307cb49e4a17070ffc7f0f51
2013-03-10 00:05:09 +00:00
Eric Harney
67dd248bcb LIO iSCSI initiator ACL auto-config
Currently, IQNs of remote nova compute nodes must be specified in
cinder.conf for them to be added to LIO's ACLs for LUNs.

This change will handle this at volume-attach time instead.

Change-Id: I278ce737042b15bd4d100d331564c1377bac0c55
2013-03-08 14:01:53 -05:00
Stephen Mulcahy
b138481606 Fixed cinder-backup start errors seen with devstack
Changes:
- Added cinder-backup to scripts in setup.py
- Added service_name to backup manager __init__
- Switched backup manager to using oslo.config
- Modified cinder-backup to use ProcessLauncher

Fixes bug: 1131147

Change-Id: I9b02d64def4ee892e9cfde4b4bcd50e5f9f9b707
2013-02-21 11:11:35 +00:00
Duncan Thomas
f50c8cbed1 Implement a basic backup-volume-to-swift service
Implements: blueprint volume-backups

This patch adds the new service, api and basic unit tests

Change-Id: Ibe02c680c5e9201d208c92e796e86ad76b4b54b3
2013-02-21 00:00:30 +00:00
Eric Harney
79551a68d3 Add LIO configuration for iSCSI initiators
LIO requires iSCSI initiator IQNs to be specified in an ACL to be
allowed to connect to the target. Currently this is only done for
the IQN of the initiator on the cinder-volume node.

This patch allows setting lio_initiator_iqns in cinder.conf to
provide access to other nodes.  (Remote Nova compute nodes.)

Change-Id: I7ddee542fcd3fba5b6f142ad15459c08cfedc9d2
2013-02-20 08:28:15 -05:00
Jenkins
d5ac3cb692 Merge "Update cinder-manage to use FLAGS.log_dir." 2013-02-20 10:36:27 +00:00
Mark McLoughlin
d5a17b4570 Use oslo-config-2013.1b3
The cfg API is now available via the oslo-config library, so switch to
it and remove the copied-and-pasted version.

Add the 2013.1b3 tarball to tools/pip-requires - this will be changed
to 'oslo-config>=2013.1' when oslo-config is published to pypi. This
will happen in time for grizzly final.

Add dependency_links to setup.py so that oslo-config can be installed
from the tarball URL specified in pip-requires.

Remove the 'deps = pep8==1.3.3' from tox.ini as it means all the other
deps get installed with easy_install which can't install oslo-config
from the URL.

Retain dummy cfg.py file until keystoneclient middleware has been
updated (I18c450174277c8e2d15ed93879da6cd92074c27a).

Change-Id: I4815aeb8a9341a31a250e920157f15ee15cfc5bc
2013-02-19 16:48:02 -08:00
Ollie Leahy
008adb25fd Fix syntax error in cinder-volume-usage-audit
There was a syntax error in a print statement in cinder-volume-usage-audit
which caused the script to crash.

Fixes LP bug #1130266

Change-Id: If4b0102ec5218fc8347f97041ac65f633111c26f
2013-02-19 17:58:35 +00:00
Dan Prince
5f2a36cce7 Update cinder-manage to use FLAGS.log_dir.
We no longer use FLAGS.logdir. This commit updates
cinder-manage to use the new FLAGS.log_dir option instead.

Fixes LP Bug #1130258.

Change-Id: Id5f1175ec83f0f0b677ab0d75b310fa054459319
2013-02-19 12:46:03 -05:00
Michael Basnight
6c708d12f5 Update cinder-volume to enable multi volume support
* Added the service wrapper for multi binscripts
* Added a service_name to manager
* Added the configuration wrapper so the impls do not need
  to know if they are accessing config values from a option
  group or from the DEFAULT group
* Updated drivers to use the new configuration wrapper
* Added an example config set for multi backend
* Modified service to comply w/ common
* Added get_volume_stats to iscsi
* Added config for volume_backend_name

implements blueprint multi-volume-backends

Change-Id: Idb86ac5f1c06b9cd5061bef6a24f17727e9a58c1
2013-02-18 11:19:20 -06:00
Jenkins
f623cdcc82 Merge "Add LIO iSCSI backend support using python-rtslib" 2013-02-16 14:42:41 +00:00
Eric Harney
1fc557561b Add LIO iSCSI backend support using python-rtslib
This patch enables LIO as an iSCSI backend for Cinder, using
python-rtslib.

To enable, set "iscsi_helper = lioadm" in cinder.conf.

This requires python-rtslib 2.1.fb27, which is available from pip.

Implements blueprint lio-iscsi-support
DocImpact

Change-Id: Ifb23de65f26a40997afd6148a1d0be39bcc8d196
2013-02-15 11:20:10 -05:00
Monty Taylor
b390454b6d Update to latest oslo-version code.
In prep for tag-based versioning, update to latest oslo-version code.

Change-Id: Ic5046006919e20247481fa1ddbde2dfd456b188a
2013-02-07 02:29:27 -06:00
Thierry Carrez
4275a23af9 Import Oslo's common rootwrap to Cinder
Import oslo-incubator's rootwrap, which contains all the new
features and bugfixes that were pushed to nova-rootwrap earlier
in this cycle, including logging support and path search.

Implements bp: cinder-common-rootwrap

Change-Id: I68cbb788a3dda58dc146933be190146607b48801
2013-02-04 17:28:38 +01:00
Zhiteng Huang
04b1e3cdce Pull cfg module from Oslo and update cinder-manage accordingly
New cfg module abandons previous disable_interspersed_args() and
recommand to use add_subparsers from argparser module instead.
This patch pull cfg module from Oslo and update the affected
cinder-manage utils.

Change-Id: I8913fafb8fdb19b3fe0a695a70c8b1e8f59c1027
2013-01-31 00:18:37 +08:00
John Griffith
44a2b8949f Revert changes to monkey_patch.
As a work-around to deal with bug 1075838, we modified
monkey_patch in the Cinder binaries.  The root cause of the
issue is/was actually a bug in eventlet but this was a quick
work-around.

Since the change Change-Id: I69ba75136e32e95c6fdf108f0c4fe21a5e3bdbe6
to do this landed, the problem has also been addressed in Keystone.

So, let's revert this patch to get back the greenthread performance
that we may have lost with this change.  For now, everything should
be addressed as long as we don't implement multi api worker in Cinder,
if we do and the evenlet fix hasn't been released we'll need to turn
the modification back on for bin/cinder-api.

Change-Id: Ie845bade85dbceacd91f15e082325602d9a79c74
2012-11-28 12:23:28 -07:00
John Griffith
51418bdd5b Make pep8 checks a bit stricter.
Along with moving to pep8 1.3.3, we also want to standardize
on what we ignore. This patch get's us most of the way there
by setting the ignore list to:
N4,E125, E126, E711,E712.

Almost all changes made here are white-space/indentation changes.

The removal of Hacking N4 errors from the ignore list will
be handled in a seperate patch.

Change-Id: If45f156600485d23769449018590f60b4f69b0c5
2012-11-26 16:57:15 -07:00
Jenkins
69ae5c145f Merge "Various pep8/HACKING fixes for Cinder." 2012-11-15 21:55:26 +00:00
Dan Prince
41c37d3666 Various pep8/HACKING fixes for Cinder.
Fix some ordering/pep8/hacking issues in preperation for re-enabling
full pep8/HACKING checks in tox.

Change-Id: I7151ac73d1ace5d98046580e6d1c6a1dcc6c4cef
2012-11-15 14:11:18 -05:00
Zhongyue Luo
f51e4af121 Remove gen_uuid()
Removed gen_uuid and uuid related unittests
Replaced utils.gen_uuid() with uuid.uuid4()

Change-Id: If34096f47fdea719e2dc180b448654519ede9bc9
2012-11-15 08:04:39 +08:00
Vishvananda Ishaya
4e619fbef8 Fix 401 from auth_token middleware
The openssl popen call to verify the token returns an error code
of 2 when a file doesn't exist. Normally this is caught and the
relevant file is downloaded, but monkeypatching os causes this
error code to be eaten and cinder to return a 401. Note that this
is likely a race condition that depends on exactly when greenthreads
are switching that is causing the return code from Popen to get
overwritten.

It is possible that this is exposing an underlying bug in eventlet
but the workaround is simply to make sure that we don't monkeypatch
os.

Fixes bug 1075838

Change-Id: I69ba75136e32e95c6fdf108f0c4fe21a5e3bdbe6
2012-11-06 20:17:12 -08:00
John Griffith
524c7fa6df Detect and fix issues caused by vol ID migration
The migration from volume ID to UUID neglected to update the provider_location
field on the volume.  As a result the iqn and volume name no long match and
existing volumes are no longer able to be attached after an upgrade
(essex -> folsom and then nova-vol->cinder).

This patch adds a method to the volume driver that will check for the
mismatch of volume name in the iqn during service start up.  If
detected it will update the provider_location field in the database
to include the new ID.  Also it will create a symlink to the device backing
file that also has the correct naming convention.

Note: We don't disturb an connections that are currently attached.
For this case we add a check in manager.detach and do any provider_location
cleanup that's needed at that time.  This ensures that connections
persist on restarts of tgtd and reboot.

Change-Id: I8224824b793c98a9767c5d8dd741d892be720c4f
Fixes: bug 1065702
2012-10-29 16:39:17 -06:00
Eric Harney
b3b1d48d53 Update HACKING.rst and related changes from Nova/PEP8.
Sync up with changes made in Nova, this adds information
about line continuation (PEP8), OpenStack capitalization,
and commit messages.

Change-Id: Id6637307411bcc7a3637ac514c4ec34e26481e0d
2012-10-22 18:41:16 -04:00
Rongze Zhu
f3ecc59364 Change output strings to i18ned
Fixes bug #1069601.

Ensure visible message in cinder-volume-usage-audit got through
translation.

Change-Id: I5c32ce3b2ef2541b8a5520ed53feaf8e00f43c9d
2012-10-22 03:39:04 +00:00
Julien Danjou
186143ecc8 Fix cinder-volume-usage-audit
It seems many point in the internal API and openstack.common changed, but
this binary has been forgotten.

Also, context ie needed when using the notifier, so import it.

This fixes bug #1053502

Change-Id: I306b8671e7b0ed8c2ce2548a51a4c5e6393e13cb
Signed-off-by: Julien Danjou <julien@danjou.info>
2012-09-21 15:17:08 +02:00
Thierry Carrez
730ebab71e Restore SIGPIPE default action for subprocesses
Python ignores SIGPIPE on startup, because it prefers to check every
write and raise an IOError exception rather than taking the signal. Most
Unix subprocesses don't expect to work this way. This patch (adapted
from Colin Watson's post at http://tinyurl.com/2a7mzh5) sets SIGPIPE
back to the default action for cinder.utils.execute and cinder-rootwrap
created subprocesses.

Fixes bug 1053364

Change-Id: I4b3307bd2f0f5d0da529d8b7d80fabae28c57732
2012-09-20 15:26:28 +02:00
John Griffith
321d32379c Add nova migrate_version check to cinder import
Cinder-manage migrate import only works from Nova/Folsom--->Cinder/Folsom
this change adds an explicit check of the nova migrate_version (133)
to make sure we have all of the volume id/uuid changes that are needed
to be compatable, and presents an error message if that's not the case.

Addresses bug #1052598

Change-Id: I7f32cf35e33320f4348b7bc44a8e92b5716b71d8
2012-09-19 09:11:25 -06:00
Rongze Zhu
3e9b64c09e Typo nova => cinder
Change-Id: I715feee8ca84fb65518e750585f82e942e710ecd
2012-09-07 14:25:27 +08:00
Dan Prince
b60c3909ce Several hacking compliance fixes.
Updates bin/nova-manage and the solidfire driver with several
hacking compliance fixes.

Makes it so run_tests.sh -p runs clean again.

Change-Id: Iee675cae06acda6a585a77073e773651aab9d5a1
2012-09-03 22:17:06 -04:00
Dan Prince
560b650fa8 Add cinder- prefix to all binaries.
Renames clear_rabbit_queues and volume-usuage-audit binaries
so that they are prefixed with 'cinder-'.

As part of this change the clear_rabbit_queues binary was changed
to use dashes instead of underscores for consistency with the rest
of the cinder binaries.

Fixes LP Bug #1044386.

Change-Id: I7692a543cc67af2d342a64b84626de38c0a64f81
2012-08-31 09:56:50 -04:00
John Griffith
ca25ea4778 Migrate volume related quota info in db migration
* Fixes bug 1039615
  * Now that quotas are back we need to handle migration
    of volume related quota data in the cinder-manage migrate helper
  * Only resource types transferred are volumes and gigabytes

Change-Id: Idd9aab834612e929683491f47fa1e1861bdbd0d1
2012-08-21 14:05:15 -06:00
Jenkins
f276d01946 Merge "Implements bp migrate-nova-volumes-to-cinder" 2012-08-16 04:48:41 +00:00
Craig Vyvial
6ad360741f Adding the volume notifications to cinder
adding the volume notifications
added unit tests for notifications
added context for notify with rabbit

blueprint cinder-notifications

Change-Id: I5aef1e718eebb9a61e0670d524fcd5f438dee016
2012-08-15 17:21:53 -05:00
John Griffith
11545df5cb Implements bp migrate-nova-volumes-to-cinder
Helper cmds to transition from nova to cinder

  Implements an import section in cinder-manage to transfer
  applicable tables from local or remote Nova database into a
  fresh Cinder database.

  Also implements optional method to copy persistent target files.

Change-Id: I2e655e26c55f1986f3b1554726cead9e73ee9bd6
2012-08-14 16:33:00 -06:00
Thierry Carrez
2b2c97eb5c Deprecate root_helper in favor of rootwrap_config
Align with recent changes in nova-rootwrap by marking the
root_helper option deprecated and introduce usage of the
rootwrap_config option instead. The root_helper option will still
fully be supported in Folsom, but will be removed in Grizzly.

Transition notes: you should replace:
root_helper=sudo cinder-rootwrap /etc/cinder/rootwrap.conf

by:
rootwrap_config=/etc/cinder/rootwrap.conf

Change-Id: I22a6d2bdee6ad2c5ad587ceec574cec4b2887f22
2012-08-03 15:35:03 +02:00
Thierry Carrez
d2d3c9cba4 Port nova-rootwrap changes to cinder-rootwrap
Port recent nova-rootwrap changes to cinder-rootwrap, including:
* Move filter definition from Python module to configuration files
* Fix tests execution on Fedora (bug 1027814)
* Remove executable bit on cinder/rootwrap files

This certainly needs a matching change to devstack to pass gating.

Change-Id: I963bc7890ba285ae515ea61bbd960bd2523f9061
2012-07-23 16:23:55 +02:00
Mike Perez
9a5e830c24 utils module is still being used by cinder-volume service
bug 1026949

Change-Id: I7327d94b5a9f35bc74e179a05976d511c6642a7a
2012-07-20 09:00:51 -07:00
Chmouel Boudjnah
fe716c0ee4 Use openstack.common.log for logging.
- We are not using openstack.common.notifier just yet so handedit
  openstack.common.log to use cinder.notifier now.

Change-Id: I9d912904c53a8ef5d90b4ab5792f5577701b6817
2012-07-20 12:12:12 +00:00
Jenkins
05b661e967 Merge "Remove unused enabled_apis flag" 2012-07-19 16:52:28 +00:00