|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v6 06/13] libxl: convert libxl_device_disk_add to an async op
Ian Jackson wrote:
Thanks we reached the desired xenbus state.Thanks, here are my review comments:diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 85c21b4..937ab08 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h...+/* AO operation to connect a disk device, called by + * libxl_device_disk_add and libxl__add_disks. This function calls + * libxl__initiate_device_connection to wait for the device to + * finish the connection (might involve executing hotplug scripts). + */ +_hidden void libxl__device_disk_add(libxl__egc *egc, uint32_t domid, + xs_transaction_t t, + libxl_device_disk *disk, + libxl__ao_device *aodev); +This is a confusing doc comment. The reader doesn't want to know how the function is implemented; we need to know what it does. Particularly, we need to know what happens when it completes. I infer that it calls aodev->callback but this should be stated. Yes, fixed comment. +/* Waits for the passed device to reach state XenbusStateInitWait. + * This is not really useful by itself, but is important when executing + * hotplug scripts, since we need to be sure the device is in the correct + * state before executing them. + * + * Once finished, aodev->callback will be executed. + */ +_hidden void libxl__initiate_device_connection(libxl__egc*, + libxl__ao_device *aodev);This function's name and its functionality seem not to correspond. It doesn't actually initiate anything, as far as I can tell. I've renamed it to libxl__wait_device_connection
I've removed both occurrences of this comment.
Well, this is not really my code, this was part of Stefanos series about local disk attach. However, I don't see how we end up writing them one at a time, libxl__device_generic_add creates a transaction if none is given, so all backend and frontend entries are added at the same transaction. Calling libxl__device_disk_add without a transaction behaves just like it did previously. I think this applies to all the other device types too. So I think the right answer would be to make them take a transaction parameter too. Ie, insert a patch before this one which adds a transaction parameter (ignored for now and always passed 0 if you don't want to actually make it work properly) to libxl__add_nic etc. Then you don't need this unpleasant macro. Ok, I will add this patch that makes all device_*_add take a transaction parameter, although it will be ignored right now.
This is part of both flows, both device connection and disconnection. And, secondly, does device_xsentries_remove really do what you want ? It has a test in it which makes it only do its work if action is DISCONNECT. Yes, that's because it's called by both flows. diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 43affd1..5f09740 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c@@ -2027,15 +2046,17 @@ static char * libxl__alloc_vdev(libxl__gc *gc, const char *blkdev_start, Yes I see your point. We should disconnect the device (execute hotplug scripts) but since the xenstore entries are already gone (because the transaction is not committed successfully) I don't see anyway to do it, we cannot execute those scripts if the backend entries have been lost. Indeed it seems to me like your arrangements in libxl__device_disk_add couldn't work if a non-null t was supplied. libxl__device_disk_add would do all the writes in the transaction, but not commit it, so that none of them are visible to anyone, and then wait for the deivde state to change, which will never happen. I'm not so sure, is it possible to add a watch to a xenstore path that is inside of a not yet committed transaction? If so this will work fine, the transaction will be finished correctly, and the path will be updated to the correct state (2). If the transaction is not committed successfully, we will get a timeout from the devstate event and exit.
So I assume we can leave this for later. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |