Commit a420df10 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

refactor: doc sources

also skip bridge test when no root
parent 54f8d06b
......@@ -1633,7 +1633,7 @@ sub info($self, $user) {
$info->{cdrom} = \@cdrom;
$info->{requests} = $self->list_requests();
Ravada::Front::init_available_actions($user, $info);
Ravada::Front::_init_available_actions($user, $info);
return $info;
}
......@@ -4236,7 +4236,7 @@ sub _check_all_parents_in_node($self, $vm) {
last if !$base->id_base;
$base = Ravada::Domain->open($base->id_base);
push @bases,($base) if !$base->base_in_vm($vm->id)
|| !$base->base_files_in_vm($vm);
|| !$base->_base_files_in_vm($vm);
}
return 1 if !@bases;
my $req;
......@@ -4379,7 +4379,7 @@ sub base_in_vm($self,$id_vm) {
}
sub base_files_in_vm($self,$vm) {
sub _base_files_in_vm($self,$vm) {
$vm = Ravada::VM->open($vm) if !ref($vm);
for my $file ($self->list_files_base) {
return 0 if !$vm->file_exists($file);
......@@ -5382,6 +5382,19 @@ sub _domain_in_nodes($self) {
return $self->list_instances > 1;
}
=head2 compact
Compact volumes of a virtual machine. It creates a backup copy unless
specified in the request.
$domain->compact();
$comain->compact($request);
Usually called through Ravada::Request->compact();
=cut
sub compact($self, $request=undef) {
#first check if active, that will trigger status refresh
die "Error: ".$self->name." can't be compacted because it is active\n"
......@@ -5415,6 +5428,13 @@ sub compact($self, $request=undef) {
$self->_data('has_backups' => $self->_data('has_backups') +1 ) if $keep_backup;
}
=head2 purge
Purges old backup volumes of a virtual machine
=cut
sub purge($self, $request=undef) {
my $vm = $self->_vm->new ( host => 'localhost' );
for my $vol ( $self->list_volumes_info ) {
......
......@@ -218,7 +218,7 @@ sub list_machines($self, $user, @filter) {
return [sort { $a->{name} cmp $b->{name} } values %uniq];
}
sub init_available_actions($user, $m) {
sub _init_available_actions($user, $m) {
eval { $m->{can_shutdown} = $user->can_shutdown($m->{id}) };
$m->{can_start} = 0;
......@@ -240,7 +240,7 @@ sub init_available_actions($user, $m) {
sub _around_list_machines($orig, $self, $user, @filter) {
my $machines = $self->$orig($user, @filter);
for my $m (@$machines) {
init_available_actions($user, $m);
_init_available_actions($user, $m);
$m->{id_base} = undef if !exists $m->{id_base};
lock_hash(%$m);
}
......@@ -722,6 +722,14 @@ sub list_users($self,$name=undef) {
}
=head2 list_bases_network
Returns a reference to a list to all the bases in a network
my $list = $rvd_front->list_bases_network($id_network);
=cut
sub list_bases_network($self, $id_network) {
my $sth = $CONNECTOR->dbh->prepare("SELECT * FROM networks where name = 'default'");
$sth->execute;
......
......@@ -17,7 +17,7 @@ init();
############################################################
sub test_list_nats($vm) {
return if $<;
my @exp_nat = grep { defined $_ && !/^Name$/ }
map { /^\s+(\w+)\s*/; $1 }
split /\n/,`virsh net-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