[libvirt] PATCH: Public API plumbing for virNodeDeviceCreateXML/Destroy

Daniel Veillard veillard at redhat.com
Fri Apr 24 12:55:41 UTC 2009


On Fri, Apr 24, 2009 at 01:33:47PM +0100, Daniel P. Berrange wrote:
> On Fri, Apr 24, 2009 at 02:28:37PM +0200, Daniel Veillard wrote:
> > > +    if (conn->deviceMonitor->deviceCreateXML) {
> > 
> >   are we always 100% sure conn->deviceMonitor is non NULL ?
> 
> Yep, that needs an additional check 'conn->deviceMonitor != NULL'

  okay

> > > +    if (!VIR_IS_CONNECTED_NODE_DEVICE(dev)) {
> > > +        virLibNodeDeviceError(NULL, VIR_ERR_INVALID_NODE_DEVICE, __FUNCTION__);
> > > +        return (-1);
> > > +    }
[...]
> > > +    if (dev->conn->deviceMonitor->deviceDestroy) {
> > > +        retval = dev->conn->deviceMonitor->deviceDestroy(dev);
> > > +        if (retval < 0) {
> > > +            goto error;
> > > +        }
> > > +
> > > +        return 0;
> > > +    }
> > > +
> > > +    virLibConnError (dev->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
> > > +
> > > +error:
> > > +    /* Copy to connection error object for back compatability */
> > > +    virSetConnError(dev->conn);
> > > +    return -1;
> > > +}
> > > +
> > > +
> 
> Likewise this needs a check for deviceMOnitor != NULL

  Ah, right I somehow expected that VIR_IS_CONNECTED_NODE_DEVICE would
check this, just confusion :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list