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

Merge branch '678_volatile_clones'

parents 0c880932 5f0a051a
......@@ -1068,7 +1068,7 @@ sub _create_vm {
);
my @vms = ();
my $err;
my $err='';
for my $vm_name (keys %VALID_VM) {
my $vm;
......
......@@ -1892,6 +1892,8 @@ sub set_option($self, $option, $value) {
$self->description($value);
} elsif ($option eq 'run_timeout') {
$self->run_timeout($value);
} elsif ($option eq 'volatile_clones') {
$self->volatile_clones($value);
} else {
confess "ERROR: Unknown option '$option'";
}
......
......@@ -70,6 +70,8 @@ sub is_active($self) {
return 0;
}
sub is_volatile_clones($self) { return $self->_data('volatile_clones')}
sub is_hibernated($self) {
return 1 if $self->_data('status') eq 'hibernated';
return 0;
......
......@@ -1439,8 +1439,8 @@ sub settings_machine {
}
}
for my $option (qw(description run_timeout)) {
if ( defined $c->param($option) ) {
for my $option (qw(description run_timeout volatile_clones)) {
if ( defined $c->param($option) && defined $c->param("submitbtn") ) {
return access_denied($c)
if $option eq 'run_timeout' && !$USER->is_admin;
......@@ -1448,6 +1448,10 @@ sub settings_machine {
$value *= 60 if $option eq 'run_timeout';
$domain->set_option($option, $value);
$c->stash(message => "\U$option changed!");
}elsif ( $option eq 'volatile_clones' && defined $c->param("submitbtn") ) {
my $value = '0';
$domain->set_option($option, $value);
$c->stash(message => "\U$option changed!");
}
}
......
......@@ -3,7 +3,7 @@
<form class="form-inline" action="<%= $action %>" method="post">
<div class="row">
<div class="col-md-2">
<div class="col-md-4">
<label class="control-label" for="ram"><%=l 'Memory' %></label>
</div>
<div class="col-md-2">
......@@ -16,7 +16,7 @@
</div>
</div>
<div class="row">
<div class="col-md-2">
<div class="col-md-4">
<label class="control-label" for="timeout">Timeout</label>
</div>
<div class="col-md-2">
......@@ -28,8 +28,24 @@
</div>
<div class="col-md-6"><%=l 'The machine will shutdown after these minutes' %></div>
</div>
<input type="submit">
<button type="reset" ><%=l 'Cancel' %></button>
<div class="row">
<div class="col-md-4">
<label class="control-label" for="volatile_clones">Enable Volatile Clones</label>
</div>
<div class="col-md-2">
<input type="checkbox" name="volatile_clones"
% my $vclones = int($domain->is_volatile_clones);
% if ( $vclones ){
checked
% }
value="1">
</div>
<div class="col-md-6">
Clones created from this machine will be removed on shutdown.
</div>
</div>
<input type="submit" name="submitbtn">
<button type="reset" >Cancel</button>
</form>
</div><!-- of form-group -->
</div><!-- of panel-body -->
Markdown is supported
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