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

Re: [Xen-devel] [PATCH v4 16/18] xen: automatically create XenBlockDevice-s



> -----Original Message-----
> From: Xen-devel [mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On Behalf
> Of Paul Durrant
> Sent: 14 December 2018 14:50
> To: 'Kevin Wolf' <kwolf@xxxxxxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx; Stefano Stabellini
> <sstabellini@xxxxxxxxxx>; qemu-devel@xxxxxxxxxx; qemu-block@xxxxxxxxxx;
> Max Reitz <mreitz@xxxxxxxxxx>
> Subject: Re: [Xen-devel] [PATCH v4 16/18] xen: automatically create
> XenBlockDevice-s
> 
> > -----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?

I have coded it up now and apparently I do.

  Paul

> 
>   Paul
> 
> > > +    return;
> > > +
> > > +unref:
> > > +    if (dev) {
> > > +        object_unparent(OBJECT(dev));
> > > +    }
> > > +
> > > +    if (iothread) {
> > > +        iothread_destroy(iothread);
> > > +    }
> > > +
> > > +    if (blk) {
> > > +        monitor_remove_blk(blk);
> > > +        blk_unref(blk);
> > > +    }
> > > +}
> >
> > Kevin
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.