Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Zheng
slapos.core
Commits
ef138eeb
Commit
ef138eeb
authored
Nov 13, 2015
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.collect: fix partition disk usage reported value, use Kb
parent
8efa3740
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
slapos/collect/entity.py
slapos/collect/entity.py
+2
-2
slapos/collect/reporter.py
slapos/collect/reporter.py
+1
-1
slapos/collect/snapshot.py
slapos/collect/snapshot.py
+1
-1
No files found.
slapos/collect/entity.py
View file @
ef138eeb
...
@@ -78,7 +78,7 @@ class User(object):
...
@@ -78,7 +78,7 @@ class User(object):
limit
=
1
limit
=
1
query
=
database
.
select
(
table
=
"folder"
,
columns
=
"date, time"
,
query
=
database
.
select
(
table
=
"folder"
,
columns
=
"date, time"
,
order
=
order
,
limit
=
limit
,
order
=
order
,
limit
=
limit
,
where
=
"partition=
%s
"
%
self
.
name
)
where
=
"partition=
'%s'
"
%
self
.
name
)
query_result
=
zip
(
*
query
)
query_result
=
zip
(
*
query
)
if
len
(
query_result
):
if
len
(
query_result
):
date
,
time
=
(
query_result
[
0
][
0
],
query_result
[
1
][
0
])
date
,
time
=
(
query_result
[
0
][
0
],
query_result
[
1
][
0
])
...
@@ -93,7 +93,7 @@ class User(object):
...
@@ -93,7 +93,7 @@ class User(object):
disk_snapshot
=
FolderSizeSnapshot
(
self
.
path
,
pid_file
)
disk_snapshot
=
FolderSizeSnapshot
(
self
.
path
,
pid_file
)
disk_snapshot
.
update_folder_size
()
disk_snapshot
.
update_folder_size
()
# Skeep insert empty partition: size <= 1Mb
# Skeep insert empty partition: size <= 1Mb
if
disk_snapshot
.
disk_usage
<=
1.0
and
\
if
disk_snapshot
.
disk_usage
<=
1
024
.0
and
\
not
self
.
disk_snapshot_params
.
get
(
'testing'
,
False
):
not
self
.
disk_snapshot_params
.
get
(
'testing'
,
False
):
return
return
database
.
inserFolderSnapshot
(
self
.
name
,
database
.
inserFolderSnapshot
(
self
.
name
,
...
...
slapos/collect/reporter.py
View file @
ef138eeb
...
@@ -219,7 +219,7 @@ class ConsumptionReport(object):
...
@@ -219,7 +219,7 @@ class ConsumptionReport(object):
journal
.
newMovement
(
transaction
,
journal
.
newMovement
(
transaction
,
resource
=
"service_module/disk_used"
,
resource
=
"service_module/disk_used"
,
title
=
"Partition Disk Used Average for %s"
%
(
user
),
title
=
"Partition Disk Used Average for %s"
%
(
user
),
quantity
=
str
(
partition_disk_used
),
quantity
=
str
(
partition_disk_used
/
1024.0
),
reference
=
user
,
reference
=
user
,
category
=
""
)
category
=
""
)
...
...
slapos/collect/snapshot.py
View file @
ef138eeb
...
@@ -108,7 +108,7 @@ class FolderSizeSnapshot(_Snapshot):
...
@@ -108,7 +108,7 @@ class FolderSizeSnapshot(_Snapshot):
def
_getSize
(
self
,
file_path
):
def
_getSize
(
self
,
file_path
):
size
=
0
size
=
0
command
=
'du -s
m
%s'
%
file_path
command
=
'du -s %s'
%
file_path
process
=
subprocess
.
Popen
(
command
,
stdout
=
subprocess
.
PIPE
,
process
=
subprocess
.
Popen
(
command
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
if
self
.
pid_file
:
if
self
.
pid_file
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment