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 "\
+<!--
+ This is a libvirt configuration file.
+
+ To start the domain, do:
+ virsh%s define %s
+ virsh%s start %s
+-->\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