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
31059552
Commit
31059552
authored
Sep 07, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert pvedaemon into a PVE::Service class
parent
09c45d10
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
90 deletions
+89
-90
Makefile
PVE/Service/Makefile
+1
-1
pvedaemon.pm
PVE/Service/pvedaemon.pm
+84
-0
Makefile
bin/Makefile
+1
-6
pvedaemon
bin/pvedaemon
+3
-83
No files found.
PVE/Service/Makefile
View file @
31059552
include
../../defines.mk
include
../../defines.mk
SOURCES
=
pvestatd.pm pveproxy.pm
SOURCES
=
pvestatd.pm pveproxy.pm
pvedaemon.pm
.PHONY
:
install
.PHONY
:
install
install
:
${SOURCES}
install
:
${SOURCES}
...
...
PVE/Service/pvedaemon.pm
0 → 100755
View file @
31059552
package
PVE::Service::
pvedaemon
;
use
strict
;
use
warnings
;
use
PVE::
SafeSyslog
;
use
PVE::
Daemon
;
use
PVE::
API2
;
use
PVE::API2::Formatter::
Standard
;
use
PVE::API2::Formatter::
HTML
;
use
PVE::
HTTPServer
;
use
base
qw(PVE::Daemon)
;
my
$cmdline
=
[
$0
,
@ARGV
];
my
%
daemon_options
=
(
max_workers
=>
3
,
restart_on_error
=>
5
,
stop_wait_time
=>
15
,
leave_children_open_on_reload
=>
1
,
);
my
$daemon
=
__PACKAGE__
->
new
('
pvedaemon
',
$cmdline
,
%
daemon_options
);
sub
init
{
my
(
$self
)
=
@_
;
my
$accept_lock_fn
=
"
/var/lock/pvedaemon.lck
";
my
$lockfh
=
IO::
File
->
new
("
>>
${accept_lock_fn}
")
||
die
"
unable to open lock file '
${accept_lock_fn}
' - $!
\n
";
my
$socket
=
$self
->
create_reusable_socket
(
85
,
'
127.0.0.1
');
$self
->
{
server_config
}
=
{
base_handler_class
=>
'
PVE::API2
',
keep_alive
=>
100
,
max_conn
=>
500
,
max_requests
=>
1000
,
lockfile
=>
$accept_lock_fn
,
socket
=>
$socket
,
lockfh
=>
$lockfh
,
debug
=>
$self
->
{
debug
},
trusted_env
=>
1
,
};
}
sub
run
{
my
(
$self
)
=
@_
;
my
$server
=
PVE::
HTTPServer
->
new
(
%
{
$self
->
{
server_config
}});
$server
->
run
();
}
$daemon
->
register_start_command
();
$daemon
->
register_restart_command
(
1
);
$daemon
->
register_stop_command
();
$daemon
->
register_status_command
();
our
$cmddef
=
{
start
=>
[
__PACKAGE__
,
'
start
',
[]
],
restart
=>
[
__PACKAGE__
,
'
restart
',
[]
],
stop
=>
[
__PACKAGE__
,
'
stop
',
[]
],
status
=>
[
__PACKAGE__
,
'
status
',
[]
,
undef
,
sub
{
print
shift
.
"
\n
";}
],
};
1
;
__END__
=head1 NAME
pvedaemon - the PVE configuration server
=include synopsis
=head1 DESCRIPTION
All configuration is done using this Server. The Server only
listens to a local address 127.0.0.1 port 85 for security
reasons.
=include pve_copyright
bin/Makefile
View file @
31059552
...
@@ -2,7 +2,7 @@ include ../defines.mk
...
@@ -2,7 +2,7 @@ include ../defines.mk
SUBDIRS
=
init.d ocf
test
SUBDIRS
=
init.d ocf
test
SERVICES
=
pvestatd pveproxy
SERVICES
=
pvestatd pveproxy
pvedaemon
CLITOOLS
=
vzdump pvesubscription
CLITOOLS
=
vzdump pvesubscription
SCRIPTS
=
\
SCRIPTS
=
\
...
@@ -12,7 +12,6 @@ SCRIPTS = \
...
@@ -12,7 +12,6 @@ SCRIPTS = \
pvesh
\
pvesh
\
pveam
\
pveam
\
pvebanner
\
pvebanner
\
pvedaemon
\
spiceproxy
\
spiceproxy
\
pveversion
\
pveversion
\
pvemailforward.pl
\
pvemailforward.pl
\
...
@@ -25,7 +24,6 @@ SERVICE_MANS = $(addsuffix .8, ${SERVICES})
...
@@ -25,7 +24,6 @@ SERVICE_MANS = $(addsuffix .8, ${SERVICES})
CLI_MANS
=
\
CLI_MANS
=
\
$
(
addsuffix .1,
${
CLITOOLS
}
)
\
$
(
addsuffix .1,
${
CLITOOLS
}
)
\
pveceph.1
\
pveceph.1
\
pvedaemon.1
\
spiceproxy.1
\
spiceproxy.1
\
pveversion.1
\
pveversion.1
\
pveupgrade.1
\
pveupgrade.1
\
...
@@ -71,9 +69,6 @@ pveperf.1.pod: pveperf
...
@@ -71,9 +69,6 @@ pveperf.1.pod: pveperf
perl
-I
..
-T
-e
"use PVE::CLI::
$*
; PVE::CLI::
$*
->generate_bash_completions();"
>
$@
.tmp
perl
-I
..
-T
-e
"use PVE::CLI::
$*
; PVE::CLI::
$*
->generate_bash_completions();"
>
$@
.tmp
mv
$@
.tmp
$@
mv
$@
.tmp
$@
pvedaemon.1.pod
:
pvedaemon
perl
-I
..
-T
./pvedaemon printmanpod
>
$@
spiceproxy.1.pod
:
spiceproxy
spiceproxy.1.pod
:
spiceproxy
perl
-I
..
-T
./spiceproxy printmanpod
>
$@
perl
-I
..
-T
./spiceproxy printmanpod
>
$@
...
...
bin/pvedaemon
View file @
31059552
...
@@ -7,14 +7,7 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
...
@@ -7,14 +7,7 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
use
strict
;
use
strict
;
use
warnings
;
use
warnings
;
use
PVE::
SafeSyslog
;
use
PVE::Service::
pvedaemon
;
use
PVE::
Daemon
;
use
PVE::
API2
;
use
PVE::API2::Formatter::
Standard
;
use
PVE::API2::Formatter::
HTML
;
use
PVE::
HTTPServer
;
use
base
qw(PVE::Daemon)
;
$SIG
{'
__WARN__
'}
=
sub
{
$SIG
{'
__WARN__
'}
=
sub
{
my
$err
=
$@
;
my
$err
=
$@
;
...
@@ -25,82 +18,9 @@ $SIG{'__WARN__'} = sub {
...
@@ -25,82 +18,9 @@ $SIG{'__WARN__'} = sub {
$@
=
$err
;
$@
=
$err
;
};
};
my
$cmdline
=
[
$0
,
@ARGV
];
my
$prepare
=
sub
{
my
%
daemon_options
=
(
max_workers
=>
3
,
restart_on_error
=>
5
,
stop_wait_time
=>
15
,
leave_children_open_on_reload
=>
1
,
);
my
$daemon
=
__PACKAGE__
->
new
('
pvedaemon
',
$cmdline
,
%
daemon_options
);
sub
prepare
{
# create dir for dtach sockets
# create dir for dtach sockets
mkdir
"
/var/run/dtach
";
mkdir
"
/var/run/dtach
";
}
sub
init
{
my
(
$self
)
=
@_
;
my
$accept_lock_fn
=
"
/var/lock/pvedaemon.lck
";
my
$lockfh
=
IO::
File
->
new
("
>>
${accept_lock_fn}
")
||
die
"
unable to open lock file '
${accept_lock_fn}
' - $!
\n
";
my
$socket
=
$self
->
create_reusable_socket
(
85
,
'
127.0.0.1
');
$self
->
{
server_config
}
=
{
base_handler_class
=>
'
PVE::API2
',
keep_alive
=>
100
,
max_conn
=>
500
,
max_requests
=>
1000
,
lockfile
=>
$accept_lock_fn
,
socket
=>
$socket
,
lockfh
=>
$lockfh
,
debug
=>
$self
->
{
debug
},
trusted_env
=>
1
,
};
}
sub
run
{
my
(
$self
)
=
@_
;
my
$server
=
PVE::
HTTPServer
->
new
(
%
{
$self
->
{
server_config
}});
$server
->
run
();
}
$daemon
->
register_start_command
();
$daemon
->
register_restart_command
(
1
);
$daemon
->
register_stop_command
();
$daemon
->
register_status_command
();
my
$cmddef
=
{
start
=>
[
__PACKAGE__
,
'
start
',
[]
],
restart
=>
[
__PACKAGE__
,
'
restart
',
[]
],
stop
=>
[
__PACKAGE__
,
'
stop
',
[]
],
status
=>
[
__PACKAGE__
,
'
status
',
[]
,
undef
,
sub
{
print
shift
.
"
\n
";}
],
};
};
my
$cmd
=
shift
;
PVE::Service::
pvedaemon
->
run_cli
(
undef
,
undef
,
$prepare
);
PVE::CLIHandler::
handle_cmd
(
$cmddef
,
$0
,
$cmd
,
\
@ARGV
,
undef
,
$0
,
\&
prepare
);
exit
(
0
);
__END__
=head1 NAME
pvedaemon - the PVE configuration server
=include synopsis
=head1 DESCRIPTION
All configuration is done using this Server. The Server only
listens to a local address 127.0.0.1 port 85 for security
reasons.
=include pve_copyright
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