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
Increased unit test code coverage

Added unit tests to increase the code coverage of the HP
3PAR Fibre Channel and iSCSI drivers.

Change-Id: I0176a56ca080429a600b24200987d276e73407ba
solidfire: Add ability to override account prefix

The SolidFire account is created with a prefix based on the hostname
of the host running cinder-volume. This prevents cinder-volume from
being run in an active/active setup.

This patch introduces a new configuration option sf_account_prefix
to override the prefix used when a SolidFire account is created.

If sf_account_prefix is empty, no prefix will be added to
the SolidFire account name when created.

The default value is still the hostname.

Change-Id: I3b974789ea3e749cc8696b69754023ad76155179
Fixes: bug #1179671
Merge "Remove gettext.install() from cinder/__init__.py"
Merge "Increased unit test code coverage"
Merge "solidfire: Add ability to override account prefix"