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
2b914b59
Commit
2b914b59
authored
6 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a bug in partitions test (refs
#26179
).
parent
e7441f97
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
+8
-3
8 additions, 3 deletions
tests/test_partitions.py
with
8 additions
and
3 deletions
tests/test_partitions.py
+
8
−
3
View file @
2b914b59
...
...
@@ -24,6 +24,7 @@ def read_file(fname):
with
open
(
fname
,
'
r
'
)
as
f
:
return
f
.
read
()
paths
=
[
{
'
mount_point
'
:
'
/
'
,
...
...
@@ -67,8 +68,8 @@ def get_swap_gbytes():
def
get_path
(
path
):
# Filesystem Type 1B-blocks Used Available
Use% Mounted on
# /dev/loop2 ext4 52710469632 38253940736 11755397120
77% /
# Filesystem Type 1B-blocks Used Available
# /dev/loop2 ext4 52710469632 38253940736 11755397120
status
,
output
=
subprocess
.
getstatusoutput
(
'
df --output=
"
source,fstype,size,avail
"
-B 1 %s | tail -n 1
'
%
path
)
if
status
==
0
:
dev
,
fstype
,
size
,
available
=
output
.
split
()
...
...
@@ -79,6 +80,8 @@ def get_path(path):
def
check_allocation
(
dev
):
root_dev
=
os
.
path
.
basename
(
dev
)[:
3
]
if
not
root_dev
:
return
True
d
=
read_file
(
'
/proc/partitions
'
)
dev_partitions
=
list
()
for
l
in
d
.
split
(
'
\n
'
):
...
...
@@ -101,6 +104,7 @@ def check_allocation(dev):
return
False
return
True
error
=
False
warning
=
False
...
...
@@ -119,7 +123,7 @@ def check_path(p):
if
fstype
not
in
p
.
get
(
'
recommended_types
'
):
print
(
'
Warning, partition of %s fs type not recommended %s(current: %s, recommended: %s)%s.
'
%
(
name
,
YELLOW
,
fstype
,
p
[
'
recommended_types
'
],
DEF
))
warning
=
True
if
'
nfs
'
not
in
dev
:
if
'
nfs
'
not
in
fstype
:
warning
=
not
check_allocation
(
dev
)
min_available_gbytes
=
p
.
get
(
'
min_available_gbytes
'
)
if
min_available_gbytes
and
available
<
min_available_gbytes
:
...
...
@@ -141,6 +145,7 @@ def check_path(p):
print
(
'
Partition of %s is smaller than the recommended size %s(%s GB < %s GB)%s.
'
%
(
name
,
YELLOW
,
psize
,
p
[
'
reco_size_gbytes
'
],
DEF
))
warning
=
True
for
p
in
paths
:
check_path
(
p
)
...
...
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