Coverage for manila/privsep/filesystem.py: 73%

11 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2026-02-18 22:19 +0000

1# Copyright 2021 Red Hat, Inc 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); you may 

4# not use this file except in compliance with the License. You may obtain 

5# a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

12# License for the specific language governing permissions and limitations 

13# under the License. 

14 

15""" 

16Helpers for filesystem commands 

17""" 

18 

19from oslo_concurrency import processutils 

20 

21import manila.privsep 

22 

23 

24@manila.privsep.sys_admin_pctxt.entrypoint 

25def e2fsck(device_path): 

26 return processutils.execute('e2fsck', '-y', '-f', device_path) 

27 

28 

29@manila.privsep.sys_admin_pctxt.entrypoint 

30def tune2fs(device_path): 

31 return processutils.execute('tune2fs', '-U', 'random', device_path) 

32 

33 

34@manila.privsep.sys_admin_pctxt.entrypoint 

35def make_filesystem(ext_version, device_name): 

36 return processutils.execute(f'mkfs.{ext_version}', device_name)