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
263ba714
Commit
263ba714
authored
7 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Follow links for msinstance dir (refs
#22279
).
parent
010a86c6
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
+17
-15
17 additions, 15 deletions
tests/test_partitions.py
with
17 additions
and
15 deletions
tests/test_partitions.py
+
17
−
15
View file @
263ba714
...
...
@@ -10,6 +10,10 @@ import sys
import
os
BS
=
512
YELLOW
=
'
\033
[93m
'
GREEN
=
'
\033
[92m
'
RED
=
'
\033
[91m
'
DEF
=
'
\033
[0m
'
def
to_gbytes
(
size_bytes
):
...
...
@@ -31,7 +35,7 @@ paths = [
'
mount_point
'
:
'
/home/msuser/msinstance
'
,
'
recommended_types
'
:
(
'
ext4
'
,
'
nfsv4
'
),
'
min_size_gbytes
'
:
400
,
'
min_free_size_gbytes
'
:
1
0
,
'
min_free_size_gbytes
'
:
1
5
,
},
{
'
type
'
:
'
swap
'
,
...
...
@@ -98,19 +102,22 @@ def check_path(p):
psize
=
None
mount_point
=
p
.
get
(
'
mount_point
'
)
if
mount_point
:
if
os
.
path
.
isdir
(
mount_point
):
if
os
.
path
.
exists
(
mount_point
):
mount_point
=
os
.
path
.
realpath
(
mount_point
)
name
=
mount_point
dev
,
fstype
,
psize
,
used
=
get_path
(
p
[
'
mount_point
'
]
)
dev
,
fstype
,
psize
,
used
=
get_path
(
mount_point
)
if
fstype
not
in
p
.
get
(
'
recommended_types
'
):
print
(
'
Warning, fs type
%s
not recommended
(
recommended: %s)
'
%
(
fstype
,
p
[
'
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
:
warning
=
not
check_allocation
(
dev
)
free_gb
=
psize
-
used
min_free_size_gbytes
=
p
.
get
(
'
min_free_size_gbytes
'
)
if
min_free_size_gbytes
and
free_gb
<
min_free_size_gbytes
:
print
(
'
%s has less than %s GB free (%s GB free)
'
%
(
mount_point
,
min_free_size_gbytes
,
free_gb
))
print
(
'
Partition of
%s has less than %s GB free (%s GB free)
'
%
(
mount_point
,
min_free_size_gbytes
,
free_gb
))
error
=
True
else
:
print
(
'
Partition of %s is OK
'
%
name
)
else
:
print
(
'
%s not found, cannot check
'
%
mount_point
)
elif
p
.
get
(
'
type
'
)
==
'
swap
'
:
...
...
@@ -118,25 +125,20 @@ def check_path(p):
psize
=
get_swap_gbytes
()
if
psize
and
psize
<
p
[
'
min_size_gbytes
'
]:
print
(
'
%s is smaller than the minimum required size (%s GB < %s GB)
'
%
(
name
,
psize
,
p
[
'
min_size_gbytes
'
]))
print
(
'
%s is smaller than the minimum required size
%s
(%s GB < %s GB)
%s
'
%
(
name
,
RED
,
psize
,
p
[
'
min_size_gbytes
'
]
,
DEF
))
error
=
True
for
p
in
paths
:
check_path
(
p
)
OK
=
0
ERROR
=
1
WARNING
=
3
UNTESTABLE
=
2
if
error
:
print
(
'
Errors found
'
)
code
=
ERROR
code
=
1
elif
warning
:
print
(
'
Some warnings were found
'
)
code
=
WARNING
code
=
2
else
:
print
(
'
All ok
'
)
code
=
OK
print
(
GREEN
+
'
All ok
'
+
DEF
)
code
=
0
sys
.
exit
(
code
)
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