[Libguestfs] [PATCH 5/6] v2v: -o libvirt: Add virtio-rng, balloon and pvpanic to output XML (RHBZ#1438794).

Richard W.M. Jones rjones at redhat.com
Wed Apr 5 13:43:11 UTC 2017


When outputting libvirt XML, create virtio-rng, a memory balloon
device, and a pvpanic device, if the guest supports it.
---
 v2v/create_libvirt_xml.ml | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml
index fc7196595..58f720ac3 100644
--- a/v2v/create_libvirt_xml.ml
+++ b/v2v/create_libvirt_xml.ml
@@ -338,6 +338,25 @@ let create_libvirt_xml ?pool source target_buses guestcaps
          [] in
   append devices sound;
 
+  (* Miscellaneous KVM devices. *)
+  if guestcaps.gcaps_virtio_rng then
+    push_back devices (
+      e "rng" ["model", "virtio"] [
+        (* XXX Using /dev/urandom requires libvirt >= 1.3.4.  Libvirt
+         * was broken before that.
+         *)
+        e "backend" ["model", "random"] [PCData "/dev/urandom"]
+      ]
+    );
+  if guestcaps.gcaps_virtio_balloon then
+    push_back devices (e "memballoon" ["model", "virtio"] []);
+  if guestcaps.gcaps_isa_pvpanic then
+    push_back devices (
+      e "panic" ["model", "isa"] [
+        e "address" ["type", "isa"; "iobase", "0x505"] []
+      ]
+    );
+
   (* Standard devices added to every guest. *)
   append devices [
     e "input" ["type", "tablet"; "bus", "usb"] [];
-- 
2.12.0




More information about the Libguestfs mailing list