Commit 3b1cff56 authored by Roberto P. Rubio's avatar Roberto P. Rubio
Browse files

Espacios en blanco

parent e6b4607e
......@@ -3757,7 +3757,7 @@ sub _cmd_list_network_interfaces($self, $request) {
sub _cmd_list_isos($self, $request){
my $vm_type = $request->args('vm_type');
my $vm = Ravada::VM->open( type => $vm_type );
$vm->refresh_storage();
my @isos = sort { "\L$a" cmp "\L$b" } $vm->search_volume_path_re(qr(.*\.iso$));
......
......@@ -429,7 +429,7 @@ sub can_list_clones {
return 1 if $self->can_remove_clone_all()
|| $self->can_list_machines();
return 0;
}
=head2 can_list_machines
......@@ -534,9 +534,9 @@ Arguments: password
sub compare_password {
my $self = shift;
my $password = shift or die "ERROR: password required\n";
_init_connector();
my $sth= $$CON->dbh->prepare("SELECT password FROM users WHERE name=?");
$sth->execute($self->name);
my $hex_pass = $sth->fetchrow();
......@@ -594,7 +594,7 @@ sub remove($self) {
Returns if the user is allowed to perform a privileged action
if ($user->can_do("remove")) {
if ($user->can_do("remove")) {
...
=cut
......@@ -798,7 +798,7 @@ sub revoke_all_permissions($self,$user) {
Grant an user a specific permission, or revoke it
$admin_user->grant($user2,"clone"); # both are
$admin_user->grant($user2,"clone"); # both are
$admin_user->grant($user3,"clone",1); # the same
$admin_user->grant($user4,"clone",0); # revoke a grant
......@@ -940,7 +940,7 @@ sub can_manage_machine($self, $domain) {
|| ($self->can_remove_clone_all && $domain->id_base)
|| ($self->can_remove && $domain->id_owner == $self->id);
if ( ($self->can_remove_clones || $self->can_change_settings_clones || $self->can_rename_clones)
if ( ($self->can_remove_clones || $self->can_change_settings_clones || $self->can_rename_clones)
&& $domain->id_base ) {
my $base = Ravada::Front::Domain->open($domain->id_base);
return 1 if $base->id_owner == $self->id;
......
......@@ -819,7 +819,7 @@ sub _pre_prepare_base($self, $user, $request = undef ) {
# TODO: if disk is not base and disks have not been modified, do not generate them
# again, just re-attach them
# again, just re-attach them
# $self->_check_disk_modified(
confess "ERROR: domain ".$self->name." is already a base" if $self->is_base();
$self->_check_has_clones();
......@@ -986,7 +986,7 @@ sub _check_cpu_usage($self, $request=undef){
chomp(my $cpu_count = `grep -c -P '^processor\\s+:' /proc/cpuinfo`);
die "Error: Too many active domains." if (scalar $self->_vm->vm->list_domains() >= $self->_vm->active_limit);
}
my @cpu;
my $msg;
for ( 1 .. 10 ) {
......@@ -2215,7 +2215,7 @@ sub _pre_remove_base {
my ($domain) = @_;
_allow_manage(@_);
_check_has_clones(@_);
if (!$domain->is_local) {
my $vm_local = $domain->_vm->new( host => 'localhost' );
confess "Error: I can't find local virtual manager ".$domain->type
......@@ -2489,7 +2489,7 @@ sub _post_shutdown {
id_domain => $self->id
,id_vm => $self->_vm->id
, uid => $arg{user}->id
, at => time+$timeout
, at => time+$timeout
);
}
if ($self->is_volatile) {
......@@ -3640,7 +3640,7 @@ sub get_controller {
my $sub = $self->get_controller_by_name($name);
# my $sub = $GET_CONTROLLER_SUB{$name};
die "I can't get controller $name for domain ".$self->name
if !$sub;
......
......@@ -1989,12 +1989,12 @@ sub _set_controller_usb($self,$numero, $data={}) {
$numero = $count+1 if !defined $numero;
if ( $numero > $count ) {
my $missing = $numero-$count-1;
for my $i (0..$missing) {
my $controller = $devices->addNewChild(undef,"redirdev");
$controller->setAttribute(bus => 'usb');
$controller->setAttribute(type => $tipo );
}
}
}
$self->_vm->connect if !$self->_vm->vm;
my $new_domain = $self->_vm->vm->define_domain($doc->toString);
......@@ -2025,7 +2025,7 @@ sub _set_controller_network($self, $number, $data) {
sub remove_controller($self, $name, $index=0) {
my $sub = $REMOVE_CONTROLLER_SUB{$name};
die "I can't get controller $name for domain ".$self->name
." ".$self->type
."\n".Dumper(\%REMOVE_CONTROLLER_SUB)
......
......@@ -579,7 +579,7 @@ sub set_max_memory {
sub set_memory {
my $self = shift;
my $value = shift;
$self->_set_info(memory => $value );
}
......
......@@ -211,7 +211,7 @@ sub list_machines($self, $user, @filter) {
push @list,(@{filter_base_without_clones($self->list_domains(@filter))}) if $user->can_list_clones();
push @list,(@{$self->_list_own_clones($user)}) if $user->can_list_clones_from_own_base();
push @list,(@{$self->_list_own_machines($user)}) if $user->can_list_own_machines();
return [@list] if scalar @list < 2;
my %uniq = map { $_->{name} => $_ } @list;
......@@ -221,13 +221,13 @@ sub list_machines($self, $user, @filter) {
sub init_available_actions($user, $m) {
eval { $m->{can_shutdown} = $user->can_shutdown($m->{id}) };
$m->{can_start} = 0;
$m->{can_start} = 1 if $m->{id_owner} == $user->id || $user->is_admin;
$m->{can_start} = 0;
$m->{can_start} = 1 if $m->{id_owner} == $user->id || $user->is_admin;
$m->{can_reboot} = $m->{can_shutdown} && $m->{can_start};
$m->{can_view} = 0;
$m->{can_view} = 1 if $m->{id_owner} == $user->id || $user->is_admin;
$m->{can_view} = 0;
$m->{can_view} = 1 if $m->{id_owner} == $user->id || $user->is_admin;
$m->{can_manage} = ( $user->can_manage_machine($m->{id}) or 0);
eval {
......@@ -235,8 +235,9 @@ sub init_available_actions($user, $m) {
};
die $@ if $@ && $@ !~ /Unknown domain/;
$m->{can_hibernate} = 0;
$m->{can_hibernate} = 1 if $user->can_shutdown($m->{id}) && !$m->{is_volatile};
$m->{can_hibernate} = 0;
$m->{can_hibernate} = 1 if $user->can_shutdown($m->{id})
&& !$m->{is_volatile};
}
sub _around_list_machines($orig, $self, $user, @filter) {
......@@ -261,7 +262,7 @@ sub search_clone_data {
$sth->execute( map { $args{$_} } sort keys %args );
my $row = $sth->fetchrow_hashref;
return ( $row or {});
}
=cut
......@@ -414,7 +415,7 @@ sub _where(%args) {
sub list_clones {
my $self = shift;
my %args = @_;
my $domains = $self->list_domains();
my @clones;
for (@$domains ) {
......@@ -667,7 +668,7 @@ Returns a reference to a list of the users
sub list_users($self,$name=undef) {
my $sth = $CONNECTOR->dbh->prepare("SELECT id, name FROM users ");
$sth->execute();
my @users = ();
while ( my $row = $sth->fetchrow_hashref) {
next if defined $name && $row->{name} !~ /$name/;
......@@ -698,7 +699,7 @@ Waits for a request for some seconds.
=head3 Arguments
=over
=over
=item * request
......@@ -1085,7 +1086,7 @@ sub list_bases_anonymous {
}
=head2 disconnect_vm
=head2 disconnect_vm
Disconnects all the conneted VMs
......
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