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
0527c925
Commit
0527c925
authored
Oct 22, 2014
by
Stefan Priebe
Committed by
Dietmar Maurer
Oct 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VZDump: send an error email in case of lock failure
Signed-off-by:
Stefan Priebe
<
s.priebe@profihost.ag
>
parent
1b07946c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
VZDump.pm
PVE/API2/VZDump.pm
+7
-1
VZDump.pm
PVE/VZDump.pm
+8
-7
No files found.
PVE/API2/VZDump.pm
View file @
0527c925
...
...
@@ -122,7 +122,13 @@ __PACKAGE__->register_method ({
die
"
interrupted by signal
\n
";
};
$vzdump
->
getlock
();
# only one process allowed
eval
{
$vzdump
->
getlock
();
# only one process allowed
};
if
(
$@
)
{
$vzdump
->
sendmail
(
[]
,
0
,
$@
);
exit
(
-
1
);
}
if
(
defined
(
$param
->
{
ionice
}))
{
if
(
$param
->
{
ionice
}
>
7
)
{
...
...
PVE/VZDump.pm
View file @
0527c925
...
...
@@ -243,8 +243,8 @@ sub find_add_exclude {
}
}
my
$sendmail
=
sub
{
my
(
$self
,
$tasklist
,
$totaltime
)
=
@_
;
sub
sendmail
{
my
(
$self
,
$tasklist
,
$totaltime
,
$err
)
=
@_
;
my
$opts
=
$self
->
{
opts
};
...
...
@@ -268,7 +268,8 @@ my $sendmail = sub {
}
}
my
$stat
=
$ecount
?
'
backup failed
'
:
'
backup successful
';
my
$stat
=
(
$ecount
||
$err
)
?
'
backup failed
'
:
'
backup successful
';
$stat
.=
"
:
$err
"
if
$err
;
my
$hostname
=
`
hostname -f
`
||
PVE::INotify::
nodename
();
chomp
$hostname
;
...
...
@@ -596,7 +597,7 @@ sub getlock {
if
(
!
open
(
SERVER_FLCK
,
"
>>
$lockfile
"))
{
debugmsg
('
err
',
"
can't open lock on file '
$lockfile
' - $!
",
undef
,
1
);
exit
(
-
1
)
;
die
"
can't open lock on file '
$lockfile
' - $!
"
;
}
if
(
flock
(
SERVER_FLCK
,
LOCK_EX
|
LOCK_NB
))
{
...
...
@@ -605,7 +606,7 @@ sub getlock {
if
(
!
$maxwait
)
{
debugmsg
('
err
',
"
can't aquire lock '
$lockfile
' (wait = 0)
",
undef
,
1
);
exit
(
-
1
)
;
die
"
can't aquire lock '
$lockfile
' (wait = 0)
"
;
}
debugmsg
('
info
',
"
trying to get global lock - waiting...
",
undef
,
1
);
...
...
@@ -629,7 +630,7 @@ sub getlock {
if
(
$err
)
{
debugmsg
('
err
',
"
can't aquire lock '
$lockfile
' -
$err
",
undef
,
1
);
exit
(
-
1
)
;
die
"
can't aquire lock '
$lockfile
' -
$err
"
;
}
debugmsg
('
info
',
"
got global lock
",
undef
,
1
);
...
...
@@ -1068,7 +1069,7 @@ sub exec_backup {
my
$totaltime
=
time
()
-
$starttime
;
eval
{
$self
->
$
sendmail
(
$tasklist
,
$totaltime
);
};
eval
{
$self
->
sendmail
(
$tasklist
,
$totaltime
);
};
debugmsg
('
err
',
$@
)
if
$@
;
die
$err
if
$err
;
...
...
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