qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 16/18] xen: automatically create XenBlockDevi


From: Paul Durrant
Subject: Re: [Qemu-devel] [PATCH v4 16/18] xen: automatically create XenBlockDevice-s
Date: Fri, 14 Dec 2018 14:50:24 +0000

> -----Original Message-----
[snip]
> > +
> > +    blockdev->auto_iothread = iothread;
> > +
> > +    object_property_set_bool(OBJECT(dev), true, "realized",
> &local_err);
> > +    if (local_err) {
> > +        error_propagate_prepend(errp, local_err,
> > +                                "initialization of device %s failed: ",
> > +                                type);
> > +        goto unref;
> > +    }
> > +
> > +    blockdev_mark_auto_del(blk);
> 
> You don't need this one any more then (if you look into the details,
> it's one of the more confusing parts of the drive_*() magic, so it's
> good to get rid of it). When you use the anonymous BlockBackend created
> by the qdev drive property (because you passed it a node-name rather
> than a BlockBackend name) means that the BlockBackend disappears
> together with the drive.
> 
> Note that explicitly created block nodes must also be unreferenced
> explicitly (bdrv_open() should be paired with bdrv_unref() and
> qmp_blockdev_add() with qmp_blockdev_del()). Maybe XenBackendInfo needs
> a .destroy callback so we can do destruction symmetrically to device
> creation?
> 

I have something implemented using qmp_blockdev_add() now and it seems to work, 
but when I call into qmp_blockdev_del() (passing in the node-name I used to the 
set the "drive" parameter) during unrealize then it tells me that the device is 
in use. Do I need a callback that runs after unrealize of the device?

  Paul 

> > +    return;
> > +
> > +unref:
> > +    if (dev) {
> > +        object_unparent(OBJECT(dev));
> > +    }
> > +
> > +    if (iothread) {
> > +        iothread_destroy(iothread);
> > +    }
> > +
> > +    if (blk) {
> > +        monitor_remove_blk(blk);
> > +        blk_unref(blk);
> > +    }
> > +}
> 
> Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]