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

Re: [Libguestfs] [PATCH v2 1/2] v2v:windows: factor out getting CurrentControlSet



On Thu, Sep 01, 2016 at 11:50:18AM +0300, Roman Kagan wrote:
> It will be used in new code in a followup patch.
> 
> Signed-off-by: Roman Kagan <rkagan virtuozzo com>
> ---
> v1 -> v2:
>  - revert debug -> printf regression
> 
>  v2v/convert_windows.ml | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
> index 55bb3ef..02c7a47 100644
> --- a/v2v/convert_windows.ml
> +++ b/v2v/convert_windows.ml
> @@ -210,6 +210,13 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
>    (*----------------------------------------------------------------------*)
>    (* Perform the conversion of the Windows guest. *)
>  
> +  (* Find the 'Current' ControlSet. *)
> +  let get_current_cs root =
> +    let select = g#hivex_node_get_child root "Select" in
> +    let valueh = g#hivex_node_get_value select "Current" in
> +    let value = int_of_le32 (g#hivex_value_value valueh) in
> +    sprintf "ControlSet%03Ld" value in
> +
>    let rec configure_firstboot () =
>      (match installer with
>       | None -> ()
> @@ -302,13 +309,7 @@ if errorlevel 3010 exit /b 0
>      (* Update the SYSTEM hive.  When this function is called the hive has
>       * already been opened as a hivex handle inside guestfs.
>       *)
> -    (* Find the 'Current' ControlSet. *)
> -    let current_cs =
> -      let select = g#hivex_node_get_child root "Select" in
> -      let valueh = g#hivex_node_get_value select "Current" in
> -      let value = int_of_le32 (g#hivex_value_value valueh) in
> -      sprintf "ControlSet%03Ld" value in
> -
> +    let current_cs = get_current_cs root in
>      debug "current ControlSet is %s" current_cs;
>  
>      disable_services root current_cs;

This is fine, ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html


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