[Pkg-libvirt-commits] [libguestfs] 33/72: convert_windows: split firstboot into steps

Hilko Bengen bengen at moszumanska.debian.org
Sun Apr 5 15:19:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit fde25b9dd3d4bafd4d4c71330091def62be62652
Author: Roman Kagan <rkagan at parallels.com>
Date:   Fri Feb 27 15:20:18 2015 +0300

    convert_windows: split firstboot into steps
    
    Instead of doing all firstboot actions in a single script, take the
    advantage of the firstboot infrastructure and store and run unrelated
    actions as individual steps.
    
    This facilitates troubleshooting and fault recovery; besides it makes
    adding more actions easier.
    
    Signed-off-by: Roman Kagan <rkagan at parallels.com>
    (cherry picked from commit 6c7823b9a9da72a9443fdb01caef65c4efed1a1d)
---
 v2v/convert_windows.ml | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index f0378b6..55d45ea 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -140,17 +140,10 @@ let convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
   (* Perform the conversion of the Windows guest. *)
 
   let rec configure_firstboot () =
-    let fb = Buffer.create 1024 in
-    bprintf fb "@echo off\n";
+    configure_rhev_apt ();
+    unconfigure_xenpv ()
 
-    configure_rhev_apt fb;
-    unconfigure_xenpv fb;
-
-    (* Write the completed script to the guest. *)
-    let firstboot_script = Buffer.contents fb in
-    Firstboot.add_firstboot_script g inspect.i_root "firstboot" firstboot_script
-
-  and configure_rhev_apt fb =
+  and configure_rhev_apt () =
     (* Configure RHEV-APT (the RHEV guest agent).  However if it doesn't
      * exist just warn about it and continue.
      *)
@@ -159,22 +152,30 @@ let convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
     | Some rhev_apt_exe ->
       g#upload rhev_apt_exe "/rhev-apt.exe"; (* XXX *)
 
-      bprintf fb "\
+      let fb_script = "\
+ at echo off
+
 echo installing rhev-apt
 \"\\rhev-apt.exe\" /S /v /qn
 
 echo starting rhev-apt
 net start rhev-apt
-"
+" in
+      Firstboot.add_firstboot_script g inspect.i_root
+        "configure rhev-apt" fb_script
 
-  and unconfigure_xenpv fb =
+  and unconfigure_xenpv () =
     match xenpv_uninst with
     | None -> () (* nothing to be uninstalled *)
     | Some uninst ->
-      bprintf fb "\
+      let fb_script = sprintf "\
+ at echo off
+
 echo uninstalling Xen PV driver
 \"%s\"
-" uninst
+" uninst in
+      Firstboot.add_firstboot_script g inspect.i_root
+        "uninstall Xen PV" fb_script
   in
 
   let rec update_system_hive root =

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list