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

Re: [Xen-devel] [PATCH 2/2] libxl: allow to create a domain without disks



On Thu, 2012-07-26 at 20:12 +0100, Roger Pau Monne wrote:
> Without this patch, the process gets stuck waiting for someone to call
> the callback, since no disk devices are added.
> 
> Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
> ---
>  tools/libxl/libxl_create.c |   12 ++++++++----
>  tools/libxl/libxl_dm.c     |   13 +++++++++----
>  2 files changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index 5859c09..3f129bf 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -907,11 +907,15 @@ static void domcreate_rebuild_done(libxl__egc *egc,
>  
>      store_libxl_entry(gc, domid, &d_config->b_info);
>  
> -    dcs->aodevs.size = d_config->num_disks;
> -    dcs->aodevs.callback = domcreate_launch_dm;
> -    libxl__prepare_ao_devices(ao, &dcs->aodevs);
> -    libxl__add_disks(egc, ao, domid, 0, d_config, &dcs->aodevs);
> +    if (d_config->num_disks > 0) {
> +        dcs->aodevs.size = d_config->num_disks;
> +        dcs->aodevs.callback = domcreate_launch_dm;
> +        libxl__prepare_ao_devices(ao, &dcs->aodevs);
> +        libxl__add_disks(egc, ao, domid, 0, d_config, &dcs->aodevs);
> +        return;
> +    }
>  
> +    domcreate_launch_dm(egc, &dcs->aodevs, 0);

Would it make sense for libxl__add_FOO to detect aodevs.size == 0 and
call the callback direct? Rather than open coding this pattern here, in
the stub dom disk case and in both the NIC cases too?


>      return;
>  
>   error_out:
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index f2e9572..667aec7 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -856,11 +856,16 @@ retry_transaction:
>          if (errno == EAGAIN)
>              goto retry_transaction;
>  
> -    sdss->aodevs.size = dm_config->num_disks;
> -    sdss->aodevs.callback = spawn_stub_launch_dm;
> -    libxl__prepare_ao_devices(ao, &sdss->aodevs);
> -    libxl__add_disks(egc, ao, dm_domid, 0, dm_config, &sdss->aodevs);
> +    if (dm_config->num_disks > 0) {
> +        sdss->aodevs.size = dm_config->num_disks;
> +        sdss->aodevs.callback = spawn_stub_launch_dm;
> +        libxl__prepare_ao_devices(ao, &sdss->aodevs);
> +        libxl__add_disks(egc, ao, dm_domid, 0, dm_config, &sdss->aodevs);
> +        free(args);
> +        return;
> +    }
>  
> +    spawn_stub_launch_dm(egc, &sdss->aodevs, 0);
>      free(args);
>      return;
>  



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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