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
103a7e62
Commit
103a7e62
authored
Feb 29, 2012
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup and fix openvz vswap handling
parent
81fe53f6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
34 deletions
+46
-34
OpenVZ.pm
PVE/API2/OpenVZ.pm
+2
-11
OpenVZ.pm
PVE/OpenVZ.pm
+37
-22
changelog.Debian
debian/changelog.Debian
+6
-0
defines.mk
defines.mk
+1
-1
No files found.
PVE/API2/OpenVZ.pm
View file @
103a7e62
...
...
@@ -713,7 +713,7 @@ __PACKAGE__->register_method({
my
$stcfg
=
cfs_read_file
("
storage.cfg
");
if
(
$veconf
->
{
ve_private
}
&&
$conf
->
{
ve_private
}
->
{
value
})
{
if
(
$veconf
->
{
ve_private
}
&&
$
ve
conf
->
{
ve_private
}
->
{
value
})
{
my
$path
=
PVE::OpenVZ::
get_privatedir
(
$veconf
,
$param
->
{
vmid
});
my
(
$vtype
,
$volid
)
=
PVE::Storage::
path_to_volume_id
(
$stcfg
,
$path
);
my
(
$sid
,
$volname
)
=
PVE::Storage::
parse_volume_id
(
$volid
,
1
)
if
$volid
;
...
...
@@ -737,16 +737,7 @@ __PACKAGE__->register_method({
}
}
if
(
defined
(
$conf
->
{
swappages
}))
{
$conf
->
{
memory
}
=
$veconf
->
{
physpages
}
->
{
lim
}
?
int
((
$veconf
->
{
physpages
}
->
{
lim
}
*
4
)
/
1024
)
:
512
;
$conf
->
{
swap
}
=
$veconf
->
{
swappages
}
->
{
lim
}
?
int
((
$veconf
->
{
swappages
}
->
{
lim
}
*
4
)
/
1024
)
:
0
;
}
else
{
$conf
->
{
memory
}
=
$veconf
->
{
vmguarpages
}
->
{
bar
}
?
int
((
$veconf
->
{
vmguarpages
}
->
{
bar
}
*
4
)
/
1024
)
:
512
;
$conf
->
{
swap
}
=
0
;
}
(
$conf
->
{
memory
},
$conf
->
{
swap
})
=
PVE::OpenVZ::
ovz_config_extract_mem_swap
(
$veconf
,
1024
*
1024
);
my
$diskspace
=
$veconf
->
{
diskspace
}
->
{
bar
}
||
LONG_MAX
;
if
(
$diskspace
==
LONG_MAX
)
{
...
...
PVE/OpenVZ.pm
View file @
103a7e62
...
...
@@ -209,18 +209,10 @@ sub vmstatus {
$d
->
{
disk
}
=
0
;
$d
->
{
maxdisk
}
=
int
(
$conf
->
{
diskspace
}
->
{
bar
}
*
1024
);
if
(
defined
(
$conf
->
{
swappages
}))
{
$d
->
{
mem
}
=
0
;
$d
->
{
maxmem
}
=
int
(((
$conf
->
{
physpages
}
->
{
lim
}
+
$conf
->
{
swappages
}
->
{
lim
})
*
4096
));
$d
->
{
swap
}
=
0
;
$d
->
{
maxswap
}
=
int
(((
$conf
->
{
swappages
}
->
{
lim
})
*
4096
));
}
else
{
$d
->
{
mem
}
=
0
;
$d
->
{
maxmem
}
=
int
(
$conf
->
{
vmguarpages
}
->
{
bar
}
*
4096
);
$d
->
{
swap
}
=
0
;
$d
->
{
maxswap
}
=
0
;
}
$d
->
{
mem
}
=
0
;
$d
->
{
swap
}
=
0
;
(
$d
->
{
maxmem
},
$d
->
{
maxswap
})
=
ovz_config_extract_mem_swap
(
$conf
);
$d
->
{
nproc
}
=
0
;
$d
->
{
failcnt
}
=
0
;
...
...
@@ -365,7 +357,7 @@ my $confdesc = {
optional
=>
1
,
type
=>
'
integer
',
description
=>
"
Amount of SWAP for the VM in MB.
",
minimum
=>
16
,
minimum
=>
0
,
default
=>
512
,
},
disk
=>
{
...
...
@@ -879,29 +871,52 @@ sub create_config_line {
}
}
sub
ovz_config_extract_mem_swap
{
my
(
$veconf
,
$unit
)
=
@_
;
$unit
=
1
if
!
$unit
;
my
(
$mem
,
$swap
)
=
(
int
((
512
*
1024
*
1024
+
$unit
-
1
)
/
$unit
),
0
);
my
$maxpages
=
(
$res_unlimited
/
4096
);
if
(
$veconf
->
{
swappages
})
{
if
(
$veconf
->
{
physpages
}
&&
$veconf
->
{
physpages
}
->
{
lim
}
&&
(
$veconf
->
{
physpages
}
->
{
lim
}
<
$maxpages
))
{
$mem
=
int
((
$veconf
->
{
physpages
}
->
{
lim
}
*
4096
+
$unit
-
1
)
/
$unit
);
}
if
(
$veconf
->
{
swappages
}
->
{
lim
}
&&
(
$veconf
->
{
swappages
}
->
{
lim
}
<
$maxpages
))
{
$swap
=
int
((
$veconf
->
{
swappages
}
->
{
lim
}
*
4096
+
$unit
-
1
)
/
$unit
);
}
}
else
{
if
(
$veconf
->
{
vmguarpages
}
&&
$veconf
->
{
vmguarpages
}
->
{
bar
}
&&
(
$veconf
->
{
vmguarpages
}
->
{
bar
}
<
$maxpages
))
{
$mem
=
int
((
$veconf
->
{
vmguarpages
}
->
{
bar
}
*
4096
+
$unit
-
1
)
/
$unit
);
}
}
return
(
$mem
,
$swap
);
}
sub
update_ovz_config
{
my
(
$vmid
,
$veconf
,
$param
)
=
@_
;
my
$changes
=
[]
;
# test if barrier or limit changed
my
$push_bl_changes
=
sub
{
my
(
$name
,
$bar
,
$lim
)
=
@_
;
my
$old
=
format_res_bar_lim
(
$name
,
$veconf
->
{
$name
});
my
$old
=
format_res_bar_lim
(
$name
,
$veconf
->
{
$name
})
if
$veconf
->
{
$name
}
&&
defined
(
$veconf
->
{
$name
}
->
{
bar
});
my
$new
=
format_res_bar_lim
(
$name
,
{
bar
=>
$bar
,
lim
=>
$lim
});
if
(
$old
ne
$new
)
{
if
(
!
$old
||
(
$old
ne
$new
)
)
{
$veconf
->
{
$name
}
->
{
bar
}
=
$bar
;
$veconf
->
{
$name
}
->
{
lim
}
=
$lim
;
push
@$changes
,
"
--
$name
",
$new
;
}
};
my
$mem
=
$veconf
->
{
physpages
}
->
{
lim
}
?
int
((
$veconf
->
{
physpages
}
->
{
lim
}
*
4
)
/
1024
)
:
512
;
my
$swap
=
$veconf
->
{
swappages
}
->
{
lim
}
?
int
((
$veconf
->
{
swappages
}
->
{
lim
}
*
4
)
/
1024
)
:
0
;
my
(
$mem
,
$swap
)
=
ovz_config_extract_mem_swap
(
$veconf
,
1024
*
1024
);
my
$disk
=
(
$veconf
->
{
diskspace
}
->
{
bar
}
||
$res_unlimited
)
/
(
1024
*
1024
);
my
$cpuunits
=
$veconf
->
{
cpuunits
}
->
{
value
}
||
1000
;
my
$quotatime
=
$veconf
->
{
quotatime
}
->
{
value
}
||
0
;
...
...
debian/changelog.Debian
View file @
103a7e62
pve-manager (2.0-36) unstable; urgency=low
* cleanup and fix openvz vswap handling
-- Proxmox Support Team <support@proxmox.com> Wed, 29 Feb 2012 09:20:58 +0100
pve-manager (2.0-35) unstable; urgency=low
* avoid warning in pvestatd for containers with old config files
...
...
defines.mk
View file @
103a7e62
...
...
@@ -2,7 +2,7 @@ RELEASE=2.0
VERSION=2.0
PACKAGE=pve-manager
PACKAGERELEASE=3
5
PACKAGERELEASE=3
6
BINDIR=${DESTDIR}/usr/bin
PERLLIBDIR=${DESTDIR}/usr/share/perl5
...
...
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