Commit 1b35f678 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

Merge branch 'main' into test/no_download

parents fd7e7caf 1b15f31f
......@@ -2,15 +2,5 @@
**Implemented enhancements:**
- Review Create Machine form [\#1639]
- Translated using Weblate (Turkish)
- Translated using Weblate (Chinese (Simplified))
- Translated using Weblate (German)
- Added a log file for backend [\#1530]
- Improve description displayed when hovering over [\#1511]
**Bugfixes**
- Can't create machine from Windows iso [#1657]
- ISO file not showing in new machine form [#1660]
- Fix private base [#1652]
......@@ -17,7 +17,7 @@
,secrets => ['changeme1','changeme2']
,login_custom => ''
,footer => '/bootstrap/footer'
,login_bg_file => 'img/intro-bg.jpg'
,login_bg_file => '/img/intro-bg.jpg'
,login_message => 'Acme VDI service'
,monitoring => 0
,guide => ''
......
......@@ -3,7 +3,7 @@ package Ravada;
use warnings;
use strict;
our $VERSION = '1.1.2';
our $VERSION = '1.3.1';
use Carp qw(carp croak cluck);
use Data::Dumper;
......
......@@ -1103,3 +1103,9 @@ msgstr "Anònim"
msgid "This name is duplicated"
msgstr "Aquest nom està duplicat"
msgid "There are no active virtual machines"
msgstr "No hi han màquines virtuals actives"
msgid "reload list"
msgstr "torna a carregar la llista"
......@@ -1045,3 +1045,9 @@ msgstr "Pool"
msgid "Prepare this machine as a base to create clones from it."
msgstr "Prepare this machine as a base to create clones from it."
msgid "There are no active virtual machines"
msgstr "There are no active virtual machines"
msgid "reload list"
msgstr "reload list"
......@@ -414,9 +414,13 @@ ravadaApp.directive("solShowMachine", swMach)
$scope.hide_clones = true;
$scope.showClones = function(value){
$scope.auto_hide_clones = false;
$scope.show_active = false;
$scope.hide_clones = !value;
for (var i in $scope.list_machines){
mach = $scope.list_machines[i];
if (mach._level == 0 ) {
mach.show = true;
}
if (mach.is_base) {
$scope.toggle_show_clones(mach.id,value);
}
......@@ -548,16 +552,38 @@ ravadaApp.directive("solShowMachine", swMach)
}
};
$scope.do_show_active = function() {
$scope.show_active=true;
$scope.hide_clones = true;
$scope.n_active_hidden = 0;
var n_show = 0;
for (var [key, mach ] of Object.entries($scope.list_machines)) {
if (mach.status =='active') {
$scope.show_machine[mach.id_base] = true;
show_parents(mach);
mach.show = true;
n_show++;
} else {
mach.show = false;
}
}
$scope.show_active=true;
$scope.n_show = n_show;
};
$scope.reload_list = function() {
$scope.show_active=false;
$scope.hide_clones = true;
$scope.n_active_hidden = 0;
for (var [key, mach ] of Object.entries($scope.list_machines)) {
if (mach._level == 0 ) {
mach.show = true;
} else {
mach.show = false;
if (mach.status == 'active') {
$scope.n_active_hidden++;
}
}
}
};
//On load code
$scope.modalOpened=false;
$scope.rename= {new_name: 'new_name'};
......
......@@ -51,6 +51,7 @@ create_domain
start_node shutdown_node remove_node hibernate_node
start_domain_internal shutdown_domain_internal
hibernate_domain_internal
remove_domain_internal
remote_node
remote_node_2
remote_node_shared
......@@ -2007,6 +2008,16 @@ sub shutdown_domain_internal($domain) {
}
}
sub remove_domain_internal($domain) {
if ( $domain->type eq 'KVM') {
$domain->domain->undefine();
} elsif ($domain->type eq 'Void') {
unlink $domain->_config_file();
} else {
confess "I don't know how to remove ".$domain->name;
}
}
sub start_domain_internal($domain) {
if ($domain->type eq 'KVM') {
$domain->_set_spice_ip(1,$domain->_vm->ip);
......
......@@ -115,6 +115,31 @@ sub _remove_domain(@domain) {
}
}
sub test_remove_parent_already_removed($vm){
my $base = create_domain($vm->type);
$base->prepare_base(user_admin);
my $name = new_domain_name();
Ravada::Request->clone(
id_owner => user_admin->id
,uid => user_admin->id
,name => $name
,id_domain=> $base->id
);
wait_request();
my $clone = rvd_back->search_domain($name);
remove_domain_internal($base);
my $req = Ravada::Request->remove_domain(
uid => user_admin->id
,name => $clone->name
);
wait_request();
is($req->status,'done');
is($req->error, '');
my $clone2 = rvd_back->search_domain($name);
ok(!$clone2);
remove_domain($base);
}
##############################################################################
clean();
......@@ -138,6 +163,7 @@ for my $vm_name ( vm_names() ) {
diag("Testing remove on $vm_name");
test_remove_parent_already_removed($vm);
test_remove_rename($vm);
test_remove_domain($vm);
test_remove_domain_volumes_already_gone($vm);
......
......@@ -359,6 +359,67 @@ sub test_remove_clone($vm) {
}
sub test_pool_with_volatiles($vm) {
# Clones should be created.
# As are volatile, they should be started
# On shutdown they should be destroyed
# In a while new clones should appear to honor the pool
#
my $base = $BASE->clone(name => new_domain_name, user => user_admin);
$base->pools(1);
$base->volatile_clones(1);
$base->_data('shutdown_disconnected', 1);
my $n = 5;
$base->pool_clones($n);
$base->pool_start($n);
my $req = Ravada::Request->manage_pools(uid => user_admin->id
,_no_duplicate => 1);
wait_request( debug => 0);
is($req->status, 'done');
my @clones0 = $base->clones();
is(scalar @clones0, $n);
my @clones;
for my $c (@clones0) {
push @clones,(Ravada::Domain->open($c->{id}));
is($c->{status},'active');
is($c->{is_volatile},1);
is($c->{is_pool},1);
Ravada::Request->start_domain(
uid => user_admin->id
,id_domain => $c->{id}
,remote_ip => '1.2.3.4'
);
}
wait_request(debug => 0);
delete_request('start','create','clone');
for my $clone (@clones ) {
$clone->_data('client_status','disconnected');
}
for ( 1 .. 60 ) {
my $req_shutdown = Ravada::Request::_search_request(
'shutdown_domain'
);
wait_request(debug => 0);
last if $req_shutdown || scalar($base->clones()) < $n;
Ravada::Request->enforce_limits();
wait_request(debug => 0);
sleep 1;
}
ok(scalar($base->clones()) < $n, "Expecting less than $n up");
$req = Ravada::Request->manage_pools(uid => user_admin->id
,_no_duplicate => 1);
wait_request( debug => 0);
is($req->status, 'done');
is(scalar($base->clones()),$n);
remove_domain($base);
}
###############################################################
init();
......@@ -382,6 +443,8 @@ for my $vm_name (reverse vm_names() ) {
diag("*** Testing pools in $vm_name ***");
import_base($vm);
test_pool_with_volatiles($vm);
test_exposed_port($vm);
test_remove_clone($vm);
......
......@@ -24,10 +24,16 @@
<span class="badge badge-warning" ng-show="show_requests">hide</span>
</button>
<button type="button" class="btn btn-outline-primary btn-sm"
ng-click="do_show_active();"
ng-disabled="!n_active_hidden"
ng-disabled="!n_active || (!n_active_hidden && !show_active)"
>
<span><%=l 'Show active' %></span>
<span ng-show="!show_active"
ng-enabled="n_active"
ng-click="do_show_active();"
><%=l 'Show active' %></span>
<span ng-show="show_active"
ng-click="reload_list()"
><%=l 'Hide active' %></span>
<span class="badge badge-warning">{{n_active}}</span>
</button>
......
......@@ -280,6 +280,12 @@
</tr>
</tbody>
</table>
<div ng-cloak="1"
ng-show="list_machines && list_machines_time > 2 && show_active && !n_show">
<%=l 'There are no active virtual machines'%>
<button ng-click="reload_list()"><%=l 'reload list' %></button>
</div>
</div>
</div>
</div>
......
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