Commit 183c8b40 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

fix list data domains works for json output

parent 8303e883
......@@ -208,15 +208,15 @@ List all domains in raw format. Return a list of id => { name , id , is_active ,
sub list_domains_data {
my $self = shift;
my @domains;
for ($self->list_domains()) {
push @domains,{ $_->id => { id => $_->id
, name => $_->name
,is_base => $_->is_base
,is_active => $_->is_active
}
for my $domain ($self->list_domains()) {
push @domains, { id => $domain->id
, name => $domain->name
,is_base => $domain->is_base
,is_active => $domain->is_active
}
}
return \@domains;
}
......
......@@ -155,7 +155,8 @@ sub is_base {
my $self = shift;
$self->_select_domain_db or return;
return $self->_data('is_base') =~ /y/i
return 1 if $self->_data('is_base') =~ /y/i;
return 0;
};
1;
......@@ -227,7 +227,7 @@ Returns whether the domain is running or not
sub is_active {
my $self = shift;
return $self->domain->is_active;
return ( $self->domain->is_active or 0);
}
=head2 start
......
......@@ -191,13 +191,14 @@ sub list_domains {
my @list;
for my $name ($self->vm->list_all_domains()) {
my $domain ;
my $id;
eval { $domain = Ravada::Domain::KVM->new(
domain => $name
,storage => $self->storage_pool
);
$domain->id();
$id = $domain->id();
};
push @list,($domain) if $domain;
push @list,($domain) if $domain && $id;
}
return @list;
}
......
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