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
17c4be6c
Commit
17c4be6c
authored
Sep 18, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openvz: improve configuration parser
parent
f026b166
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
OpenVZ.pm
PVE/OpenVZ.pm
+20
-3
No files found.
PVE/OpenVZ.pm
View file @
17c4be6c
...
...
@@ -736,6 +736,17 @@ sub parse_integer {
return
undef
;
};
# use this for dns-name/ipv4/ipv6 (or lists of them)
sub
parse_simple_string
{
my
(
$key
,
$text
)
=
@_
;
if
(
$text
=~
m/^([a-zA-Z0-9\-\,\;\:\.\s]*)$/
)
{
return
{
value
=>
$1
};
}
return
undef
;
}
my
$ovz_ressources
=
{
numproc
=>
\&
parse_res_num_ignore
,
numtcpsock
=>
\&
parse_res_num_ignore
,
...
...
@@ -776,9 +787,9 @@ my $ovz_ressources = {
ip_address
=>
'
string
',
netif
=>
'
string
',
hostname
=>
'
string
'
,
nameserver
=>
'
string
'
,
searchdomain
=>
'
string
'
,
hostname
=>
\&
parse_simple_string
,
nameserver
=>
\&
parse_simple_string
,
searchdomain
=>
\&
parse_simple_string
,
name
=>
'
string
',
description
=>
'
string
',
...
...
@@ -1055,6 +1066,12 @@ sub update_ovz_config {
$newvalue
=
defined
(
$newvalue
)
?
$newvalue
:
$param
->
{
$name
};
return
if
!
defined
(
$newvalue
);
my
$parser
=
$ovz_ressources
->
{
$name
};
if
(
$parser
&&
ref
(
$parser
))
{
my
$ok
=
&
$parser
(
$name
,
$newvalue
);
die
"
invalid format - unable to parse property '
$name
'
\n
"
if
!
defined
(
$ok
);
}
my
$oldvalue
=
$veconf
->
{
$name
}
->
{
value
};
if
(
!
defined
(
$oldvalue
)
||
(
$oldvalue
ne
$newvalue
))
{
$veconf
->
{
$name
}
->
{
value
}
=
$newvalue
;
...
...
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