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
a28a67e2
Commit
a28a67e2
authored
Nov 08, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add initlog API
parent
faa429b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
4 deletions
+78
-4
OpenVZ.pm
PVE/API2/OpenVZ.pm
+66
-3
OpenVZ.pm
PVE/OpenVZ.pm
+12
-1
No files found.
PVE/API2/OpenVZ.pm
View file @
a28a67e2
...
...
@@ -95,8 +95,6 @@ my $restore_openvz = sub {
my
$root
=
$vzconf
->
{
rootdir
};
$root
=~
s/\$VEID/$vmid/
;
my
$default_private
=
$vzconf
->
{
privatedir
};
$default_private
=~
s/\$VEID/$vmid/
;
print
"
you choose to force overwriting VPS config file, private and root directories.
\n
"
if
$force
;
...
...
@@ -115,7 +113,7 @@ my $restore_openvz = sub {
if
(
$force
&&
-
f
$conffile
)
{
my
$conf
=
PVE::OpenVZ::
load_config
(
$vmid
);
my
$oldprivate
=
$conf
->
{
ve_private
}
?
$conf
->
{
ve_private
}
->
{
value
}
:
$default_private
;
my
$oldprivate
=
PVE::OpenVZ::
get_privatedir
(
$conf
,
$vmid
)
;
rmtree
$oldprivate
if
-
d
$oldprivate
;
my
$oldroot
=
$conf
->
{
ve_root
}
?
$conf
->
{
ve_root
}
->
{
value
}
:
$root
;
...
...
@@ -416,6 +414,7 @@ __PACKAGE__->register_method({
{
subdir
=>
'
status
'
},
{
subdir
=>
'
vncproxy
'
},
{
subdir
=>
'
migrate
'
},
{
subdir
=>
'
initlog
'
},
{
subdir
=>
'
rrd
'
},
{
subdir
=>
'
rrddata
'
},
];
...
...
@@ -512,6 +511,70 @@ __PACKAGE__->register_method({
"
pve2-vm/
$param
->{vmid}
",
$param
->
{
timeframe
},
$param
->
{
cf
});
}});
__PACKAGE__
->
register_method
({
name
=>
'
initlog
',
path
=>
'
{vmid}/initlog
',
method
=>
'
GET
',
protected
=>
1
,
permissions
=>
{
path
=>
'
/vms/{vmid}
',
privs
=>
[
'
VM.Audit
'
],
},
description
=>
"
Read init log.
",
parameters
=>
{
additionalProperties
=>
0
,
properties
=>
{
node
=>
get_standard_option
('
pve-node
'),
vmid
=>
get_standard_option
('
pve-vmid
'),
start
=>
{
type
=>
'
integer
',
minimum
=>
0
,
optional
=>
1
,
},
limit
=>
{
type
=>
'
integer
',
minimum
=>
0
,
optional
=>
1
,
},
},
},
returns
=>
{
type
=>
'
array
',
items
=>
{
type
=>
"
object
",
properties
=>
{
n
=>
{
description
=>
"
Line number
",
type
=>
'
integer
',
},
t
=>
{
description
=>
"
Line text
",
type
=>
'
string
',
}
}
}
},
code
=>
sub
{
my
(
$param
)
=
@_
;
my
$rpcenv
=
PVE::RPCEnvironment::
get
();
my
$user
=
$rpcenv
->
get_user
();
my
$vmid
=
$param
->
{
vmid
};
my
$conf
=
PVE::OpenVZ::
load_config
(
$vmid
);
my
$privatedir
=
PVE::OpenVZ::
get_privatedir
(
$conf
,
$vmid
);
my
$logfn
=
"
$privatedir
/var/log/init.log
";
my
(
$count
,
$lines
)
=
PVE::Tools::
dump_logfile
(
$logfn
,
$param
->
{
start
},
$param
->
{
limit
});
$rpcenv
->
set_result_count
(
$count
);
return
$lines
;
}});
__PACKAGE__
->
register_method
({
name
=>
'
vm_config
',
path
=>
'
{vmid}/config
',
...
...
PVE/OpenVZ.pm
View file @
a28a67e2
...
...
@@ -72,6 +72,18 @@ sub check_mounted {
return
(
-
d
"
$root
/etc
"
||
-
d
"
$root
/proc
");
}
sub
get_privatedir
{
my
(
$conf
,
$vmid
)
=
@_
;
my
$private
=
$global_vzconf
->
{
privatedir
};
if
(
$conf
->
{
ve_private
}
&&
$conf
->
{
ve_private
}
->
{
value
})
{
$private
=
$conf
->
{
ve_private
}
->
{
value
};
}
$private
=~
s/\$VEID/$vmid/
;
return
$private
;
}
sub
read_user_beancounters
{
my
$ubc
=
{};
if
(
my
$fh
=
IO::
File
->
new
("
/proc/user_beancounters
",
"
r
"))
{
...
...
@@ -1193,4 +1205,3 @@ sub set_rootpasswd {
replacepw
(
$pwfile
,
$opt_rootpasswd
);
}
}
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