Commit 2e4ef636 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#628] deal with volatile leftovers

parent 127aeb15
......@@ -217,19 +217,25 @@ sub _remove_old_domains_kvm {
my $base_name = base_domain_name();
for my $domain ( $vm->vm->list_all_domains ) {
next if $domain->get_name !~ /^$base_name/;
my $domain_name = $domain->get_name;
eval {
$domain->shutdown();
sleep 1;
$domain->destroy() if $domain->is_active;
eval { $domain->destroy() if $domain->is_active };
warn $@ if $@;
}
if $domain->is_active;
warn "WARNING: error $@ trying to shutdown ".$domain->get_name if $@;
warn "WARNING: error $@ trying to shutdown ".$domain_name
if $@ && $@ !~ /error code: 42,/;
$domain->managed_save_remove()
if $domain->has_managed_save_image();
eval {
$domain->managed_save_remove()
if $domain->has_managed_save_image();
};
warn $@ if $@ && $@ !~ /error code: 42,/;
eval { $domain->undefine };
warn $@ if $@;
warn $@ if $@ && $@ !~ /error code: 42,/;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment