Unverified Commit 3d7cb57c authored by Francesc Guasch's avatar Francesc Guasch Committed by GitHub
Browse files

Merge ISO files and pool fix (#1452)

parent b83a08ac
......@@ -3122,8 +3122,9 @@ sub _cmd_open_iptables {
sub _cmd_clone($self, $request) {
return _req_clone_many($self, $request) if $request->defined_arg('number')
&& $request->defined_arg('number') > 1;
return _req_clone_many($self, $request)
if ( $request->defined_arg('number') && $request->defined_arg('number') > 1)
|| (! $request->defined_arg('name') && $request->defined_arg('add_to_pool'));
my $domain = Ravada::Domain->open($request->args('id_domain'))
or confess "Error: Domain ".$request->args('id_domain')." not found";
......
......@@ -281,6 +281,48 @@ sub test_no_pool($vm) {
wait_request( debug => 0);
}
sub test_remove_clone($vm) {
my $base;
if ($vm->type eq 'KVM') {
my $base0 = import_domain( $vm->type , 'zz-test-base-alpine');
$base = $base0->clone(name => new_domain_name , user => user_admin);
}
$base = create_domain($vm) if !$base;
$base->pools(1);
$base->volatile_clones(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 $req_refresh = Ravada::Request->refresh_vms( _no_duplicate => 1);
wait_request( debug => 0);
is($req_refresh->status, 'done');
my @clones = $base->clones();
is(scalar @clones, $n);
Ravada::Domain->open($clones[0]->{id})->remove(user_admin);
is(scalar($base->clones()),$n-1);
warn Dumper([map { $_->{name}." ".$_->{status} } $base->clones]);
$req = Ravada::Request->manage_pools(uid => user_admin->id, _no_duplicate => 1);
wait_request();
is($req->status, 'done');
ok(Dumper([map { $_->{name} } $base->clones]));
for my $clone ( $base->clones ) {
like($clone->{name},qr/-\d+$/);
Ravada::Domain->open($clone->{id})->remove(user_admin);
}
$base->remove(user_admin);
}
###############################################################
init();
clean();
......@@ -301,6 +343,7 @@ for my $vm_name (reverse vm_names() ) {
diag("*** Testing pools in $vm_name ***");
test_remove_clone($vm);
test_duplicate_req();
test_no_pool($vm);
......
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