-# Copyright 2013 SolidFire Inc
# All Rights Reserved.
+# Copyright 2013 SolidFire Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
import socket
import string
import time
+import warnings
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import units
import requests
from requests.packages.urllib3 import exceptions
-import warnings
-
import six
from cinder import context
def _build_endpoint_info(self, **kwargs):
endpoint = {}
- endpoint['mvip'] =\
- kwargs.get('mvip', self.configuration.san_ip)
- endpoint['login'] =\
- kwargs.get('login', self.configuration.san_login)
- endpoint['passwd'] =\
- kwargs.get('passwd', self.configuration.san_password)
- endpoint['port'] =\
- kwargs.get('port', self.configuration.sf_api_port)
+ endpoint['mvip'] = (
+ kwargs.get('mvip', self.configuration.san_ip))
+ endpoint['login'] = (
+ kwargs.get('login', self.configuration.san_login))
+ endpoint['passwd'] = (
+ kwargs.get('passwd', self.configuration.san_password))
+ endpoint['port'] = (
+ kwargs.get('port', self.configuration.sf_api_port))
endpoint['url'] = 'https://%s:%s' % (endpoint['mvip'],
endpoint['port'])
def _do_clone_volume(self, src_uuid,
src_project_id,
vref):
- """Create a clone of an existing volume or snapshot. """
+ """Create a clone of an existing volume or snapshot."""
attributes = {}
qos = {}
# the optional properties.virtual_size is set on the image
# before we get here
virt_size = int(image_meta['properties'].get('virtual_size'))
- min_sz_in_bytes =\
- math.ceil(virt_size / float(units.Gi)) * float(units.Gi)
+ min_sz_in_bytes = (
+ math.ceil(virt_size / float(units.Gi)) * float(units.Gi))
min_sz_in_gig = math.ceil(min_sz_in_bytes / float(units.Gi))
attributes = {}
attributes['image_info'] = {}
- attributes['image_info']['image_updated_at'] =\
- image_meta['updated_at'].isoformat()
- attributes['image_info']['image_name'] =\
- image_meta['name']
- attributes['image_info']['image_created_at'] =\
- image_meta['created_at'].isoformat()
+ attributes['image_info']['image_updated_at'] = (
+ image_meta['updated_at'].isoformat())
+ attributes['image_info']['image_name'] = (
+ image_meta['name'])
+ attributes['image_info']['image_created_at'] = (
+ image_meta['created_at'].isoformat())
attributes['image_info']['image_id'] = image_meta['id']
params = {'name': 'OpenStackIMG-%s' % image_id,
'accountID': self.template_account_id,
return
# Check updated_at field, delete copy and update if needed
- if sf_vol['attributes']['image_info']['image_updated_at'] ==\
- image_meta['updated_at'].isoformat():
+ if sf_vol['attributes']['image_info']['image_updated_at'] == (
+ image_meta['updated_at'].isoformat()):
return
else:
# Bummer, it's been updated, delete it
LOG.error(_LE('Failed to get updated stats'))
results = results['result']['clusterCapacity']
- free_capacity =\
- results['maxProvisionedSpace'] - results['usedSpace']
+ free_capacity = (
+ results['maxProvisionedSpace'] - results['usedSpace'])
data = {}
backend_name = self.configuration.safe_get('volume_backend_name')
data["driver_version"] = self.VERSION
data["storage_protocol"] = 'iSCSI'
- data['total_capacity_gb'] =\
- float(results['maxProvisionedSpace'] / units.Gi)
+ data['total_capacity_gb'] = (
+ float(results['maxProvisionedSpace'] / units.Gi))
data['free_capacity_gb'] = float(free_capacity / units.Gi)
data['reserved_percentage'] = self.configuration.reserved_percentage
data['QoS_support'] = True
- data['compression_percent'] =\
- results['compressionPercent']
- data['deduplicaton_percent'] =\
- results['deDuplicationPercent']
- data['thin_provision_percent'] =\
- results['thinProvisioningPercent']
+ data['compression_percent'] = (
+ results['compressionPercent'])
+ data['deduplicaton_percent'] = (
+ results['deDuplicationPercent'])
+ data['thin_provision_percent'] = (
+ results['thinProvisioningPercent'])
self.cluster_stats = data
def attach_volume(self, context, volume,