[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 14:18:51 UTC 2017


On Wed, Apr 05, 2017 at 02:46:17PM +0100, Daniel P. Berrange wrote:
> On Wed, Apr 05, 2017 at 02:43:11PM +0100, Richard W.M. Jones wrote:
> > 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"] []);
> 
> For (unpleasant) historical reasons you'll always get a virtio balloon
> device added by libvirt. If you don't want balloon enabled you have to
> explicitly give model=none

Thanks Dan.  I'll change this to:

  push_back devices (
    e "memballoon"
      ["model",
       if guestcaps.gcaps_virtio_balloon then "virtio" else "none"]
      []
  );

Rich.

> > +  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"] [];
> 
> Regards,
> Daniel
> -- 
> |: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org              -o-             http://virt-manager.org :|
> |: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list