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
3ae33cce
Commit
3ae33cce
authored
Oct 10, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
run openvz create_vm as background task
parent
22f26281
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
OpenVZ.pm
PVE/API2/OpenVZ.pm
+18
-10
No files found.
PVE/API2/OpenVZ.pm
View file @
3ae33cce
...
...
@@ -108,10 +108,16 @@ __PACKAGE__->register_method({
},
}),
},
returns
=>
{
type
=>
'
null
'},
returns
=>
{
type
=>
'
string
',
},
code
=>
sub
{
my
(
$param
)
=
@_
;
my
$rpcenv
=
PVE::RPCEnvironment::
get
();
my
$user
=
$rpcenv
->
get_user
();
my
$node
=
extract_param
(
$param
,
'
node
');
# fixme: fork worker?
...
...
@@ -164,20 +170,22 @@ __PACKAGE__->register_method({
my
$rawconf
=
PVE::OpenVZ::
generate_raw_config
(
$pve_base_ovz_config
,
$conf
);
PVE::Tools::
file_set_contents
(
$basecfg_fn
,
$rawconf
);
my
$realcmd
=
sub
{
PVE::Tools::
file_set_contents
(
$basecfg_fn
,
$rawconf
);
my
$cmd
=
['
vzctl
',
'
--skiplock
',
'
create
',
$vmid
,
'
--ostemplate
',
$tpath
];
my
$cmd
=
['
vzctl
',
'
--skiplock
',
'
create
',
$vmid
,
'
--ostemplate
',
$tpath
];
PVE::Tools::
run_command
(
$cmd
);
PVE::Tools::
run_command
(
$cmd
);
# hack: vzctl '--userpasswd' starts the CT, but we want
# to avoid that for create
PVE::OpenVZ::
set_rootpasswd
(
$vmid
,
$password
)
if
defined
(
$password
);
};
# 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
$rpcenv
->
fork_worker
('
vzcreate
',
$vmid
,
$user
,
$realcmd
);
};
return
undef
;
return
PVE::OpenVZ::
lock_container
(
$vmid
,
$code
)
;
}});
__PACKAGE__
->
register_method
({
...
...
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