Skip to content

Commit

Permalink
[UPC#441] check args and show info in request
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol committed Nov 27, 2017
1 parent 3d4b111 commit 9072cb1
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions lib/Ravada/Domain.pm
Original file line number Diff line number Diff line change
Expand Up @@ -996,20 +996,32 @@ sub clone {
my $self = shift;
my %args = @_;

my $name = $args{name} or confess "ERROR: Missing domain cloned name";
confess "ERROR: Missing request user" if !$args{user};
my $name = delete $args{name}
or confess "ERROR: Missing domain cloned name";

my $user = delete $args{user}
or confess "ERROR: Missing request user";

return $self->_copy_clone(@_) if $self->id_base();

my $uid = $args{user}->id;
my $request = delete $args{request};
my $memory = delete $args{memory};

confess "ERROR: Unknown args ".join(",",sort keys %args)
if keys %args;

my $uid = $user->id;

$self->prepare_base($args{user}) if !$self->is_base();
if ( !$self->is_base() ) {
$request->status("working","Preparing base") if $request;
$self->prepare_base($user)
}

my $id_base = $self->id;

my @args_copy = ();
push @args_copy, ( memory => $args{memory} ) if $args{memory};
push @args_copy, ( request => $args{request} ) if $args{request};
push @args_copy, ( memory => $memory ) if $memory;
push @args_copy, ( request => $request ) if $request;

my $clone = $self->_vm->create_domain(
name => $name
Expand Down Expand Up @@ -1037,7 +1049,8 @@ sub _copy_clone($self, %args) {
push @copy_arg, ( memory => $memory ) if $memory;

$request->status("working","Copying domain ".$self->name
." to $name");
." to $name") if $request;

my $copy = $self->_vm->create_domain(
name => $name
,id_base => $base->id
Expand Down

0 comments on commit 9072cb1

Please sign in to comment.