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
3e86d7f6
Commit
3e86d7f6
authored
Sep 28, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement update_vm for openvz
parent
590d0595
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
3 deletions
+67
-3
OpenVZ.pm
PVE/API2/OpenVZ.pm
+63
-1
OpenVZ.pm
PVE/OpenVZ.pm
+1
-2
pvectl
bin/pvectl
+3
-0
No files found.
PVE/API2/OpenVZ.pm
View file @
3e86d7f6
...
...
@@ -163,11 +163,73 @@ __PACKAGE__->register_method({
# hack: vzctl '--userpasswd' starts the CT, but we want
# to avoid that for create
PVE::OpenVZ::
set_rootpasswd
(
$vmid
,
$password
)
if
defined
(
$password
);
};
PVE::OpenVZ::
lock_container
(
$vmid
,
$code
);
return
undef
;
}});
__PACKAGE__
->
register_method
({
name
=>
'
update_vm
',
path
=>
'
{vmid}/config
',
method
=>
'
PUT
',
protected
=>
1
,
proxyto
=>
'
node
',
description
=>
"
Set virtual machine options.
",
parameters
=>
{
additionalProperties
=>
0
,
properties
=>
PVE::OpenVZ::
json_config_properties
(
{
node
=>
get_standard_option
('
pve-node
'),
vmid
=>
get_standard_option
('
pve-vmid
'),
digest
=>
{
type
=>
'
string
',
description
=>
'
Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.
',
maxLength
=>
40
,
optional
=>
1
,
}
}),
},
returns
=>
{
type
=>
'
null
'},
code
=>
sub
{
my
(
$param
)
=
@_
;
my
$rpcenv
=
PVE::RPCEnvironment::
get
();
my
$user
=
$rpcenv
->
get_user
();
my
$node
=
extract_param
(
$param
,
'
node
');
my
$vmid
=
extract_param
(
$param
,
'
vmid
');
return
undef
;
my
$digest
=
extract_param
(
$param
,
'
digest
');
die
"
no options specified
\n
"
if
!
scalar
(
keys
%
$param
);
my
$code
=
sub
{
my
$basecfg_fn
=
&
$get_config_path
(
$vmid
);
my
$basecfg
=
PVE::Tools::
file_get_contents
(
$basecfg_fn
);
die
"
container
$vmid
does not exists
\n
"
if
!
$basecfg
;
my
$conf
=
PVE::OpenVZ::
parse_ovz_config
(
$basecfg_fn
,
$basecfg
);
die
"
checksum missmatch (file change by other user?)
\n
"
if
$digest
&&
$digest
ne
$conf
->
{
digest
};
my
$changes
=
PVE::OpenVZ::
update_ovz_config
(
$conf
,
$param
);
return
if
scalar
(
@$changes
)
<=
0
;
my
$cmd
=
['
vzctl
',
'
--skiplock
',
'
set
',
$vmid
,
@$changes
,
'
--save
'];
PVE::Tools::
run_command
(
$cmd
);
};
PVE::OpenVZ::
lock_container
(
$vmid
,
$code
);
return
undef
;
}});
__PACKAGE__
->
register_method
({
...
...
PVE/OpenVZ.pm
View file @
3e86d7f6
...
...
@@ -891,8 +891,7 @@ sub update_ovz_config {
$veconf
->
{'
nameserver
'}
->
{
value
}
=
join
('
',
keys
%
$nshash
);
}
foreach
my
$nv
(
@$changes
)
{
print
"
CHANGE:
$nv
\n
";
}
# foreach my $nv (@$changes) { print "CHANGE: $nv\n"; }
return
$changes
;
}
...
...
bin/pvectl
View file @
3e86d7f6
...
...
@@ -51,6 +51,9 @@ my $cmddef = {
create
=>
[
'
PVE::API2::OpenVZ
',
'
create_vm
',
['
vmid
',
'
ostemplate
'],
{
node
=>
$nodename
}
],
destroy
=>
[
'
PVE::API2::OpenVZ
',
'
destroy_vm
',
['
vmid
'],
{
node
=>
$nodename
}
],
set
=>
[
"
PVE::API2::OpenVZ
",
'
update_vm
',
['
vmid
'],
{
node
=>
$nodename
}
],
};
my
$cmd
=
shift
;
...
...
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