From f7ca79ae1d02bc9babf8611164d3709374f66eec Mon Sep 17 00:00:00 2001
From: "Jacob M. Jacob" <jacob_jacob@dell.com>
Date: Wed, 13 Nov 2013 18:02:37 -0600
Subject: [PATCH] Adds extend volume to Dell EqualLogic Driver

Adds extend_volume support to the Dell EqualLogic Driver

Change-Id: I416c73248f1813a805dcca4d70ad6cbc91d78f7d
Implements: blueprint eql-extend-vol-support
---
 cinder/tests/test_eqlx.py     | 10 ++++++++++
 cinder/volume/drivers/eqlx.py | 13 +++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/cinder/tests/test_eqlx.py b/cinder/tests/test_eqlx.py
index f85b89a95..433989374 100644
--- a/cinder/tests/test_eqlx.py
+++ b/cinder/tests/test_eqlx.py
@@ -168,6 +168,16 @@ class DellEQLSanISCSIDriverTestCase(test.TestCase):
         self.mox.ReplayAll()
         self.driver.delete_snapshot(snapshot)
 
+    def test_extend_volume(self):
+        new_size = '200'
+        self.driver._eql_execute = self.mox.\
+            CreateMock(self.driver._eql_execute)
+        volume = {'name': self.volume_name, 'size': 100}
+        self.driver._eql_execute('volume', 'select', volume['name'],
+                                 'size', "%sG" % new_size)
+        self.mox.ReplayAll()
+        self.driver.extend_volume(volume, new_size)
+
     def test_initialize_connection(self):
         self.driver._eql_execute = self.mox.\
             CreateMock(self.driver._eql_execute)
diff --git a/cinder/volume/drivers/eqlx.py b/cinder/volume/drivers/eqlx.py
index 74d952c5b..92cdef642 100644
--- a/cinder/volume/drivers/eqlx.py
+++ b/cinder/volume/drivers/eqlx.py
@@ -449,5 +449,18 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
         """
         pass
 
+    def extend_volume(self, volume, new_size):
+        """Extend the size of the volume"""
+        try:
+            self._eql_execute('volume', 'select', volume['name'],
+                              'size', "%sG" % new_size)
+        except Exception:
+            with excutils.save_and_reraise_exception():
+                LOG.error(_('Failed to extend_volume %(name)s from '
+                            '%(current_size)sGB to %(new_size)sGB'),
+                          {'name': volume['name'],
+                           'current_size': volume['size'],
+                           'new_size': new_size})
+
     def local_path(self, volume):
         raise NotImplementedError()
-- 
2.45.2