When outputting libvirt XML, create virtio-rng, a memory balloon
device, and a pvpanic device, if the guest supports it.
Thanks: Daniel Berrangé for advice on memballoon
---
v2v/create_libvirt_xml.ml | 26 ++++++++++++++++++++++++++
v2v/test-v2v-i-ova.xml | 4 ++++
2 files changed, 30 insertions(+)
diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml
index fc7196595..246cacd21 100644
--- a/v2v/create_libvirt_xml.ml
+++ b/v2v/create_libvirt_xml.ml
@@ -338,6 +338,32 @@ 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"]
+ ]
+ );
+ (* For the balloon device, libvirt adds an implicit device
+ * unless we use model='none', hence this:
+ *)
+ push_back devices (
+ e "memballoon"
+ ["model",
+ if guestcaps.gcaps_virtio_balloon then "virtio" else "none"]
+ []
+ );
+ 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"] [];
diff --git a/v2v/test-v2v-i-ova.xml b/v2v/test-v2v-i-ova.xml
index 1a31c44d5..4b5f615c9 100644
--- a/v2v/test-v2v-i-ova.xml
+++ b/v2v/test-v2v-i-ova.xml
@@ -37,6 +37,10 @@
<model type='qxl' ram='65536' heads='1'/>
</video>
<graphics type='vnc' autoport='yes' port='-1'/>
+ <rng model='virtio'>
+ <backend model='random'>/dev/urandom</backend>
+ </rng>
+ <memballoon model='virtio'/>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<console type='pty'/>
--
2.12.0