summaryrefslogtreecommitdiffstats
path: root/sysprep/main.ml
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-07-25 14:17:42 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-07-25 14:47:15 +0100
commit2b59b5f1d2e36b0ef84b7c7c9ab2c4b602f2ad91 (patch)
tree8aefb9bc2bfb2eee1f851bfdc4655e4dada14777 /sysprep/main.ml
parent1fb95e65661f19c050b928694f750f2406eff2ac (diff)
downloadlibguestfs-2b59b5f1d2e36b0ef84b7c7c9ab2c4b602f2ad91.tar.gz
libguestfs-2b59b5f1d2e36b0ef84b7c7c9ab2c4b602f2ad91.tar.xz
libguestfs-2b59b5f1d2e36b0ef84b7c7c9ab2c4b602f2ad91.zip
sysprep: Change perform callback to perform_on_filesystems and perform_on_devices.
Operations that need to work directly on guest block devices will fail because the block devices are busy. Therefore add a phase with the filesystems unmounted, and allow operations to specify that they need to work in this phase.
Diffstat (limited to 'sysprep/main.ml')
-rw-r--r--sysprep/main.ml15
1 files changed, 12 insertions, 3 deletions
diff --git a/sysprep/main.ml b/sysprep/main.ml
index 4c3f9700..fbe0dbc4 100644
--- a/sysprep/main.ml
+++ b/sysprep/main.ml
@@ -207,9 +207,10 @@ let () =
with Guestfs.Error msg -> eprintf (f_"%s (ignored)\n") msg
) mps;
- (* Perform the operations. *)
+ (* Perform the filesystem operations. *)
let flags =
- Sysprep_operation.perform_operations ?operations ~quiet g root in
+ Sysprep_operation.perform_operations_on_filesystems
+ ?operations ~quiet g root in
(* Parse flags. *)
let relabel = ref false in
@@ -234,7 +235,15 @@ let () =
);
(* Unmount everything in this guest. *)
- g#umount_all ()
+ g#umount_all ();
+
+ (* Perform the block device operations. *)
+ let flags =
+ Sysprep_operation.perform_operations_on_devices
+ ?operations ~quiet g root in
+
+ (* At present we don't support any flags from perform_on_devices. *)
+ assert (flags = [])
) roots
(* Finished. *)