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
70694055
Commit
70694055
authored
7 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Changed log (refs
#22279
).
parent
a6d54cd9
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
+10
-10
10 additions, 10 deletions
tests/test_partitions.py
with
10 additions
and
10 deletions
tests/test_partitions.py
+
10
−
10
View file @
70694055
...
@@ -51,7 +51,7 @@ def get_swap_gbytes():
...
@@ -51,7 +51,7 @@ def get_swap_gbytes():
swap
=
l
.
split
(
'
SwapTotal:
'
)[
1
].
strip
()
swap
=
l
.
split
(
'
SwapTotal:
'
)[
1
].
strip
()
swap_kbytes
,
unit
=
swap
.
split
(
'
'
)
swap_kbytes
,
unit
=
swap
.
split
(
'
'
)
if
unit
!=
'
kB
'
:
if
unit
!=
'
kB
'
:
print
(
'
Warning, unexpected unit %s
'
%
unit
)
print
(
'
Warning, unexpected unit %s
.
'
%
unit
)
swap_gbytes
=
int
(
round
(
int
(
swap_kbytes
)
/
(
1024
*
1024
)))
swap_gbytes
=
int
(
round
(
int
(
swap_kbytes
)
/
(
1024
*
1024
)))
return
swap_gbytes
return
swap_gbytes
...
@@ -87,7 +87,7 @@ def check_allocation(dev):
...
@@ -87,7 +87,7 @@ def check_allocation(dev):
unallocated
=
max_size
-
total_size
unallocated
=
max_size
-
total_size
unallocated_gbytes
=
to_gbytes
(
unallocated
)
unallocated_gbytes
=
to_gbytes
(
unallocated
)
if
unallocated_gbytes
>
1
:
if
unallocated_gbytes
>
1
:
print
(
'
Warning, %s GB are unallocated on %s
'
%
(
unallocated_gbytes
,
root_dev
))
print
(
'
Warning, %s GB are unallocated on %s
.
'
%
(
unallocated_gbytes
,
root_dev
))
return
False
return
False
return
True
return
True
...
@@ -107,37 +107,37 @@ def check_path(p):
...
@@ -107,37 +107,37 @@ def check_path(p):
name
=
mount_point
name
=
mount_point
dev
,
fstype
,
psize
,
available
=
get_path
(
mount_point
)
dev
,
fstype
,
psize
,
available
=
get_path
(
mount_point
)
if
fstype
not
in
p
.
get
(
'
recommended_types
'
):
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
))
print
(
'
Warning, partition of %s fs type not recommended %s(current: %s, recommended: %s)%s
.
'
%
(
name
,
YELLOW
,
fstype
,
p
[
'
recommended_types
'
],
DEF
))
warning
=
True
warning
=
True
if
'
nfs
'
not
in
dev
:
if
'
nfs
'
not
in
dev
:
warning
=
not
check_allocation
(
dev
)
warning
=
not
check_allocation
(
dev
)
min_available_gbytes
=
p
.
get
(
'
min_available_gbytes
'
)
min_available_gbytes
=
p
.
get
(
'
min_available_gbytes
'
)
if
min_available_gbytes
and
available
<
min_available_gbytes
:
if
min_available_gbytes
and
available
<
min_available_gbytes
:
print
(
'
Partition of %s has less than %s GB available (%s GB available)
'
%
(
mount_point
,
min_available_gbytes
,
available
))
print
(
'
Partition of %s has less than %s GB available
%s
(%s GB available)
%s.
'
%
(
name
,
min_available_gbytes
,
RED
,
available
,
DEF
))
error
=
True
error
=
True
else
:
else
:
print
(
'
Partition of %s is OK (%s GB available)
'
%
(
name
,
available
))
print
(
'
Partition of %s is OK (%s GB available)
.
'
%
(
name
,
available
))
else
:
else
:
print
(
'
%s not found, cannot check
'
%
mount_point
)
print
(
'
%s not found, cannot check
.
'
%
mount_point
)
elif
p
.
get
(
'
type
'
)
==
'
swap
'
:
elif
p
.
get
(
'
type
'
)
==
'
swap
'
:
name
=
'
swap
'
name
=
'
swap
'
psize
=
get_swap_gbytes
()
psize
=
get_swap_gbytes
()
if
psize
and
psize
<
p
[
'
min_size_gbytes
'
]:
if
psize
and
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
))
print
(
'
Partition of
%s is smaller than the minimum required size %s(%s GB < %s GB)%s
.
'
%
(
name
,
RED
,
psize
,
p
[
'
min_size_gbytes
'
],
DEF
))
error
=
True
error
=
True
for
p
in
paths
:
for
p
in
paths
:
check_path
(
p
)
check_path
(
p
)
if
error
:
if
error
:
print
(
'
Errors found
'
)
print
(
'
Errors found
.
'
)
code
=
1
code
=
1
elif
warning
:
elif
warning
:
print
(
'
Some warnings were found
'
)
print
(
'
Some warnings were found
.
'
)
code
=
2
code
=
2
else
:
else
:
print
(
GREEN
+
'
All
ok
'
+
DEF
)
print
(
GREEN
+
'
All
OK.
'
+
DEF
)
code
=
0
code
=
0
sys
.
exit
(
code
)
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