[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 1 of 2] quicktest constantly refers to debian when actually it just means a test VM of some sort



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1266933755 0
# Node ID c2451b90ad70f2756c93f00ddf23895e10033ac0
# Parent  3aa6f20e82bc29abd85a29610825eff0319f668c
quicktest constantly refers to debian when actually it just means a test VM of 
some sort.

Rename the variables etc which refer to Debian to ease changing the
actual template which is used (but don't actually change the template).

diff -r 3aa6f20e82bc -r c2451b90ad70 ocaml/xapi/quicktest.ml
--- a/ocaml/xapi/quicktest.ml   Tue Feb 23 14:02:35 2010 +0000
+++ b/ocaml/xapi/quicktest.ml   Tue Feb 23 14:02:35 2010 +0000
@@ -433,7 +433,7 @@
   finally
     (fun () ->
        (* We play with three VMs:
-         1. a clean install of debian                       (vm)
+         1. a clean install of a VM                         (vm)
          2. a suspended clone of (1)                        (vm')
          3. a metadata import of the metadata export of (2) (vm'')
        *)
@@ -602,36 +602,36 @@
 let make_vif ~session_id ~vM ~network ~device = 
   Client.VIF.create ~rpc:!rpc ~session_id ~vM ~network ~mTU:0L ~mAC:"" ~device 
~other_config:["promiscuous", "on"; "mtu", "1400"] ~qos_algorithm_type:"" 
~qos_algorithm_params:[] 
 
-let with_debian s f = 
+let with_vm s f = 
   try
-    let (_: API.ref_VM) = find_template s debian_etch in
-    let test = make_test "Setting up debian VM" 0 in
+    let (_: API.ref_VM) = find_template s vm_template in
+    let test = make_test "Setting up test VM" 0 in
     start test;
-    let debian = install_debian test s in
-       f s debian;
-       vm_uninstall test s debian;
+    let vm = install_vm test s in
+       f s vm;
+       vm_uninstall test s vm;
        success test
-  with Unable_to_find_suitable_debian_template ->
+  with Unable_to_find_suitable_vm_template ->
     (* SKIP *)
     ()
 
-let vm_powercycle_test s debian = 
+let vm_powercycle_test s vm = 
   let test = make_test "VM powercycle test" 1 in
   start test;
   (* Try to add some VIFs *)
   let (guest_installer_network: API.ref_network) = 
find_guest_installer_network s in
   debug test (Printf.sprintf "Adding VIF to guest installer network (%s)" 
(Client.Network.get_uuid !rpc s guest_installer_network));
-  let (_: API.ref_VIF) = make_vif ~session_id:s ~vM:debian 
~network:guest_installer_network ~device:"0" in
+  let (_: API.ref_VIF) = make_vif ~session_id:s ~vM:vm 
~network:guest_installer_network ~device:"0" in
   begin match Client.PIF.get_all !rpc s with
   | pif :: _ ->
                let net = Client.PIF.get_network !rpc s pif in
                debug test (Printf.sprintf "Adding VIF to physical network 
(%s)" (Client.Network.get_uuid !rpc s net));
-               let (_: API.ref_VIF) = make_vif ~session_id:s ~vM:debian 
~network:net ~device:"1" in
+               let (_: API.ref_VIF) = make_vif ~session_id:s ~vM:vm 
~network:net ~device:"1" in
                ()
   | _ -> ()
   end;
-  vbd_pause_unpause_test s debian;
-  powercycle_test s debian;
+  vbd_pause_unpause_test s vm;
+  powercycle_test s vm;
   success test
 
 
@@ -681,9 +681,9 @@
          maybe_run_test "vdi" (fun () -> vdi_test s);
          maybe_run_test "async" (fun () -> async_test s);
          maybe_run_test "import" (fun () -> import_export_test s);
-         maybe_run_test "vhd" (fun () -> with_debian s test_vhd_locking_hook);
-         maybe_run_test "powercycle" (fun () -> with_debian s 
vm_powercycle_test);
-         maybe_run_test "lifecycle" (fun () -> with_debian s 
Quicktest_lifecycle.test);
+         maybe_run_test "vhd" (fun () -> with_vm s test_vhd_locking_hook);
+         maybe_run_test "powercycle" (fun () -> with_vm s vm_powercycle_test);
+         maybe_run_test "lifecycle" (fun () -> with_vm s 
Quicktest_lifecycle.test);
 
        with
        | Api_errors.Server_error (a,b) ->
diff -r 3aa6f20e82bc -r c2451b90ad70 ocaml/xapi/quicktest_common.ml
--- a/ocaml/xapi/quicktest_common.ml    Tue Feb 23 14:02:35 2010 +0000
+++ b/ocaml/xapi/quicktest_common.ml    Tue Feb 23 14:02:35 2010 +0000
@@ -164,10 +164,10 @@
   if List.length pool <> 1 then (failwith "Number of pools isn't zero!");
   List.hd pool
 
-let debian_etch = "Debian Etch"
+let vm_template = "Debian Etch"
 let other = "Other install media"
 
-exception Unable_to_find_suitable_debian_template
+exception Unable_to_find_suitable_vm_template
 
 let find_template session_id startswith = 
   let vms = Client.VM.get_all !rpc session_id in
@@ -175,7 +175,7 @@
                       (String.startswith startswith (Client.VM.get_name_label 
!rpc session_id self))
                       && (Client.VM.get_is_a_template !rpc session_id self)
                    ) vms with
-  | [] -> raise Unable_to_find_suitable_debian_template
+  | [] -> raise Unable_to_find_suitable_vm_template
   | x :: _ ->
       (* Printf.printf "Choosing template with name: %s\n" 
(Client.VM.get_name_label !rpc session_id x); *)
        x 
@@ -226,8 +226,8 @@
   let newvm_uuids = String.split ',' (cli_cmd test args) in
   List.map (fun uuid -> Client.VM.get_by_uuid !rpc session_id uuid) newvm_uuids
 
-let install_debian test session_id = 
-  let t = find_template session_id debian_etch in
+let install_vm test session_id = 
+  let t = find_template session_id vm_template in
   let uuid = Client.VM.get_uuid !rpc session_id t in
   debug test (Printf.sprintf "Template has uuid: %s%!" uuid);
   let vm = vm_install test session_id uuid "quicktest" in
diff -r 3aa6f20e82bc -r c2451b90ad70 ocaml/xapi/quicktest_lifecycle.ml
--- a/ocaml/xapi/quicktest_lifecycle.ml Tue Feb 23 14:02:35 2010 +0000
+++ b/ocaml/xapi/quicktest_lifecycle.ml Tue Feb 23 14:02:35 2010 +0000
@@ -108,7 +108,7 @@
 open Client
 open Pervasiveext
 
-let one s debian test = 
+let one s vm test = 
   let t = make_test (string_of_test test) 1 in
   start t;
   let event = "/tmp/fist_disable_event_lifecycle_path" in
@@ -133,16 +133,16 @@
                                         Unixext.unlink_safe sync;
                                         Unixext.unlink_safe event
                         end;
-                          if Client.VM.get_power_state !rpc s debian = `Halted
-                          then Client.VM.start !rpc s debian false false;
+                          if Client.VM.get_power_state !rpc s vm = `Halted
+                          then Client.VM.start !rpc s vm false false;
                           
                           let call_api = function
-                                | Shutdown Clean -> Client.VM.clean_shutdown 
!rpc s debian
-                                | Shutdown Hard -> Client.VM.hard_shutdown 
!rpc s debian
-                                | Reboot Clean -> Client.VM.clean_reboot !rpc 
s debian
-                                | Reboot Hard -> Client.VM.hard_reboot !rpc s 
debian in
+                                | Shutdown Clean -> Client.VM.clean_shutdown 
!rpc s vm
+                                | Shutdown Hard -> Client.VM.hard_shutdown 
!rpc s vm
+                                | Reboot Clean -> Client.VM.clean_reboot !rpc 
s vm
+                                | Reboot Hard -> Client.VM.hard_reboot !rpc s 
vm in
                           
-                          let domid = Client.VM.get_domid !rpc s debian in
+                          let domid = Client.VM.get_domid !rpc s vm in
                           begin match test with
                           | { api = None; parallel_op = Some x } ->
                                         let reason = match x with
@@ -173,7 +173,7 @@
                                 let start = Unix.gettimeofday () in
                                 let finished = ref false in
                                 while Unix.gettimeofday () -. start < 300. && 
(not !finished) do
-                                  finished := p (Client.VM.get_domid !rpc s 
debian);
+                                  finished := p (Client.VM.get_domid !rpc s 
vm);
                                         if not !finished then Thread.delay 1.
                                 done;
                                 if not !finished then failwith "timeout"
@@ -195,5 +195,5 @@
          );
   success t
 
-let test s debian = 
-  List.iter (one s debian) all_valid_tests
+let test s vm = 
+  List.iter (one s vm) all_valid_tests

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.