Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediaserver
envsetup
Commits
9174de2e
Commit
9174de2e
authored
4 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Check for ACL mount param | refs
#32387
parent
b7802545
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_partitions.py
+13
-2
13 additions, 2 deletions
tests/test_partitions.py
with
13 additions
and
2 deletions
tests/test_partitions.py
+
13
−
2
View file @
9174de2e
...
@@ -81,6 +81,7 @@ def get_memory_gbytes():
...
@@ -81,6 +81,7 @@ def get_memory_gbytes():
def
get_path_fs
(
path
):
def
get_path_fs
(
path
):
# Example of "df" output:
# Filesystem Type 1B-blocks Used Available
# Filesystem Type 1B-blocks Used Available
# /dev/loop2 ext4 52710469632 38253940736 11755397120
# /dev/loop2 ext4 52710469632 38253940736 11755397120
status
,
output
=
subprocess
.
getstatusoutput
(
'
df --output=
"
source,fstype,size,avail
"
-B 1 %s | tail -n 1
'
%
path
)
status
,
output
=
subprocess
.
getstatusoutput
(
'
df --output=
"
source,fstype,size,avail
"
-B 1 %s | tail -n 1
'
%
path
)
...
@@ -88,7 +89,14 @@ def get_path_fs(path):
...
@@ -88,7 +89,14 @@ def get_path_fs(path):
dev
,
fstype
,
size
,
available
=
output
.
split
()
dev
,
fstype
,
size
,
available
=
output
.
split
()
else
:
else
:
dev
=
fstype
=
size
=
available
=
None
dev
=
fstype
=
size
=
available
=
None
return
dev
,
fstype
,
to_gbytes
(
int
(
size
)),
to_gbytes
(
int
(
available
))
# Example of "mount" output:
# /dev/sdb2 on / type ext4 (rw,relatime,errors=remount-ro)
status
,
output
=
subprocess
.
getstatusoutput
(
"
mount | grep
'
%s
'"
%
dev
)
if
status
==
0
:
params
=
output
.
split
()[
-
1
].
strip
(
'
()
'
).
split
(
'
,
'
)
else
:
params
=
list
()
return
dev
,
fstype
,
params
,
to_gbytes
(
int
(
size
)),
to_gbytes
(
int
(
available
))
def
check_allocation
(
dev
):
def
check_allocation
(
dev
):
...
@@ -130,7 +138,7 @@ if __name__ == '__main__':
...
@@ -130,7 +138,7 @@ if __name__ == '__main__':
if
os
.
path
.
exists
(
mount_point
):
if
os
.
path
.
exists
(
mount_point
):
mount_point
=
os
.
path
.
realpath
(
mount_point
)
mount_point
=
os
.
path
.
realpath
(
mount_point
)
name
=
'
Partition of %s
'
%
mount_point
name
=
'
Partition of %s
'
%
mount_point
dev
,
fstype
,
psize
,
available
=
get_path_fs
(
mount_point
)
dev
,
fstype
,
params
,
psize
,
available
=
get_path_fs
(
mount_point
)
condition
=
part_info
.
get
(
'
condition
'
)
condition
=
part_info
.
get
(
'
condition
'
)
if
condition
:
if
condition
:
subdev
=
get_path_fs
(
condition
.
strip
(
'
!
'
))[
0
]
subdev
=
get_path_fs
(
condition
.
strip
(
'
!
'
))[
0
]
...
@@ -145,6 +153,9 @@ if __name__ == '__main__':
...
@@ -145,6 +153,9 @@ if __name__ == '__main__':
warning
=
True
warning
=
True
if
'
nfs
'
not
in
fstype
:
if
'
nfs
'
not
in
fstype
:
warning
=
not
check_allocation
(
dev
)
warning
=
not
check_allocation
(
dev
)
if
'
acl
'
in
params
:
print
(
'
%sThe device %s is mounted using ACL.%s Please set
"
noacl
"
mount parameter in fstab and reboot.
'
%
(
RED
,
dev
,
DEF
))
error
=
True
min_available_gbytes
=
part_info
.
get
(
'
min_available_gbytes
'
)
min_available_gbytes
=
part_info
.
get
(
'
min_available_gbytes
'
)
if
min_available_gbytes
and
available
<
min_available_gbytes
:
if
min_available_gbytes
and
available
<
min_available_gbytes
:
print
(
'
%s has less than %s GB available %s(%s GB available)%s.
'
%
(
name
,
min_available_gbytes
,
RED
,
available
,
DEF
))
print
(
'
%s has less than %s GB available %s(%s GB available)%s.
'
%
(
name
,
min_available_gbytes
,
RED
,
available
,
DEF
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment