From e5886ce03c9f0f9f056fbeb7017eafd43a21e13c Mon Sep 17 00:00:00 2001 From: wanghongxu Date: Thu, 27 Aug 2020 15:11:28 +0800 Subject: [PATCH] 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 (cherry picked from commit a7077dc661478a762a86b88452c98b30717c0b3c) --- .../ceph_volume/devices/lvm/strategies/filestore.py | 4 +--- src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) 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 bc10473eee9d9..bc4eaba4613f7 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 844518a443639..d4565ef4dcb5c 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('') -- 2.39.5