Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
ffde4f62
Commit
ffde4f62
authored
Jul 19, 2017
by
Francesc Guasch
Browse files
[#265] remove iptables from inactive domains
parent
f602a76d
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Ravada/Domain.pm
View file @
ffde4f62
...
...
@@ -428,6 +428,12 @@ sub open($class, $id) {
my
$row
=
$self
->
_select_domain_db
(
id
=>
$id
);
die
"
Domain id =
$id
not found
"
if
!
keys
%$row
;
die
"
Domain
"
.
$row
->
{
name
}
.
"
has no VM
"
.
Dumper
(
$row
)
if
!
$row
->
{
vm
};
my
$vm0
=
{};
my
$vm_class
=
"
Ravada::VM::
"
.
$row
->
{
vm
};
bless
$vm0
,
$vm_class
;
...
...
@@ -1203,17 +1209,26 @@ sub _remove_iptables {
# clean iptables left from down domains
sub
_clean_iptables
{
my
$self
=
shift
;
my
$sth
=
$$CONNECTOR
->
dbh
->
prepare
(
"
SELECT id,id_domain,iptables FROM iptables
"
.
"
WHERE time_deleted IS NULL
"
);
my
$sth_delete
=
$$CONNECTOR
->
dbh
->
prepare
(
"
DELETE FROM iptables WHERE id=?
"
);
my
(
$id
,
$id_domain
,
$iptables
);
$sth
->
bind_columns
(
\
(
$id
,
$id_domain
,
$iptables
));
$sth
->
execute
;
$sth
->
bind_columns
(
\
(
$id
,
$id_domain
,
$iptables
));
while
(
$sth
->
fetch
)
{
my
$domain
=
Ravada::
Domain
->
open
(
$id_domain
);
my
$domain
;
eval
{
$domain
=
Ravada::
Domain
->
open
(
$id_domain
)
};
warn
$@
if
$@
&&
$@
!~
/Domain.*not found/i
;
if
(
!
$domain
)
{
$sth_delete
->
execute
(
$id
);
next
;
}
next
if
$domain
->
is_active
;
$domain
->
_remove_iptables
();
}
...
...
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