Re: [Xen-devel] [PATCH v2 1/2] libxl: rename libxlConsoleCallback

2015-12-02 Thread Joao Martins


On 12/02/2015 12:08 AM, Jim Fehlig wrote:
> 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 
>> ---
>>  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.
I see, I wasn't aware of that.

> 
> 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.
OK, Thanks for all the feedback!

Regards,
Joao

> 
> Regards,
> Jim
> 

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


Re: [Xen-devel] [PATCH v2 1/2] libxl: rename libxlConsoleCallback

2015-12-01 Thread Jim Fehlig
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 
> ---
>  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


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