Skip to content

Commit

Permalink
Set vg_thin_pool to pool name instead of pool_path
Browse files Browse the repository at this point in the history
create_thin_pool is setting vg_thin_pool to the pool path instead of the
pool_name. This makes volumes creation fail when the create_thin_pool
method is called. This happens because create_volume builds the pool
path itself as create_thin_pool does.

Keeping the pool name in vg_thin_pool instead of the path makes more
sense and allows it to be used in other places in the brick. Also, most
commands return both vg_name and pool_name separated.

Change-Id: Ibf5cd746fc050eab5ce6aff13dd70c1e8066b228
Closes-Bug: #1220286
  • Loading branch information
flaper87 committed Sep 3, 2013
1 parent 59df774 commit 29e889b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cinder/brick/local_dev/lvm.py
Expand Up @@ -337,7 +337,7 @@ def create_thin_pool(self, name=None, size_str=0):
self._execute(*cmd,
root_helper=self._root_helper,
run_as_root=True)
self.vg_thin_pool = pool_path
self.vg_thin_pool = name

def create_volume(self, name, size_str, lv_type='default', mirror_count=0):
"""Creates a logical volume on the object's VG.
Expand Down
19 changes: 19 additions & 0 deletions cinder/tests/brick/test_brick_lvm.py
Expand Up @@ -144,6 +144,25 @@ def test_thin_support(self):
self.stubs.Set(processutils, 'execute', self.fake_old_lvm_version)
self.assertFalse(self.vg.supports_thin_provisioning('sudo'))

def test_volume_create_after_thin_creation(self):
"""Test self.vg.vg_thin_pool is set to pool_name
See bug #1220286 for more info.
"""

vg_name = "vg-name"
pool_name = vg_name + "-pool"
pool_path = "%s/%s" % (vg_name, pool_name)

def executor(obj, *cmd, **kwargs):
self.assertEqual(pool_path, cmd[-1])

self.vg._executor = executor
self.vg.create_thin_pool(pool_name, "1G")
self.vg.create_volume("test", "1G", lv_type='thin')

self.assertEqual(self.vg.vg_thin_pool, pool_name)

def test_lv_has_snapshot(self):
self.assertTrue(self.vg.lv_has_snapshot('fake-volumes'))
self.assertFalse(self.vg.lv_has_snapshot('test-volumes'))

0 comments on commit 29e889b

Please sign in to comment.