From: wanghongxu Date: Thu, 27 Aug 2020 07:11:28 +0000 (+0800) Subject: ceph-volume: fix journal size argument not work X-Git-Tag: v16.1.0~1238^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a7077dc661478a762a86b88452c98b30717c0b3c;p=ceph.git ceph-volume: fix journal size argument not work Journal size argument not work in batch prepare filestore with SSD journal device. Fixes: https://tracker.ceph.com/issues/41374 Signed-off-by: wanghongxu --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py b/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py index bc10473eee9d..bc4eaba4613f 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py @@ -351,8 +351,6 @@ class MixedType(MixedStrategy): else: journal_vg = self.common_vg - journal_size = prepare.get_journal_size(lv_format=False) - # create 1 vg per data device first, mapping them to the device path, # when the lv gets created later, it can create as many as needed (or # even just 1) @@ -371,7 +369,7 @@ class MixedType(MixedStrategy): 'osd-data', data_uuid, vg=data_vg, extents=data_lv_extents) journal_uuid = system.generate_uuid() journal_lv = lvm.create_lv( - 'osd-journal', journal_uuid, vg=journal_vg, size=journal_size) + 'osd-journal', journal_uuid, vg=journal_vg, size=self.journal_size) command = ['--filestore', '--data'] command.append('%s/%s' % (data_vg.name, data_lv.name)) diff --git a/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py b/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py index 844518a44363..d4565ef4dcb5 100644 --- a/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py +++ b/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py @@ -1,5 +1,6 @@ import argparse import pytest +import os from ceph_volume import exceptions from ceph_volume.util import arg_validators @@ -9,7 +10,8 @@ class TestOSDPath(object): def setup(self): self.validator = arg_validators.OSDPath() - def test_is_not_root(self): + def test_is_not_root(self, monkeypatch): + monkeypatch.setattr(os, 'getuid', lambda: 100) with pytest.raises(exceptions.SuperUserError): self.validator('')