[Pkg-libvirt-commits] [libguestfs] 131/266: v2v: Add display, removable disks, and network interfaces.

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:41:51 UTC 2014


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

bengen pushed a commit to annotated tag debian/1%1.27.35-1
in repository libguestfs.

commit 3d1cb74b3eee51c5d015032ad964892be914ea9c
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Tue Aug 19 13:34:55 2014 +0100

    v2v: Add display, removable disks, and network interfaces.
    
    These are now collected from the source metadata and (where
    possible) passed through to the destination.
    
    For reference, see the metadata structure of the old virt-v2v (roughly
    equivalent to Types.source in the new code):
    
    https://git.fedorahosted.org/cgit/virt-v2v.git/tree/metadata-format.txt
    
    As you can see the new code now covers all the metadata features of
    the old code.
---
 v2v/TODO               |   9 +----
 v2v/convert_linux.ml   |  49 +++++++++++++++++++++++-
 v2v/convert_windows.ml |   5 ++-
 v2v/source_disk.ml     |  10 +++++
 v2v/source_libvirt.ml  |  89 +++++++++++++++++++++++++++++++++++++++----
 v2v/target_RHEV.ml     |  74 ++++++++++++++++++++++++++++++------
 v2v/target_libvirt.ml  | 100 +++++++++++++++++++++++++++++++++++++++++++++----
 v2v/types.ml           |  49 ++++++++++++++++++++++++
 v2v/types.mli          |  25 ++++++++++++-
 9 files changed, 372 insertions(+), 38 deletions(-)

diff --git a/v2v/TODO b/v2v/TODO
index fb12eb8..1bf8ee3 100644
--- a/v2v/TODO
+++ b/v2v/TODO
@@ -14,22 +14,17 @@ p2v:
 p2v/conversion.c:                "/tmp/virt-p2v-%04d%02d%02d-XXXXXXXX",
 p2v/conversion.c:                   " -o local -os /tmp" /* XXX */
 p2v/conversion.c:  /* XXX quoting needs to be improved here XXX */
-p2v/conversion.c:  /* XXX features: acpi, apic, pae */
 p2v/gui.c:  /* XXX It would be nice not to have to set this explicitly, but
 p2v/main.c:/* XXX Copied from fish/options.c. */
 v2v/convert_linux.ml:           (* Get/construct the version.  XXX Read this fro
 v2v/convert_linux.ml:          [ "sym53c8xx" (* XXX why not "ide"? *) ] in
 v2v/convert_linux.ml:         * XXX RHEL 3 unfortunately will give this error an
 v2v/convert_linux.ml:    XXX to do from original v2v:
-v2v/convert_linux.ml:  (* XXX display *)
 v2v/convert_windows.ml:      g#upload rhev_apt_exe "/rhev-apt.exe"; (* XXX *)
-v2v/convert_windows.ml:    (* XXX display *)
+v2v/convert_windows.ml:     * guests.  Unclear if this is correct.  XXX
 v2v/source_libvirt.ml:             * XXX Quoting, although it's not needed for v
-v2v/source_libvirt.ml:  (* XXX Much more metadata needs to be collected here:
-v2v/target_RHEV.ml:  (* XXX Missing here from old virt-v2v:
-v2v/target_local.ml:  (* XXX Missing here from old virt-v2v:
+v2v/target_RHEV.ml:  (* Old virt-v2v ignored removable media. XXX *)
 v2v/types.mli:  (* Only used by RHEV.  XXX Should be parameterized type. *)
-v2v/types.mli:  (* XXX acpi, display *)
 
 For OVA support we need to have the source write to the final target
 directory (where possible as it might not always be possible to do
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 041b40a..58d0e99 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -999,6 +999,49 @@ let rec convert ?(keep_serial_console = true) verbose (g : G.guestfs)
     else
       true
 
+  and get_display_driver () =
+    if family = `SUSE_family then "cirrus" else "qxl"
+
+  and configure_display_driver video =
+    let updated = ref false in
+
+    let xorg_conf =
+      if not (g#is_file ~followsymlinks:true "/etc/X11/xorg.conf") &&
+        g#is_file ~followsymlinks:true "/etc/X11/XF86Config"
+      then (
+        g#aug_set "/augeas/load/Xorg/incl[last()+1]" "/etc/X11/XF86Config";
+        g#aug_load ();
+        "/etc/X11/XF86Config"
+        )
+      else
+        "/etc/X11/xorg.conf" in
+
+    let paths = g#aug_match ("/files" ^ xorg_conf ^ "/Device/Driver") in
+    Array.iter (
+      fun path ->
+        g#aug_set path video;
+        updated := true
+    ) paths;
+
+    (* Remove VendorName and BoardName if present. *)
+    let paths = g#aug_match ("/files" ^ xorg_conf ^ "/Device/VendorName") in
+    Array.iter (fun path -> ignore (g#aug_rm path)) paths;
+    let paths = g#aug_match ("/files" ^ xorg_conf ^ "/Device/BoardName") in
+    Array.iter (fun path -> ignore (g#aug_rm path)) paths;
+
+    g#aug_save ();
+
+    (* If we updated the X driver, checkthat X itself is installed,
+     * and warn if not.  Old virt-v2v used to attempt to install X here
+     * but that way lies insanity and ruin.
+     *)
+    if !updated &&
+      not (g#is_file ~followsymlinks:true "/usr/bin/X") &&
+      not (g#is_file ~followsymlinks:true "/usr/bin/X11/X") then
+      warning ~prog
+        (f_"The display driver was updated to '%s', but X11 does not seem to be installed in the guest.  X may not function correctly.")
+        video
+
   and remap_block_devices virtio =
     (* This function's job is to iterate over boot configuration
      * files, replacing "hda" with "vda" or whatever is appropriate.
@@ -1155,9 +1198,11 @@ let rec convert ?(keep_serial_console = true) verbose (g : G.guestfs)
 
   let acpi = supports_acpi () in
 
+  let video = get_display_driver () in
+  configure_display_driver video;
+
   (*
     XXX to do from original v2v:
-    configure display driver
     configure_kernel_modules  # updates /etc/modules.conf and friends
   *)
 
@@ -1167,7 +1212,7 @@ let rec convert ?(keep_serial_console = true) verbose (g : G.guestfs)
     gcaps_block_bus = if virtio then "virtio" else "ide";
     gcaps_net_bus = if virtio then "virtio" else "e1000";
     gcaps_acpi = acpi;
-  (* XXX display *)
+    gcaps_video = video;
   } in
 
   guestcaps
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index a585d14..b3b3d50 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -471,7 +471,10 @@ echo uninstalling Xen PV driver
     gcaps_block_bus = block_driver;
     gcaps_net_bus = net_driver;
     gcaps_acpi = true;
-    (* XXX display *)
+    (* Old virt-v2v would always present a QXL video display to converted
+     * guests.  Unclear if this is correct.  XXX
+     *)
+    gcaps_video = "qxl";
   } in
 
   guestcaps
diff --git a/v2v/source_disk.ml b/v2v/source_disk.ml
index 28723c0..50270f4 100644
--- a/v2v/source_disk.ml
+++ b/v2v/source_disk.ml
@@ -56,6 +56,13 @@ let create input_format disk =
     s_target_dev = None;
   } in
 
+  (* Give the guest a simple generic network interface. *)
+  let network = {
+    s_mac = None;
+    s_vnet = "default";
+    s_vnet_type = `Network
+  } in
+
   let source = {
     s_dom_type = "kvm";
     s_name = name;
@@ -63,7 +70,10 @@ let create input_format disk =
     s_vcpu = 1;                         (* 1 vCPU is a safe default *)
     s_arch = Config.host_cpu;
     s_features = [ "acpi"; "apic"; "pae" ];
+    s_display = None;
     s_disks = [disk];
+    s_removables = [];
+    s_nics = [ network ];
   } in
 
   source
diff --git a/v2v/source_libvirt.ml b/v2v/source_libvirt.ml
index d787f42..c50fa04 100644
--- a/v2v/source_libvirt.ml
+++ b/v2v/source_libvirt.ml
@@ -82,6 +82,31 @@ let create_xml ?dir xml =
     done;
     !features in
 
+  let display =
+    let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/graphics" in
+    let nr_nodes = Xml.xpathobj_nr_nodes obj in
+    if nr_nodes < 1 then None
+    else (
+      (* Ignore everything except the first <graphics> device. *)
+      let node = Xml.xpathobj_node doc obj 0 in
+      Xml.xpathctx_set_current_context xpathctx node;
+      let keymap =
+        match xpath_to_string "@keymap" "" with "" -> None | k -> Some k in
+      let password =
+        match xpath_to_string "@passwd" "" with "" -> None | pw -> Some pw in
+      match xpath_to_string "@type" "" with
+      | "" -> None
+      | "vnc" ->
+        Some { s_display_type = `VNC;
+               s_keymap = keymap; s_password = password }
+      | "spice" ->
+        Some { s_display_type = `Spice;
+               s_keymap = keymap; s_password = password }
+      | t ->
+        warning ~prog (f_"display <graphics type='%s'> was ignored") t;
+        None
+    ) in
+
   (* Non-removable disk devices. *)
   let disks =
     let get_disks, add_disk =
@@ -150,13 +175,60 @@ let create_xml ?dir xml =
     done;
     get_disks () in
 
-  (* XXX Much more metadata needs to be collected here:
-   * - graphics
-   * - cdroms
-   * - floppies
-   * - network interfaces
-   * See: lib/Sys/VirtConvert/Connection/LibVirt.pm
-   *)
+  (* Removable devices, CD-ROMs and floppy disks. *)
+  let removables =
+    let obj =
+      Xml.xpath_eval_expression xpathctx
+        "/domain/devices/disk[@device='cdrom' or @device='floppy']" in
+    let nr_nodes = Xml.xpathobj_nr_nodes obj in
+    let disks = ref [] in
+    for i = 0 to nr_nodes-1 do
+      let node = Xml.xpathobj_node doc obj i in
+      Xml.xpathctx_set_current_context xpathctx node;
+
+      let target_dev =
+        let target_dev = xpath_to_string "target/@dev" "" in
+        if target_dev <> "" then Some target_dev else None in
+
+      let typ =
+        match xpath_to_string "@device" "" with
+        | "cdrom" -> `CDROM
+        | "floppy" -> `Floppy
+        | _ -> assert false (* libxml2 error? *) in
+
+      let disk =
+        { s_removable_type = typ; s_removable_target_dev = target_dev } in
+      disks := disk :: !disks
+    done;
+    List.rev !disks in
+
+  (* Network interfaces. *)
+  let nics =
+    let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/interface" in
+    let nr_nodes = Xml.xpathobj_nr_nodes obj in
+    let nics = ref [] in
+    for i = 0 to nr_nodes-1 do
+      let node = Xml.xpathobj_node doc obj i in
+      Xml.xpathctx_set_current_context xpathctx node;
+
+      let mac = xpath_to_string "mac/@address" "" in
+      let mac = match mac with "" -> None | mac -> Some mac in
+
+      let vnet_type =
+        match xpath_to_string "@type" "" with
+        | "network" -> Some `Network
+        | "bridge" -> Some `Bridge
+        | _ -> None in
+      match vnet_type with
+      | None -> ()
+      | Some vnet_type ->
+        let vnet = xpath_to_string "source/@network | source/@bridge" "" in
+        if vnet <> "" then (
+          let nic = { s_mac = mac; s_vnet = vnet; s_vnet_type = vnet_type } in
+          nics := nic :: !nics
+        )
+    done;
+    List.rev !nics in
 
   {
     s_dom_type = dom_type;
@@ -165,7 +237,10 @@ let create_xml ?dir xml =
     s_vcpu = vcpu;
     s_arch = arch;
     s_features = features;
+    s_display = display;
     s_disks = disks;
+    s_removables = removables;
+    s_nics = nics;
   }
 
 let create_from_xml file =
diff --git a/v2v/target_RHEV.ml b/v2v/target_RHEV.ml
index c0d0b2e..9d2eeb1 100644
--- a/v2v/target_RHEV.ml
+++ b/v2v/target_RHEV.ml
@@ -363,15 +363,20 @@ let rec create_metadata os rhev_params source output_alloc
   (* Add disks to the OVF XML. *)
   add_disks output_alloc overlays guestcaps ovf;
 
-  (* XXX Missing here from old virt-v2v:
-     cdroms and floppies
-     network interfaces
-     display
-     See: lib/Sys/VirtConvert/Connection/RHEVTarget.pm
-  *)
-
+  (* Old virt-v2v ignored removable media. XXX *)
 
+  (* Add networks to the OVF XML. *)
+  add_networks source.s_nics guestcaps ovf;
 
+  (* Old virt-v2v didn't really look at the video and display
+   * metadata, instead just adding a single standard display (see
+   * above).  However it did warn if there was a password on the
+   * display of the old guest.
+   *)
+  (match source with
+  | { s_display = Some { s_password = Some _ } } ->
+    warning ~prog (f_"This guest required a password for connection to its display, but this is not supported by RHEV.  Therefore the converted guest's display will not require a separate password to connect.");
+  | _ -> ());
 
   (* Write it to the metadata file. *)
   let dir = !esd.mp // !esd.uuid // "master" // "vms" // !vm_uuid in
@@ -506,11 +511,6 @@ and add_disks output_alloc overlays guestcaps ovf =
     try find_node_by_attr sections ("xsi:type", "ovf:VirtualHardwareSection_Type")
     with Not_found -> assert false in
 
-  let append_child child = function
-    | PCData _ -> assert false
-    | Element e -> e.e_children <- e.e_children @ [child]
-  in
-
   (* Iterate over the disks, adding them to the OVF document. *)
   iteri (
     fun i ov ->
@@ -612,3 +612,53 @@ and du_m filename =
   match lines with
   | line::_ -> (try Int64.of_string line with _ -> 0L)
   | [] -> 0L
+
+(* This modifies the OVF DOM, adding a section for each NIC. *)
+and add_networks nics guestcaps ovf =
+  let network_section =
+    let sections = path_to_nodes ovf ["ovf:Envelope"; "Section"] in
+    try find_node_by_attr sections ("xsi:type", "ovf:NetworkSection_Type")
+    with Not_found -> assert false in
+  let virtualhardware_section =
+    let sections = path_to_nodes ovf ["ovf:Envelope"; "Content"; "Section"] in
+    try find_node_by_attr sections ("xsi:type", "ovf:VirtualHardwareSection_Type")
+    with Not_found -> assert false in
+
+  (* Iterate over the NICs, adding them to the OVF document. *)
+  iteri (
+    fun i { s_mac = mac; s_vnet_type = vnet_type; s_vnet = vnet } ->
+      let dev = sprintf "eth%d" i in
+
+      let model =
+        match guestcaps.gcaps_net_bus with
+        | "rtl8139" -> "1"
+        | "e1000" -> "2"
+        | "virtio" -> "3"
+        | bus ->
+          warning ~prog (f_"unknown NIC model %s for ethernet device %s.  This NIC will be imported as rtl8139 instead.")
+            bus dev;
+          "1" in
+
+      let network = e "Network" ["ovf:name", vnet] [] in
+      append_child network network_section;
+
+      let item =
+        let children = [
+          e "rasd:InstanceId" [] [PCData "3"];
+          e "rasd:Caption" [] [PCData (sprintf "Ethernet adapter on %s" vnet)];
+          e "rasd:ResourceType" [] [PCData "10"];
+          e "rasd:ResourceSubType" [] [PCData model];
+          e "rasd:Connection" [] [PCData vnet];
+          e "rasd:Name" [] [PCData dev];
+        ] in
+        let children =
+          match mac with
+          | None -> children
+          | Some mac -> children @ [e "rasd:MACAddress" [] [PCData mac]] in
+        e "Item" [] children in
+      append_child item virtualhardware_section;
+  ) nics
+
+and append_child child = function
+  | PCData _ -> assert false
+  | Element e -> e.e_children <- e.e_children @ [child]
diff --git a/v2v/target_libvirt.ml b/v2v/target_libvirt.ml
index 6b1f280..c8409c6 100644
--- a/v2v/target_libvirt.ml
+++ b/v2v/target_libvirt.ml
@@ -25,6 +25,14 @@ open Types
 open Utils
 open DOM
 
+let append_child child = function
+  | PCData _ -> assert false
+  | Element e -> e.e_children <- e.e_children @ [child]
+
+let append_attr attr = function
+  | PCData _ -> assert false
+  | Element e -> e.e_attrs <- e.e_attrs @ [attr]
+
 let create_libvirt_xml ?pool source overlays guestcaps =
   let memory_k = source.s_memory /^ 1024L in
 
@@ -67,14 +75,90 @@ let create_libvirt_xml ?pool source overlays guestcaps =
         ]
     ) overlays in
 
-  (* XXX Missing here from list of devices compared to old virt-v2v:
-     <video/>
-     <graphics/>
-     cdroms and floppies
-     network interfaces
-     See: lib/Sys/VirtConvert/Connection/LibVirtTarget.pm
-  *)
-  let devices = disks @
+  let removables =
+    (* CDs will be added as IDE devices if we're using virtio, else
+     * they will be added as the same as the disk bus.  The original
+     * s_removable_target_dev is ignored (same as old virt-v2v).
+     *)
+    let cdrom_bus, cdrom_block_prefix, cdrom_index =
+      match guestcaps.gcaps_block_bus with
+      | "virtio" | "ide" -> "ide", "hd", ref 0
+      | bus -> bus, "sd", ref (List.length overlays) in
+
+    (* Floppy disks always occupy their own virtual bus. *)
+    let fd_bus = "fdc" and fd_index = ref 0 in
+
+    List.map (
+      function
+      | { s_removable_type = `CDROM } ->
+        let i = !cdrom_index in
+        incr cdrom_index;
+        let name = cdrom_block_prefix ^ drive_name i in
+        e "disk" [ "device", "cdrom"; "type", "file" ] [
+          e "driver" [ "name", "qemu"; "type", "raw" ] [];
+          e "target" [ "dev", name; "bus", cdrom_bus ] []
+        ]
+
+      | { s_removable_type = `Floppy } ->
+        let i = !fd_index in
+        incr fd_index;
+        let name = "fd" ^ drive_name i in
+        e "disk" [ "device", "floppy"; "type", "file" ] [
+          e "driver" [ "name", "qemu"; "type", "raw" ] [];
+          e "target" [ "dev", name; "bus", fd_bus ] []
+        ]
+    ) source.s_removables in
+
+  let nics =
+    List.map (
+      fun { s_mac = mac; s_vnet_type = vnet_type; s_vnet = vnet } ->
+        let vnet_type_str =
+          match vnet_type with
+          | `Bridge -> "bridge" | `Network -> "network" in
+
+        let nic =
+          e "interface" [ "type", vnet_type_str ] [
+            e "source" [ vnet_type_str, vnet ] [];
+            e "model" [ "type", guestcaps.gcaps_net_bus ] [];
+          ] in
+
+        (match mac with
+        | None -> ()
+        | Some mac ->
+          append_child (e "mac" [ "address", mac ] []) nic);
+
+        nic
+    ) source.s_nics in
+
+  (* Same as old virt-v2v, we always add a display here even if it was
+   * missing from the old metadata.
+   *)
+  let video, graphics =
+    let video, graphics =
+      match guestcaps.gcaps_video with
+      | "qxl" ->
+        e "video" [ "type", "qxl"; "ram", "65536" ] [],
+        e "graphics" [ "type", "vnc" ] []
+      | "cirrus" ->
+        e "video" [ "type", "cirrus"; "vram", "9216" ] [],
+        e "graphics" [ "type", "spice" ] []
+      | video_type ->
+        e "video" [ "type", video_type ] [],
+        e "graphics" [ "type", video_type (* ? *) ] [] in
+
+    append_attr ("heads", "1") video;
+
+    append_attr ("autoport", "yes") graphics;
+    (match source.s_display with
+    | Some { s_keymap = Some km } -> append_attr ("keymap", km) graphics
+    | _ -> ());
+    (match source.s_display with
+    | Some { s_password = Some pw } -> append_attr ("password", pw) graphics
+    | _ -> ());
+
+    video, graphics in
+
+  let devices = disks @ removables @ nics @ [video] @ [graphics] @
   (* Standard devices added to every guest. *) [
     e "input" ["type", "tablet"; "bus", "usb"] [];
     e "input" ["type", "mouse"; "bus", "ps2"] [];
diff --git a/v2v/types.ml b/v2v/types.ml
index fb4491e..fc3253e 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -64,13 +64,30 @@ type source = {
   s_vcpu : int;
   s_arch : string;
   s_features : string list;
+  s_display : source_display option;
   s_disks : source_disk list;
+  s_removables : source_removable list;
+  s_nics : source_nic list;
 }
 and source_disk = {
   s_qemu_uri : string;
   s_format : string option;
   s_target_dev : string option;
 }
+and source_removable = {
+  s_removable_type : [`CDROM|`Floppy];
+  s_removable_target_dev : string option;
+}
+and source_nic = {
+  s_mac : string option;
+  s_vnet : string;
+  s_vnet_type : [`Bridge|`Network];
+}
+and source_display = {
+  s_display_type : [`VNC|`Spice];
+  s_keymap : string option;
+  s_password : string option;
+}
 
 let rec string_of_source s =
   sprintf "\
@@ -80,7 +97,10 @@ s_memory = %Ld
 s_vcpu = %d
 s_arch = %s
 s_features = [%s]
+s_display = %s
 s_disks = [%s]
+s_removables = [%s]
+s_nics = [%s]
 "
     s.s_dom_type
     s.s_name
@@ -88,7 +108,12 @@ s_disks = [%s]
     s.s_vcpu
     s.s_arch
     (String.concat "," s.s_features)
+    (match s.s_display with
+    | None -> ""
+    | Some display -> string_of_source_display display)
     (String.concat "," (List.map string_of_source_disk s.s_disks))
+    (String.concat "," (List.map string_of_source_removable s.s_removables))
+    (String.concat "," (List.map string_of_source_nic s.s_nics))
 
 and string_of_source_disk { s_qemu_uri = qemu_uri; s_format = format;
                             s_target_dev = target_dev } =
@@ -101,6 +126,29 @@ and string_of_source_disk { s_qemu_uri = qemu_uri; s_format = format;
     | None -> ""
     | Some target_dev -> " [" ^ target_dev ^ "]")
 
+and string_of_source_removable { s_removable_type = typ;
+                                 s_removable_target_dev = target_dev } =
+  sprintf "%s%s"
+    (match typ with `CDROM -> "cdrom" | `Floppy -> "floppy")
+    (match target_dev with
+    | None -> ""
+    | Some target_dev -> " [" ^ target_dev ^ "]")
+
+and string_of_source_nic { s_mac = mac; s_vnet = vnet; s_vnet_type = typ } =
+  sprintf "%s%s%s"
+    (match typ with `Bridge -> "bridge" | `Network -> "network")
+    vnet
+    (match mac with
+    | None -> ""
+    | Some mac -> " " ^ mac)
+
+and string_of_source_display { s_display_type = typ;
+                               s_keymap = keymap; s_password = password } =
+  sprintf "%s%s%s"
+    (match typ with `VNC -> "vnc" | `Spice -> "spice")
+    (match keymap with None -> "" | Some km -> " " ^ km)
+    (match password with None -> "" | Some _ -> " with password")
+
 type overlay = {
   ov_overlay : string;
   ov_target_file : string;
@@ -154,4 +202,5 @@ type guestcaps = {
   gcaps_block_bus : string;
   gcaps_net_bus : string;
   gcaps_acpi : bool;
+  gcaps_video : string;
 }
diff --git a/v2v/types.mli b/v2v/types.mli
index aac2952..0307664 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -48,7 +48,10 @@ type source = {
   s_vcpu : int;                         (** Number of CPUs. *)
   s_arch : string;                      (** Architecture. *)
   s_features : string list;             (** Machine features. *)
+  s_display : source_display option;    (** Guest display. *)
   s_disks : source_disk list;           (** Disk images. *)
+  s_removables : source_removable list; (** CDROMs etc. *)
+  s_nics : source_nic list;             (** NICs. *)
 }
 (** The source: metadata, disk images. *)
 
@@ -59,6 +62,26 @@ and source_disk = {
 }
 (** A source disk. *)
 
+and source_removable = {
+  s_removable_type : [`CDROM|`Floppy];  (** Type.  *)
+  s_removable_target_dev : string option; (** Target @dev from libvirt XML. *)
+}
+(** Removable media. *)
+
+and source_nic = {
+  s_mac : string option;                (** MAC address. *)
+  s_vnet : string;                      (** Source network name. *)
+  s_vnet_type : [`Bridge|`Network];     (** Source network type. *)
+}
+(** Network interfaces. *)
+
+and source_display = {
+  s_display_type : [`VNC|`Spice];       (** Display type. *)
+  s_keymap : string option;             (** Guest keymap. *)
+  s_password : string option;           (** If required, password to access
+                                            the display. *)
+}
+
 val string_of_source : source -> string
 val string_of_source_disk : source_disk -> string
 
@@ -106,6 +129,6 @@ type guestcaps = {
   gcaps_block_bus : string;    (** "virtio", "ide", possibly others *)
   gcaps_net_bus : string;      (** "virtio", "e1000", possibly others *)
   gcaps_acpi : bool;           (** guest supports acpi *)
-  (* XXX acpi, display *)
+  gcaps_video : string;        (** "qxl", "cirrus" *)
 }
 (** Guest capabilities after conversion.  eg. Was virtio found or installed? *)

-- 
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