Skip to content

Commit

Permalink
Fix pep8 and pylint violation in Nexenta volume driver
Browse files Browse the repository at this point in the history
Change-Id: Iec7f37ddd0f3850cb84e1cafe223b8f503a3629c
  • Loading branch information
vitoordaz committed Aug 2, 2013
1 parent 5166842 commit 928e11a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.testrepository
.tox
.venv
.idea
AUTHORS
Authors
build/*
Expand All @@ -29,4 +30,4 @@ tools/pylint_exceptions
tags
# Files created by Sphinx build
doc/build
.autogenerated
.autogenerated
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
23 changes: 12 additions & 11 deletions cinder/volume/drivers/nexenta/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@

from cinder import exception
from cinder.openstack.common import log as logging
from cinder import units
from cinder.volume import driver
from cinder.volume.drivers import nexenta
from cinder.volume.drivers.nexenta import jsonrpc

VERSION = '1.0'
LOG = logging.getLogger(__name__)

nexenta_opts = [
NEXENTA_OPTS = [
cfg.StrOpt('nexenta_host',
default='',
help='IP address of Nexenta SA'),
Expand Down Expand Up @@ -71,14 +72,17 @@
]

CONF = cfg.CONF
CONF.register_opts(nexenta_opts)
CONF.register_opts(NEXENTA_OPTS)


class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921
"""Executes volume driver commands on Nexenta Appliance."""

def __init__(self, *args, **kwargs):
super(NexentaDriver, self).__init__(*args, **kwargs)
self.nms = None
if self.configuration:
self.configuration.append_config_values(NEXENTA_OPTS)

def do_setup(self, context):
protocol = CONF.nexenta_rest_protocol
Expand Down Expand Up @@ -300,9 +304,6 @@ def _update_volume_stats(self):
# info he had regarding Nexenta Capabilities, ideally it would
# be great if somebody from Nexenta looked this over at some point

KB = 1024
MB = KB ** 2

LOG.debug(_("Updating volume stats"))
data = {}
backend_name = self.__class__.__name__
Expand All @@ -321,18 +322,18 @@ def _update_volume_stats(self):
free_amount = float(stats['available'][:-1])

if total_unit == "T":
total_amount = total_amount * KB
total_amount *= units.KiB
elif total_unit == "M":
total_amount = total_amount / KB
total_amount /= units.KiB
elif total_unit == "B":
total_amount = total_amount / MB
total_amount /= units.MiB

if free_unit == "T":
free_amount = free_amount * KB
free_amount *= units.KiB
elif free_unit == "M":
free_amount = free_amount / KB
free_amount /= units.KiB
elif free_unit == "B":
free_amount = free_amount / MB
free_amount /= units.MiB

data['total_capacity_gb'] = total_amount
data['free_capacity_gb'] = free_amount
Expand Down

0 comments on commit 928e11a

Please sign in to comment.