From 7da2dff16f2273de9d9d257568b7c7921de695cb Mon Sep 17 00:00:00 2001 From: Tom Swanson Date: Fri, 27 Feb 2015 11:25:38 -0600 Subject: [PATCH] Dell Storage Center Driver API bug In later versions of the Dell Storage Center REST API the index attribute is removed from the ScVolume object. Referencing this caused an exception that failed volume creation. Replaced with instanceId. Also _init_volume was mapping/unmapping to every server that was currently up on the Storage Center rather than a single server. While this would certainly initialize the volume it would create a lot of extra work on a busy system. We now break after the first map/unmap. Changed copyright to 2015 to match when it will actually be released. Change-Id: I89f3967144d7effbb67d1498fc3b4a7a23042a59 Closes-Bug: 1426463 --- .../drivers/dell/dell_storagecenter_api.py | 18 +++++++++++++----- .../drivers/dell/dell_storagecenter_common.py | 2 +- .../drivers/dell/dell_storagecenter_fc.py | 2 +- .../drivers/dell/dell_storagecenter_iscsi.py | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cinder/volume/drivers/dell/dell_storagecenter_api.py b/cinder/volume/drivers/dell/dell_storagecenter_api.py index 069c21570..38fb26cca 100644 --- a/cinder/volume/drivers/dell/dell_storagecenter_api.py +++ b/cinder/volume/drivers/dell/dell_storagecenter_api.py @@ -1,4 +1,4 @@ -# Copyright 2014 Dell Inc. +# Copyright 2015 Dell 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 @@ -364,6 +364,7 @@ class StorageCenterApi(object): scserver) self.unmap_volume(scvolume, scserver) + break def create_volume(self, name, size, ssn, volfolder): '''This creates a new volume on the storage center. It @@ -407,10 +408,17 @@ class StorageCenterApi(object): {'name': name, 'c': r.status_code, 'r': r.reason}) - if scvolume is not None: - LOG.info(_LI('Created volume %(index)d: %(name)s'), - {'index': scvolume['index'], + if scvolume: + LOG.info(_LI('Created volume %(instanceId)s: %(name)s'), + {'instanceId': scvolume['instanceId'], 'name': scvolume['name']}) + else: + LOG.error(_LE('ScVolume returned success with empty payload.' + ' Attempting to locate volume')) + # In theory it is there since success was returned. + # Try one last time to find it before returning. + scvolume = self.find_volume(ssn, name, None) + return scvolume def find_volume(self, ssn, name=None, instanceid=None): @@ -1079,7 +1087,7 @@ class StorageCenterApi(object): 'r': r.reason}) if vol is not None: LOG.debug('Volume expanded: %(i)s %(s)s', - {'i': vol['index'], + {'i': vol['instanceId'], 's': vol['configuredSize']}) return vol diff --git a/cinder/volume/drivers/dell/dell_storagecenter_common.py b/cinder/volume/drivers/dell/dell_storagecenter_common.py index 02c13a3ba..536d4608a 100644 --- a/cinder/volume/drivers/dell/dell_storagecenter_common.py +++ b/cinder/volume/drivers/dell/dell_storagecenter_common.py @@ -1,4 +1,4 @@ -# Copyright 2014 Dell Inc. +# Copyright 2015 Dell 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 diff --git a/cinder/volume/drivers/dell/dell_storagecenter_fc.py b/cinder/volume/drivers/dell/dell_storagecenter_fc.py index bf4d511ce..d85a0d259 100644 --- a/cinder/volume/drivers/dell/dell_storagecenter_fc.py +++ b/cinder/volume/drivers/dell/dell_storagecenter_fc.py @@ -1,4 +1,4 @@ -# Copyright 2014 Dell Inc. +# Copyright 2015 Dell 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 diff --git a/cinder/volume/drivers/dell/dell_storagecenter_iscsi.py b/cinder/volume/drivers/dell/dell_storagecenter_iscsi.py index 3561ffaf0..0f5329516 100644 --- a/cinder/volume/drivers/dell/dell_storagecenter_iscsi.py +++ b/cinder/volume/drivers/dell/dell_storagecenter_iscsi.py @@ -1,4 +1,4 @@ -# Copyright 2014 Dell Inc. +# Copyright 2015 Dell 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 -- 2.45.2