|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 4/5] libxl: call hotplug scripts from libxl for vif
On 18 Apr 2012, at 10:54, Ian Campbell wrote: On Tue, 2012-04-17 at 16:51 +0100, Roger Pau Monne wrote:As the previous change already introduces most of needed machinery to call hotplug scripts from libxl, this only adds the necessary bits to call thisscripts for vif interfaces also. libxl_device_nic_add has been changed to make use of the new eventfunctionality, and the necessary vif hotplug code has been added. No changes where needed in the teardown part, since it uses exactly the same codeintroduced for vbd.An exception has been introduced for tap devices, since hotplug scripts should be called after the device model has been created, so the hotplug call for those is done in do_domain_create after confirmation of the device model startup. On the other hand, tap devices don't use teardown scripts,so add another exception for that. libxl__device_from_nic was moved to libxl_device.c, so it can be usedin libxl_create.c, and libxl__device_from_disk was also moved to mantainthe simmetry."maintain" and "symmetry" These are pure code motion or did the code actually change too? The code didn't change, I just moved it around. libxl__initiate_device_remove has been changed a little, to nuke the frontend xenstore path before trying to perform device teardown, this allows for unitialized devices to be closed gracefully, specially vif interfaces added touninitialized (or -ised)HVM machines and not used.PV nic devices are set to LIBXL_NIC_TYPE_VIF, since the default value isLIBXL_NIC_TYPE_IOEMU regardless of the guest type.A new gobal option, called disable_vif_scripts has been added to allow the userglobaldecide if he wants to execute the hotplug scripts from xl or from udev. This hasbeen documented in the xl.conf man page.Did you do this for block too? Nope, only for vif interfaces, that are the only ones that have some kind of limited support for the driver domains thing when called from udev. Changes since v1:* Propagated changes from previous patch (disable_udev and libxl_device_nic_addswitch). * Modified udev rules to add the new env variable. * Added support for named interfaces. Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx> --- docs/man/xl.conf.pod.5 | 7 ++ tools/hotplug/Linux/xen-backend.rules | 6 +- tools/libxl/libxl.c | 90 +++++++------------- tools/libxl/libxl.h | 3 +- tools/libxl/libxl_create.c | 22 +++++- tools/libxl/libxl_device.c | 77 +++++++++++++++-- tools/libxl/libxl_dm.c | 2 +- tools/libxl/libxl_internal.h | 6 ++tools/libxl/libxl_linux.c | 150 ++++++++++++++++++++++++++++++++-tools/libxl/libxl_types.idl | 1 + tools/libxl/xl.c | 4 + tools/libxl/xl.h | 1 + tools/libxl/xl_cmdimpl.c | 15 +++- 13 files changed, 308 insertions(+), 76 deletions(-) diff --git a/docs/man/xl.conf.pod.5 b/docs/man/xl.conf.pod.5 index 8bd45ea..cf2c477 100644 --- a/docs/man/xl.conf.pod.5 +++ b/docs/man/xl.conf.pod.5 @@ -55,6 +55,13 @@ default. Default: C<1> +=item B<disable_vif_scripts=BOOLEAN> ++If enabled xl will not execute nic hotplug scripts itself, and instead+relegate this task to udev. + +Default: C<0>Please can you also add a commented out version to ./tools/examples/xl.conf, with the value of the default.This doesn't actually disable the scripts entirely, but rather only fromudev, disable_udev_vif_scripts perhaps? It actually disables script calling from libxl, so I think it might be best to call it disable_xl_vif_scripts? =item B<lockfile="PATH"> Sets the path to the lock file used by xl to serialise certain@@ -1929,14 +1883,30 @@ int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic) libxl__xs_kvs_of_flexarray(gc, back, back->count), libxl__xs_kvs_of_flexarray(gc, front, front->count)); Sure, good one, I think this kind of mechanism is prone to errorsâ AO_INPROGRESS should call ao_complete if no events have been added. + break; + case LIBXL_NIC_TYPE_IOEMU: + /* + * Don't execute hotplug scripts for IOEMU interfaces yet, + * we need to launch the device model first. + */It'd be useful to add a reference to where these are run, at first I thought this comment (and the patch to xen-backend.rules) meant they weren't being run at all. Done I've added a small note saying where they are called. diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index de598ad..a1f5731 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c@@ -607,7 +607,7 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config, Are you sure we need to wait for it to finish? There wasn't any kind of synchronization in the past when we called the scripts from udev, so I guess we don't have to wait either for them to finish.
Before this patch, we used to just nuke both front and back xenstore directories (because we always called libxl__device_destroy), so I think this is quite and improvement in term of co-operation than what we had before. We only used this kind of negotiation when detaching a block from a live guest. + libxl__xs_path_cleanup(gc, libxl__device_frontend_path(gc, dev)); Well, this is currently only used by libxl, but the type of the backend used I think should be inside the backend device directory, since other applications might also want to know this. Actually, now I think of it, that is also true of the udev_disable key? This is probably true for udev_disable, something like /libxl/devices/<domid>/<devid>/udev_disable? I will have to modify libxl__device_generic_add to do this, because it should be done on the same transaction when the device is added. I'm not sure if we need to add so much overhead for just one xenstore entry, that will go away in the next release probably. You could also use the handy enum to/from_strings functions to leave oneless magic number in xenstore. Yes.
Are you going to add it to your patch or I should add it to mine? Something like: char *libxl__device_tap_name(libxl__gc *gc, libxl__device *dev)
char *libxl__device_vif_name(libxl__gc *gc, libxl__device *dev)Both this functions should return the correct vifname if one is set, or the default one otherwise. + break; + default: + return NULL; + } + } flexarray_set(f_env, nr++, NULL); diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 01ff363..41230a6 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c@@ -846,6 +846,19 @@ static void parse_config_data(const char *configfile_filename_report, Yes.
Yes, and it's one line less.
_______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |