Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
10591607
Commit
10591607
authored
Oct 07, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix openvz vmstatus list
parent
1e968bde
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
OpenVZ.pm
PVE/OpenVZ.pm
+9
-4
No files found.
PVE/OpenVZ.pm
View file @
10591607
...
...
@@ -64,7 +64,7 @@ my $last_proc_vestat = {};
sub
vmstatus
{
my
(
$opt_vmid
)
=
@_
;
my
$list
=
config_list
();
my
$list
=
$opt_vmid
?
{
$opt_vmid
=>
{
type
=>
'
openvz
'
}}
:
config_list
();
foreach
my
$vmid
(
keys
%
$list
)
{
next
if
$opt_vmid
&&
(
$vmid
ne
$opt_vmid
);
...
...
@@ -102,6 +102,8 @@ sub vmstatus {
}
else
{
$d
->
{
ip
}
=
'
-
';
}
}
else
{
delete
$list
->
{
$vmid
};
}
}
...
...
@@ -121,7 +123,8 @@ sub vmstatus {
$vmid
=
$2
if
defined
(
$2
);
next
if
!
$vmid
;
my
(
$name
,
$held
,
$maxheld
,
$bar
,
$lim
,
$failcnt
)
=
(
$3
,
$4
,
$5
,
$6
,
$7
,
$8
);
if
(
my
$d
=
$list
->
{
$vmid
})
{
my
$d
=
$list
->
{
$vmid
};
if
(
$d
&&
defined
(
$d
->
{
status
}))
{
if
(
$name
eq
'
physpages
')
{
$d
->
{
mem
}
+=
int
(
$held
*
4096
);
}
elsif
(
$name
eq
'
swappages
')
{
...
...
@@ -138,7 +141,9 @@ sub vmstatus {
if
(
my
$fh
=
IO::
File
->
new
("
/proc/vz/vzquota
",
"
r
"))
{
while
(
defined
(
my
$line
=
<
$fh
>
))
{
if
(
$line
=~
m|^(\d+):\s+/var/lib/vz/private/\d+$|
)
{
if
(
my
$d
=
$list
->
{
$1
})
{
my
$vmid
=
$1
;
my
$d
=
$list
->
{
$vmid
};
if
(
$d
&&
defined
(
$d
->
{
status
}))
{
$line
=
<
$fh
>
;
if
(
$line
=~
m|^\s*1k-blocks\s+(\d+)\s+(\d+)\s|
)
{
$d
->
{
disk
}
=
int
(
$1
*
1024
);
...
...
@@ -169,7 +174,7 @@ sub vmstatus {
my
$uptime
=
int
(
$ut
/
$hz
);
my
$d
=
$list
->
{
$vmid
};
next
if
!
$d
;
next
if
!
(
$d
&&
defined
(
$d
->
{
status
}))
;
$d
->
{
status
}
=
'
running
';
$d
->
{
uptime
}
=
$uptime
;
...
...
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