From 3e7dfd051bc3dc5005ca1d0c6ea07ebc95e4e798 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Add information to the XML conf file telling how to use it. --- virt-p2v.ml | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/virt-p2v.ml b/virt-p2v.ml index 1dd3dfc..e507ed2 100755 --- a/virt-p2v.ml +++ b/virt-p2v.ml @@ -1372,14 +1372,32 @@ MAC address: %s" name :: memory :: vcpu :: extras @ [devices] ) in - let xml = Xml.to_string_fmt xml in - let xml_len = String.length xml in - eprintf "length of configuration file is %d bytes\n%!" xml_len; - - let (sock,_) as conn = do_connect conf_filename (Int64.of_int xml_len) in - (* In OCaml this actually loops calling write(2) *) - ignore (write sock xml 0 xml_len); - do_disconnect conn; + (* Convert XML configuration file to a string, then send it to the + * remote server. + *) + let () = + let xml = Xml.to_string_fmt xml in + + let conn_arg = + match state.hypervisor with + | Some Xen | None -> "" + | Some QEMU | Some KVM -> " -c qemu:///system" in + let xml = sprintf "\ +\n\n" conn_arg conf_filename conn_arg hostname ^ xml in + + let xml_len = String.length xml in + eprintf "length of configuration file is %d bytes\n%!" xml_len; + + let (sock,_) as conn = do_connect conf_filename (Int64.of_int xml_len) in + (* In OCaml this actually loops calling write(2) *) + ignore (write sock xml 0 xml_len); + do_disconnect conn in (* Send the device snapshots to the remote host. *) (* XXX This code should be made more robust against both network -- 1.8.3.1