]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add extend to reference LVM driver
authorJohn Griffith <john.griffith@solidfire.com>
Fri, 20 Sep 2013 21:30:36 +0000 (21:30 +0000)
committerJohn Griffith <john.griffith@solidfire.com>
Fri, 20 Sep 2013 21:32:07 +0000 (21:32 +0000)
Somwhere along the way we somehow dropped
or missed implementing the extend functionality
in the reference LVM driver.

Add it.

Change-Id: Ib3efe16252b5efacce253688767df426117b2a44
Closes-Bug: #1228358

cinder/brick/local_dev/lvm.py
cinder/volume/drivers/lvm.py
etc/cinder/rootwrap.d/volume.filters

index bee80ba20583f600d96dee378c865d059b45ff8b..fa7548c23fc301d6cba18b451a0dc009a947ecc0 100644 (file)
@@ -434,3 +434,18 @@ class LVM(executor.Executor):
             if (out[0] == 'o') or (out[0] == 'O'):
                 return True
         return False
+
+    def extend_volume(self, lv_name, new_size):
+        """Extend the size of an existing volume."""
+
+        try:
+            self._execute('lvextend', '-L', new_size,
+                          '%s/%s' % (self.vg_name, lv_name),
+                          root_helper=self._root_helper,
+                          run_as_root=True)
+        except putils.ProcessExecutionError as err:
+            LOG.exception(_('Error extending Volume'))
+            LOG.error(_('Cmd     :%s') % err.cmd)
+            LOG.error(_('StdOut  :%s') % err.stdout)
+            LOG.error(_('StdErr  :%s') % err.stderr)
+            raise
index fc3b10ccbca28ed1bd922b973e01eac4445a1f94..afd460272cbefddb1cba9d9a65cef5afef89e01c 100644 (file)
@@ -371,6 +371,10 @@ class LVMVolumeDriver(driver.VolumeDriver):
 
         self._stats = data
 
+    def extend_volume(self, volume, new_size):
+        """Extend an existing voumes size."""
+        self.vg.extend_volume(volume['name'], new_size)
+
 
 class LVMISCSIDriver(LVMVolumeDriver, driver.ISCSIDriver):
     """Executes commands relating to ISCSI volumes.
index 99f75ed6c5d945cc8d7271aa5e5fb20f3129a69d..aa533269d3f7d513a2663e6d39953221327292bf 100644 (file)
@@ -27,6 +27,9 @@ lvdisplay: CommandFilter, lvdisplay, root
 # cinder/volume/driver.py: 'lvrename', '%(vg)s', '%(orig)s' '(new)s'...
 lvrename: CommandFilter, lvrename, root
 
+# cinder/volume/driver.py: 'lvextend', '-L' '%(new_size)s', '%(lv_name)s' ...
+lvextend: CommandFilter, lvextend, root
+
 # cinder/volume/driver.py: 'iscsiadm', '-m', 'discovery', '-t',...
 # cinder/volume/driver.py: 'iscsiadm', '-m', 'node', '-T', ...
 iscsiadm: CommandFilter, iscsiadm, root
@@ -61,7 +64,7 @@ find: CommandFilter, find, root
 # cinder/volume/drivers/glusterfs.py
 mv: CommandFilter, mv, root
 
-# cinder/volumes/drivers/hds/hds.py: 
+# cinder/volumes/drivers/hds/hds.py:
 hus-cmd: CommandFilter, hus-cmd, root
 
 # cinder/brick/initiator/connector.py: