[libvirt] [PATCH v2 1/2] libxl: rename libxlConsoleCallback

Jim Fehlig jfehlig at suse.com
Wed Dec 2 00:08:53 UTC 2015


On 11/23/2015 11:56 AM, Joao Martins wrote:
> . to a more generic name i.e. libxlDomainStartCallback,
> since it will now cover another case other than the console.
>
> Signed-off-by: Joao Martins <joao.m.martins at oracle.com>
> ---
>  src/libxl/libxl_domain.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 40dcea1..a7267b0 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -854,7 +854,7 @@ libxlDomainFreeMem(libxl_ctx *ctx, libxl_domain_config *d_config)
>  }
>  
>  static void
> -libxlConsoleCallback(libxl_ctx *ctx, libxl_event *ev, void *for_callback)
> +libxlDomainStartCallback(libxl_ctx *ctx, libxl_event *ev, void *for_callback)
>  {
>      virDomainObjPtr vm = for_callback;
>      size_t i;
> @@ -988,7 +988,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
>      virObjectUnlock(vm);
>  
>      aop_console_how.for_callback = vm;
> -    aop_console_how.callback = libxlConsoleCallback;
> +    aop_console_how.callback = libxlDomainStartCallback;

Before pushing, I wanted to change the 'aop_console_how' variable to something
more generic too, but realized it is the 'const libxl_asyncprogress_how
*aop_console_how' parameter to libxl_domain_create_{new,restore}. AFAICT, this
callback is invoked when a console becomes available for the domain. It might be
possible that network devices have not been created (devid = -1) when the
callback is invoked. I thought about adding a separate libxlDomainStartCallback
and registering it with the 'const libxl_asyncop_how *ao_how' parameter, but
this would change the synchronous behavior of libxlDomainStart and be quite a
bit more intrusive.

In the end, I think it is best to explicitly call a function that creates the
ifnames after a successful libxl_domain_create_{new,restore}. See my reply to
2/2 for an example of this idea.

Regards,
Jim




More information about the libvir-list mailing list