Skip to content

Commit

Permalink
Add extend to reference LVM driver
Browse files Browse the repository at this point in the history
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
  • Loading branch information
j-griffith committed Sep 20, 2013
1 parent 93fb1ac commit 966a514
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
15 changes: 15 additions & 0 deletions cinder/brick/local_dev/lvm.py
Expand Up @@ -434,3 +434,18 @@ def lv_has_snapshot(self, name):
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
4 changes: 4 additions & 0 deletions cinder/volume/drivers/lvm.py
Expand Up @@ -371,6 +371,10 @@ def _update_volume_stats(self):

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.
Expand Down
5 changes: 4 additions & 1 deletion etc/cinder/rootwrap.d/volume.filters
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 966a514

Please sign in to comment.