Browse files

Tidy up Xapi_vm_helpers.set_is_a_template

Logic still unchanged:

$ camlp4o -printer o -no_comments ocaml/xapi/xapi_vm_helpers.ml | md5sum
724bf5c5243b281979f41ff2f24831c5  -

Signed-off-by: John Else <john.else@citrix.com>
  • Loading branch information...
1 parent abf5c02 commit f8425aeb7f5f35ec0aadefe06c7ecf6e90f3ffbf @johnelse johnelse committed Nov 16, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 ocaml/xapi/xapi_vm_helpers.ml
View
12 ocaml/xapi/xapi_vm_helpers.ml
@@ -40,13 +40,13 @@ let set_is_a_template ~__context ~self ~value =
(* We define a 'set_is_a_template false' as 'install time' *)
info "VM.set_is_a_template('%b')" value;
let m = Db.VM.get_metrics ~__context ~self in
- if not(value) then begin
- (try Db.VM_metrics.set_install_time ~__context ~self:m ~value:(Date.of_float (Unix.gettimeofday ()))
- with _ -> warn "Could not update VM install time because metrics object was missing")
- end else (
+ if not value then begin
+ try Db.VM_metrics.set_install_time ~__context ~self:m ~value:(Date.of_float (Unix.gettimeofday ()))
+ with _ -> warn "Could not update VM install time because metrics object was missing"
+ end else begin
(* delete the vm metrics associated with the vm if it exists, when we templat'ize it *)
- (try Db.VM_metrics.destroy ~__context ~self:m with _ -> ())
- );
+ try Db.VM_metrics.destroy ~__context ~self:m with _ -> ()
+ end;
Db.VM.set_is_a_template ~__context ~self ~value
let create ~__context ~name_label ~name_description

0 comments on commit f8425ae

Please sign in to comment.