Merge "Force disk wipe when running lvcreate" into stable/wallaby

This commit is contained in:
Zuul 2022-08-16 19:24:39 +00:00 committed by Gerrit Code Review
commit 1d0cb70510
2 changed files with 7 additions and 8 deletions

View File

@ -82,7 +82,7 @@ class LVMMixin(driver.ExecuteMixin):
def _allocate_container(self, share):
sizestr = '%sG' % share['size']
cmd = ['lvcreate', '-L', sizestr, '-n', share['name'],
cmd = ['lvcreate', '-Wy', '--yes', '-L', sizestr, '-n', share['name'],
self.configuration.lvm_share_volume_group]
if self.configuration.lvm_share_mirrors:
cmd += ['-m', self.configuration.lvm_share_mirrors, '--nosync']
@ -121,8 +121,8 @@ class LVMMixin(driver.ExecuteMixin):
orig_lv_name = "%s/%s" % (self.configuration.lvm_share_volume_group,
snapshot['share_name'])
self._try_execute(
'lvcreate', '-L', '%sG' % snapshot['share']['size'],
'--name', snapshot['name'],
'lvcreate', '-L',
'%sG' % snapshot['share']['size'], '--name', snapshot['name'],
'--snapshot', orig_lv_name, run_as_root=True)
self._set_random_uuid_to_device(snapshot)

View File

@ -182,7 +182,7 @@ class LVMShareDriverTestCase(test.TestCase):
self._driver._mount_device.assert_called_with(
self.share, '/dev/mapper/fakevg-fakename')
expected_exec = [
'lvcreate -L 1G -n fakename fakevg',
'lvcreate -Wy --yes -L 1G -n fakename fakevg',
'mkfs.ext4 /dev/mapper/fakevg-fakename',
]
self.assertEqual(expected_exec, fake_utils.fake_execute_get_log())
@ -206,7 +206,7 @@ class LVMShareDriverTestCase(test.TestCase):
self._driver._mount_device.assert_called_with(self.share,
mount_snapshot)
expected_exec = [
'lvcreate -L 1G -n fakename fakevg',
'lvcreate -Wy --yes -L 1G -n fakename fakevg',
'mkfs.ext4 /dev/mapper/fakevg-fakename',
'e2fsck -y -f %s' % mount_share,
'tune2fs -U random %s' % mount_share,
@ -228,9 +228,8 @@ class LVMShareDriverTestCase(test.TestCase):
self._driver._mount_device.assert_called_with(
share, '/dev/mapper/fakevg-fakename')
expected_exec = [
'lvcreate -L 2048G -n fakename fakevg -m 2 --nosync -R 2',
'mkfs.ext4 /dev/mapper/fakevg-fakename',
]
'lvcreate -Wy --yes -L 2048G -n fakename fakevg -m 2 --nosync'
' -R 2', 'mkfs.ext4 /dev/mapper/fakevg-fakename']
self.assertEqual(expected_exec, fake_utils.fake_execute_get_log())
self.assertEqual(self._helper_nfs.create_exports.return_value, ret)