Skip to content

Commit f55f5da

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Remove VFSLocalFS"
2 parents 2dc26ed + 4b32f9c commit f55f5da

File tree

6 files changed

+0
-439
lines changed

6 files changed

+0
-439
lines changed

nova/privsep/fs.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,6 @@ def remove_device_maps(device):
129129
return processutils.execute('kpartx', '-d', device)
130130

131131

132-
@nova.privsep.sys_admin_pctxt.entrypoint
133-
def get_filesystem_type(device):
134-
return processutils.execute('blkid', '-o', 'value', '-s', 'TYPE', device,
135-
check_exit_code=[0, 2])
136-
137-
138132
@nova.privsep.sys_admin_pctxt.entrypoint
139133
def e2fsck(image, flags='-fp'):
140134
unprivileged_e2fsck(image, flags=flags)

nova/privsep/path.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@
2525
import nova.privsep
2626

2727

28-
@nova.privsep.sys_admin_pctxt.entrypoint
29-
def readfile(path):
30-
if not os.path.exists(path):
31-
raise exception.FileNotFound(file_path=path)
32-
with open(path, 'r') as f:
33-
return f.read()
34-
35-
3628
@nova.privsep.sys_admin_pctxt.entrypoint
3729
def writefile(path, mode, content):
3830
if not os.path.exists(os.path.dirname(path)):
@@ -41,13 +33,6 @@ def writefile(path, mode, content):
4133
f.write(content)
4234

4335

44-
@nova.privsep.sys_admin_pctxt.entrypoint
45-
def readlink(path):
46-
if not os.path.exists(path):
47-
raise exception.FileNotFound(file_path=path)
48-
return os.readlink(path)
49-
50-
5136
@nova.privsep.sys_admin_pctxt.entrypoint
5237
def chown(
5338
path: str, uid: int = -1, gid: int = -1, recursive: bool = False,
@@ -102,13 +87,6 @@ def rmdir(path):
10287
os.rmdir(path)
10388

10489

105-
class path(object):
106-
@staticmethod
107-
@nova.privsep.sys_admin_pctxt.entrypoint
108-
def exists(path):
109-
return os.path.exists(path)
110-
111-
11290
@nova.privsep.sys_admin_pctxt.entrypoint
11391
def last_bytes(path, num):
11492
"""Return num bytes from the end of the file, and remaining byte count.

nova/tests/unit/privsep/test_fs.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,6 @@ def test_remove_device_maps(self, mock_execute):
142142
nova.privsep.fs.remove_device_maps('/dev/nosuch')
143143
mock_execute.assert_called_with('kpartx', '-d', '/dev/nosuch')
144144

145-
@mock.patch('oslo_concurrency.processutils.execute')
146-
def test_get_filesystem_type(self, mock_execute):
147-
nova.privsep.fs.get_filesystem_type('/dev/nosuch')
148-
mock_execute.assert_called_with('blkid', '-o', 'value', '-s',
149-
'TYPE', '/dev/nosuch',
150-
check_exit_code=[0, 2])
151-
152145
@mock.patch('oslo_concurrency.processutils.execute')
153146
def test_privileged_e2fsck(self, mock_execute):
154147
nova.privsep.fs.e2fsck('/path/nosuch')

nova/tests/unit/privsep/test_path.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,6 @@ def setUp(self):
3131
super(FileTestCase, self).setUp()
3232
self.useFixture(fixtures.PrivsepFixture())
3333

34-
@mock.patch('os.path.exists', return_value=True)
35-
def test_readfile(self, mock_exists):
36-
mock_open = mock.mock_open(read_data='hello world')
37-
with mock.patch('builtins.open', new=mock_open):
38-
self.assertEqual('hello world',
39-
nova.privsep.path.readfile('/fake/path'))
40-
41-
@mock.patch('os.path.exists', return_value=False)
42-
def test_readfile_file_not_found(self, mock_exists):
43-
self.assertRaises(exception.FileNotFound,
44-
nova.privsep.path.readfile,
45-
'/fake/path')
46-
4734
@mock.patch('os.path.exists', return_value=True)
4835
def test_write(self, mock_exists):
4936
mock_open = mock.mock_open()
@@ -62,19 +49,6 @@ def test_write_dir_missing(self, mock_exists):
6249
nova.privsep.path.writefile,
6350
'/fake/path', 'w', 'foo')
6451

65-
@mock.patch('os.path.exists', return_value=True)
66-
@mock.patch('os.readlink')
67-
def test_readlink(self, mock_readlink, mock_exists):
68-
nova.privsep.path.readlink('/fake/path')
69-
mock_exists.assert_called_with('/fake/path')
70-
mock_readlink.assert_called_with('/fake/path')
71-
72-
@mock.patch('os.path.exists', return_value=False)
73-
def test_readlink_file_not_found(self, mock_exists):
74-
self.assertRaises(exception.FileNotFound,
75-
nova.privsep.path.readlink,
76-
'/fake/path')
77-
7852
@mock.patch('os.path.exists', return_value=True)
7953
@mock.patch('os.chown')
8054
def test_chown(self, mock_chown, mock_exists):
@@ -162,11 +136,6 @@ def test_rmdir_file_not_found(self, mock_exists):
162136
nova.privsep.path.rmdir,
163137
'/fake/path')
164138

165-
@mock.patch('os.path.exists', return_value=True)
166-
def test_exists(self, mock_exists):
167-
nova.privsep.path.path.exists('/fake/path')
168-
mock_exists.assert_called_with('/fake/path')
169-
170139

171140
class LastBytesTestCase(test.NoDBTestCase):
172141
"""Test the last_bytes() utility method."""

nova/tests/unit/virt/disk/vfs/test_localfs.py

Lines changed: 0 additions & 226 deletions
This file was deleted.

0 commit comments

Comments
 (0)