[libvirt] [PATCH 3/4] Explicitly represent balloon device in XML and handle PCI address

Daniel P. Berrange berrange at redhat.com
Wed Jul 21 10:28:50 UTC 2010


On Wed, Jul 21, 2010 at 12:20:13PM +0200, Daniel Veillard wrote:
> On Tue, Jul 20, 2010 at 02:09:31PM +0100, Daniel P. Berrange wrote:
> > From: Daniel P. Berrange <dan at berrange.com>
> > 
> > To allow compatability with older QEMU PCI device slot assignment
> > it is neccessary to explicitly track the balloon device in the
> > XML. This introduces a new device
> > 
> >    <memballoon model='virtio|xen'/>
> 
>   Hum ... so this is a feature of the hypervisor emulation
> but that we need to list in the domain devices. It's a bit funky,

Ballooning isn't actually part of hypervisor emulation. It is a full
device driver just like disk/network/etc. In Xen world it is another
paravirt driver, in KVM world it is a PCI device.

> 
> [...]
> > +    if (def->memballoon) {
> > +        if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
> > +            qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> > +                            _("Memory balloon device type '%s' is not supported by this version of qemu"),
> > +                            virDomainMemballoonModelTypeToString(def->memballoon->model));
> > +            goto error;
> 
>   Hum, this is likely to lead to a printf( "%s", NULL) isn't it ?
> is that dangerous report or useful report ? 

The 'model' value is a managed enum, so we validate at compile time that
every enum value has a corresponding string, and all code which sets this
value uses the enum APIs. So this will never return NULL

Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list