[Libguestfs] [PATCH 1/3] sysprep: Perform operations in alphabetical order.

Richard W.M. Jones rjones at redhat.com
Fri Mar 21 13:37:32 UTC 2014


Previously we ran them in essentially a random order, although it
might have looked alphabetical in some cases because the modules are
loaded in order.
---
 sysprep/sysprep_operation.ml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sysprep/sysprep_operation.ml b/sysprep/sysprep_operation.ml
index 703bcc7..6d878b8 100644
--- a/sysprep/sysprep_operation.ml
+++ b/sysprep/sysprep_operation.ml
@@ -51,6 +51,8 @@ and extra_arg = {
   extra_pod_description : string;
 }
 
+let compare_operations { name = n1 } { name = n2 } = compare n1 n2
+
 let defaults = {
   name = "";
   enabled_by_default = false;
@@ -277,6 +279,9 @@ let perform_operations_on_filesystems ?operations ?(quiet = false) g root
     | Some opset -> (* just the operation names listed *)
       OperationSet.elements opset in
 
+  (* Perform the operations in alphabetical, rathern than random order. *)
+  let ops = List.sort compare_operations ops in
+
   List.iter (
     function
     | { name = name; perform_on_filesystems = Some fn } ->
@@ -296,6 +301,9 @@ let perform_operations_on_devices ?operations ?(quiet = false) g root
     | Some opset -> (* just the operation names listed *)
       OperationSet.elements opset in
 
+  (* Perform the operations in alphabetical, rathern than random order. *)
+  let ops = List.sort compare_operations ops in
+
   List.iter (
     function
     | { name = name; perform_on_devices = Some fn } ->
-- 
1.8.5.3




More information about the Libguestfs mailing list