All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] libxl: support domainReset
       [not found] <1407204567-4131-1-git-send-email-jfehlig@suse.com>
@ 2014-08-05  8:33 ` Ian Campbell
       [not found] ` <1407227582.2120.3.camel@kazak.uk.xensource.com>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Ian Campbell @ 2014-08-05  8:33 UTC (permalink / raw)
  To: Jim Fehlig; +Cc: libvir-list, xen-devel

On Mon, 2014-08-04 at 20:09 -0600, Jim Fehlig wrote:
> Currently, libxl_send_trigger() does not implement the LIBXL_TRIGGER_RESET
> option,

There's a case in the switch within libxl_send_trigger which at least
purports to do so:

int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
                       libxl_trigger trigger, uint32_t vcpuid)
{
[...]
    case LIBXL_TRIGGER_RESET:
        rc = xc_domain_send_trigger(ctx->xch, domid,
                                    XEN_DOMCTL_SENDTRIGGER_RESET, vcpu
        break;

Do you mean to say that it is broken or perhaps that it doesn't match
the required semantics of domainReset?

Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found] ` <1407227582.2120.3.camel@kazak.uk.xensource.com>
@ 2014-08-05  8:41   ` Olaf Hering
       [not found]   ` <20140805084151.GA27835@aepfle.de>
  1 sibling, 0 replies; 16+ messages in thread
From: Olaf Hering @ 2014-08-05  8:41 UTC (permalink / raw)
  To: Ian Campbell; +Cc: libvir-list, Jim Fehlig, xen-devel

On Tue, Aug 05, Ian Campbell wrote:

>     case LIBXL_TRIGGER_RESET:
>         rc = xc_domain_send_trigger(ctx->xch, domid,
>                                     XEN_DOMCTL_SENDTRIGGER_RESET, vcpu
>         break;
> 
> Do you mean to say that it is broken or perhaps that it doesn't match
> the required semantics of domainReset?

This op is not implemented. And would it work for PV and HVM anyway?

Olaf

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found]   ` <20140805084151.GA27835@aepfle.de>
@ 2014-08-05  8:45     ` Ian Campbell
       [not found]     ` <1407228326.2120.15.camel@kazak.uk.xensource.com>
  1 sibling, 0 replies; 16+ messages in thread
From: Ian Campbell @ 2014-08-05  8:45 UTC (permalink / raw)
  To: Olaf Hering; +Cc: libvir-list, Jim Fehlig, xen-devel

On Tue, 2014-08-05 at 10:41 +0200, Olaf Hering wrote:
> On Tue, Aug 05, Ian Campbell wrote:
> 
> >     case LIBXL_TRIGGER_RESET:
> >         rc = xc_domain_send_trigger(ctx->xch, domid,
> >                                     XEN_DOMCTL_SENDTRIGGER_RESET, vcpu
> >         break;
> > 
> > Do you mean to say that it is broken or perhaps that it doesn't match
> > the required semantics of domainReset?
> 
> This op is not implemented.

You mean in libxc/Xen?

>  And would it work for PV and HVM anyway?

Aren't these triggers HVM only? They turn into ACPI events and things,
don't they?

I'm not sure what the intended behaviour of libvirt domainReset is, but
perhaps libxl_domain_{reboot,shutdown} is closer to what is needed?

Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found]     ` <1407228326.2120.15.camel@kazak.uk.xensource.com>
@ 2014-08-05  8:55       ` Olaf Hering
       [not found]       ` <20140805085520.GA30208@aepfle.de>
  1 sibling, 0 replies; 16+ messages in thread
From: Olaf Hering @ 2014-08-05  8:55 UTC (permalink / raw)
  To: Ian Campbell; +Cc: libvir-list, Jim Fehlig, xen-devel

On Tue, Aug 05, Ian Campbell wrote:

> On Tue, 2014-08-05 at 10:41 +0200, Olaf Hering wrote:
> > On Tue, Aug 05, Ian Campbell wrote:
> > 
> > >     case LIBXL_TRIGGER_RESET:
> > >         rc = xc_domain_send_trigger(ctx->xch, domid,
> > >                                     XEN_DOMCTL_SENDTRIGGER_RESET, vcpu
> > >         break;
> > > 
> > > Do you mean to say that it is broken or perhaps that it doesn't match
> > > the required semantics of domainReset?
> > 
> > This op is not implemented.
> 
> You mean in libxc/Xen?

In Xen itself.

> >  And would it work for PV and HVM anyway?
> 
> Aren't these triggers HVM only? They turn into ACPI events and things,
> don't they?

Most likely yes.

> I'm not sure what the intended behaviour of libvirt domainReset is, but
> perhaps libxl_domain_{reboot,shutdown} is closer to what is needed?

The original report was that 'Reset' does not work from GUI, like
virt-manager or virsh. I think the expected outcome is like pushing the
reset button on a physical board. Xen doesnt do it that way, no idea
about others.

Olaf

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found]       ` <20140805085520.GA30208@aepfle.de>
@ 2014-08-05  8:59         ` Ian Campbell
       [not found]         ` <1407229149.2120.26.camel@kazak.uk.xensource.com>
  1 sibling, 0 replies; 16+ messages in thread
From: Ian Campbell @ 2014-08-05  8:59 UTC (permalink / raw)
  To: Olaf Hering; +Cc: libvir-list, Jim Fehlig, xen-devel

On Tue, 2014-08-05 at 10:55 +0200, Olaf Hering wrote:
> On Tue, Aug 05, Ian Campbell wrote:
> 
> > On Tue, 2014-08-05 at 10:41 +0200, Olaf Hering wrote:
> > > On Tue, Aug 05, Ian Campbell wrote:
> > > 
> > > >     case LIBXL_TRIGGER_RESET:
> > > >         rc = xc_domain_send_trigger(ctx->xch, domid,
> > > >                                     XEN_DOMCTL_SENDTRIGGER_RESET, vcpu
> > > >         break;
> > > > 
> > > > Do you mean to say that it is broken or perhaps that it doesn't match
> > > > the required semantics of domainReset?
> > > 
> > > This op is not implemented.
> > 
> > You mean in libxc/Xen?
> 
> In Xen itself.
> 
> > >  And would it work for PV and HVM anyway?
> > 
> > Aren't these triggers HVM only? They turn into ACPI events and things,
> > don't they?
> 
> Most likely yes.
> 
> > I'm not sure what the intended behaviour of libvirt domainReset is, but
> > perhaps libxl_domain_{reboot,shutdown} is closer to what is needed?
> 
> The original report was that 'Reset' does not work from GUI, like
> virt-manager or virsh. I think the expected outcome is like pushing the
> reset button on a physical board. Xen doesnt do it that way, no idea
> about others.

Sounds like you want libxl_domain_reboot then, perhaps with a fallback
on ERROR_NOPARAVIRT for an HVM guest to sending a trigger.

Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found]         ` <1407229149.2120.26.camel@kazak.uk.xensource.com>
@ 2014-08-05 14:06           ` Jim Fehlig
       [not found]           ` <53E0E4DE.30506@suse.com>
  1 sibling, 0 replies; 16+ messages in thread
From: Jim Fehlig @ 2014-08-05 14:06 UTC (permalink / raw)
  To: Ian Campbell; +Cc: libvir-list, Olaf Hering, xen-devel

Ian Campbell wrote:
> On Tue, 2014-08-05 at 10:55 +0200, Olaf Hering wrote:
>   
>> The original report was that 'Reset' does not work from GUI, like
>> virt-manager or virsh. I think the expected outcome is like pushing the
>> reset button on a physical board. Xen doesnt do it that way, no idea
>> about others.
>>     
>
> Sounds like you want libxl_domain_reboot then, perhaps with a fallback
> on ERROR_NOPARAVIRT for an HVM guest to sending a trigger.
>   

Hrm, I don't think that's right .  It should be a hard reset

http://libvirt.org/html/libvirt-libvirt.html#virDomainReset

destroy/start seems the correct way to implement this.

Regards,
Jim

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found]           ` <53E0E4DE.30506@suse.com>
@ 2014-08-05 14:12             ` Ian Campbell
       [not found]             ` <1407247933.2120.37.camel@kazak.uk.xensource.com>
  1 sibling, 0 replies; 16+ messages in thread
From: Ian Campbell @ 2014-08-05 14:12 UTC (permalink / raw)
  To: Jim Fehlig; +Cc: libvir-list, Olaf Hering, xen-devel

On Tue, 2014-08-05 at 08:06 -0600, Jim Fehlig wrote:
> Ian Campbell wrote:
> > On Tue, 2014-08-05 at 10:55 +0200, Olaf Hering wrote:
> >   
> >> The original report was that 'Reset' does not work from GUI, like
> >> virt-manager or virsh. I think the expected outcome is like pushing the
> >> reset button on a physical board. Xen doesnt do it that way, no idea
> >> about others.
> >>     
> >
> > Sounds like you want libxl_domain_reboot then, perhaps with a fallback
> > on ERROR_NOPARAVIRT for an HVM guest to sending a trigger.
> >   
> 
> Hrm, I don't think that's right .  It should be a hard reset
> 
> http://libvirt.org/html/libvirt-libvirt.html#virDomainReset
> 
> destroy/start seems the correct way to implement this.

Yes, given that requirement it is. Sorry for the noise.

Would some sort of hard reset API be useful in libxl?

Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found]             ` <1407247933.2120.37.camel@kazak.uk.xensource.com>
@ 2014-08-05 15:10               ` Jim Fehlig
  2014-08-05 15:30                 ` Ian Campbell
       [not found]                 ` <1407252647.2120.45.camel@kazak.uk.xensource.com>
  0 siblings, 2 replies; 16+ messages in thread
From: Jim Fehlig @ 2014-08-05 15:10 UTC (permalink / raw)
  To: Ian Campbell; +Cc: libvir-list, Olaf Hering, xen-devel

Ian Campbell wrote:
> On Tue, 2014-08-05 at 08:06 -0600, Jim Fehlig wrote:
>   
>> Ian Campbell wrote:
>>     
>>> On Tue, 2014-08-05 at 10:55 +0200, Olaf Hering wrote:
>>>   
>>>       
>>>> The original report was that 'Reset' does not work from GUI, like
>>>> virt-manager or virsh. I think the expected outcome is like pushing the
>>>> reset button on a physical board. Xen doesnt do it that way, no idea
>>>> about others.
>>>>     
>>>>         
>>> Sounds like you want libxl_domain_reboot then, perhaps with a fallback
>>> on ERROR_NOPARAVIRT for an HVM guest to sending a trigger.
>>>   
>>>       
>> Hrm, I don't think that's right .  It should be a hard reset
>>
>> http://libvirt.org/html/libvirt-libvirt.html#virDomainReset
>>
>> destroy/start seems the correct way to implement this.
>>     
>
> Yes, given that requirement it is. Sorry for the noise.
>
> Would some sort of hard reset API be useful in libxl?
>   

Sure.  I think having an API that emulates a power reset button would be
a nice addition to libxl's domain operations.  The destroy/start
approach incurs a small bit of overhead, which would be avoided with
such an API.  Clients (perhaps incorrectly) implementing their own
notion of reset  would also be avoided.

In the absence of libxl_domain_reset(), do folks think the destroy/start
approach is acceptable?  As Olaf mentioned, it allows "Force Reset" to
work via virt-manager.

Regards,
Jim

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
  2014-08-05 15:10               ` Jim Fehlig
@ 2014-08-05 15:30                 ` Ian Campbell
       [not found]                 ` <1407252647.2120.45.camel@kazak.uk.xensource.com>
  1 sibling, 0 replies; 16+ messages in thread
From: Ian Campbell @ 2014-08-05 15:30 UTC (permalink / raw)
  To: Jim Fehlig; +Cc: libvir-list, Olaf Hering, Wei Liu, xen-devel

On Tue, 2014-08-05 at 09:10 -0600, Jim Fehlig wrote:
> Ian Campbell wrote:
> > On Tue, 2014-08-05 at 08:06 -0600, Jim Fehlig wrote:
> >   
> >> Ian Campbell wrote:
> >>     
> >>> On Tue, 2014-08-05 at 10:55 +0200, Olaf Hering wrote:
> >>>   
> >>>       
> >>>> The original report was that 'Reset' does not work from GUI, like
> >>>> virt-manager or virsh. I think the expected outcome is like pushing the
> >>>> reset button on a physical board. Xen doesnt do it that way, no idea
> >>>> about others.
> >>>>     
> >>>>         
> >>> Sounds like you want libxl_domain_reboot then, perhaps with a fallback
> >>> on ERROR_NOPARAVIRT for an HVM guest to sending a trigger.
> >>>   
> >>>       
> >> Hrm, I don't think that's right .  It should be a hard reset
> >>
> >> http://libvirt.org/html/libvirt-libvirt.html#virDomainReset
> >>
> >> destroy/start seems the correct way to implement this.
> >>     
> >
> > Yes, given that requirement it is. Sorry for the noise.
> >
> > Would some sort of hard reset API be useful in libxl?
> >   
> 
> Sure.  I think having an API that emulates a power reset button would be
> a nice addition to libxl's domain operations.  The destroy/start
> approach incurs a small bit of overhead, which would be avoided with
> such an API.  Clients (perhaps incorrectly) implementing their own
> notion of reset  would also be avoided.

I think this ought to become pretty easy once Wei's patches to record
the guest cfg in libxl are completed. Wei -- what do you think?

> In the absence of libxl_domain_reset(), do folks think the destroy/start
> approach is acceptable?

FWIW I believe it is.

>   As Olaf mentioned, it allows "Force Reset" to
> work via virt-manager.

Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found]                 ` <1407252647.2120.45.camel@kazak.uk.xensource.com>
@ 2014-08-05 16:12                   ` Wei Liu
  2014-08-05 18:45                     ` Ian Campbell
       [not found]                     ` <1407264348.23472.44.camel@dagon.hellion.org.uk>
  0 siblings, 2 replies; 16+ messages in thread
From: Wei Liu @ 2014-08-05 16:12 UTC (permalink / raw)
  To: Ian Campbell; +Cc: libvir-list, Jim Fehlig, Wei Liu, Olaf Hering, xen-devel

On Tue, Aug 05, 2014 at 04:30:47PM +0100, Ian Campbell wrote:
> On Tue, 2014-08-05 at 09:10 -0600, Jim Fehlig wrote:
> > Ian Campbell wrote:
> > > On Tue, 2014-08-05 at 08:06 -0600, Jim Fehlig wrote:
> > >   
> > >> Ian Campbell wrote:
> > >>     
> > >>> On Tue, 2014-08-05 at 10:55 +0200, Olaf Hering wrote:
> > >>>   
> > >>>       
> > >>>> The original report was that 'Reset' does not work from GUI, like
> > >>>> virt-manager or virsh. I think the expected outcome is like pushing the
> > >>>> reset button on a physical board. Xen doesnt do it that way, no idea
> > >>>> about others.
> > >>>>     
> > >>>>         
> > >>> Sounds like you want libxl_domain_reboot then, perhaps with a fallback
> > >>> on ERROR_NOPARAVIRT for an HVM guest to sending a trigger.
> > >>>   
> > >>>       
> > >> Hrm, I don't think that's right .  It should be a hard reset
> > >>
> > >> http://libvirt.org/html/libvirt-libvirt.html#virDomainReset
> > >>
> > >> destroy/start seems the correct way to implement this.
> > >>     
> > >
> > > Yes, given that requirement it is. Sorry for the noise.
> > >
> > > Would some sort of hard reset API be useful in libxl?
> > >   
> > 
> > Sure.  I think having an API that emulates a power reset button would be
> > a nice addition to libxl's domain operations.  The destroy/start
> > approach incurs a small bit of overhead, which would be avoided with
> > such an API.  Clients (perhaps incorrectly) implementing their own
> > notion of reset  would also be avoided.
> 
> I think this ought to become pretty easy once Wei's patches to record
> the guest cfg in libxl are completed. Wei -- what do you think?
> 

I don't think this "reset" API will need to record any state, i.e. this
feature looks unrelated to my work. What do I miss?

Wei.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
  2014-08-05 16:12                   ` Wei Liu
@ 2014-08-05 18:45                     ` Ian Campbell
       [not found]                     ` <1407264348.23472.44.camel@dagon.hellion.org.uk>
  1 sibling, 0 replies; 16+ messages in thread
From: Ian Campbell @ 2014-08-05 18:45 UTC (permalink / raw)
  To: Wei Liu; +Cc: libvir-list, Jim Fehlig, Olaf Hering, xen-devel

On Tue, 2014-08-05 at 17:12 +0100, Wei Liu wrote:
> On Tue, Aug 05, 2014 at 04:30:47PM +0100, Ian Campbell wrote:
> > On Tue, 2014-08-05 at 09:10 -0600, Jim Fehlig wrote:
> > > Ian Campbell wrote:
> > > > On Tue, 2014-08-05 at 08:06 -0600, Jim Fehlig wrote:
> > > >   
> > > >> Ian Campbell wrote:
> > > >>     
> > > >>> On Tue, 2014-08-05 at 10:55 +0200, Olaf Hering wrote:
> > > >>>   
> > > >>>       
> > > >>>> The original report was that 'Reset' does not work from GUI, like
> > > >>>> virt-manager or virsh. I think the expected outcome is like pushing the
> > > >>>> reset button on a physical board. Xen doesnt do it that way, no idea
> > > >>>> about others.
> > > >>>>     
> > > >>>>         
> > > >>> Sounds like you want libxl_domain_reboot then, perhaps with a fallback
> > > >>> on ERROR_NOPARAVIRT for an HVM guest to sending a trigger.
> > > >>>   
> > > >>>       
> > > >> Hrm, I don't think that's right .  It should be a hard reset
> > > >>
> > > >> http://libvirt.org/html/libvirt-libvirt.html#virDomainReset
> > > >>
> > > >> destroy/start seems the correct way to implement this.
> > > >>     
> > > >
> > > > Yes, given that requirement it is. Sorry for the noise.
> > > >
> > > > Would some sort of hard reset API be useful in libxl?
> > > >   
> > > 
> > > Sure.  I think having an API that emulates a power reset button would be
> > > a nice addition to libxl's domain operations.  The destroy/start
> > > approach incurs a small bit of overhead, which would be avoided with
> > > such an API.  Clients (perhaps incorrectly) implementing their own
> > > notion of reset  would also be avoided.
> > 
> > I think this ought to become pretty easy once Wei's patches to record
> > the guest cfg in libxl are completed. Wei -- what do you think?
> > 
> 
> I don't think this "reset" API will need to record any state, i.e. this
> feature looks unrelated to my work. What do I miss?

It's a forced reboot, so the API would need to destroy and then recreate
the domain. Recreate would need to use the state your patches arrange
for libxl to store.

Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found]                     ` <1407264348.23472.44.camel@dagon.hellion.org.uk>
@ 2014-08-05 19:30                       ` Wei Liu
       [not found]                       ` <20140805193006.GA5899@zion.uk.xensource.com>
  1 sibling, 0 replies; 16+ messages in thread
From: Wei Liu @ 2014-08-05 19:30 UTC (permalink / raw)
  To: Ian Campbell; +Cc: libvir-list, Jim Fehlig, Wei Liu, Olaf Hering, xen-devel

On Tue, Aug 05, 2014 at 07:45:48PM +0100, Ian Campbell wrote:
[...]
> > > > Sure.  I think having an API that emulates a power reset button would be
> > > > a nice addition to libxl's domain operations.  The destroy/start
> > > > approach incurs a small bit of overhead, which would be avoided with
> > > > such an API.  Clients (perhaps incorrectly) implementing their own
> > > > notion of reset  would also be avoided.
> > > 
> > > I think this ought to become pretty easy once Wei's patches to record
> > > the guest cfg in libxl are completed. Wei -- what do you think?
> > > 
> > 
> > I don't think this "reset" API will need to record any state, i.e. this
> > feature looks unrelated to my work. What do I miss?
> 
> It's a forced reboot, so the API would need to destroy and then recreate
> the domain. Recreate would need to use the state your patches arrange
> for libxl to store.
> 

Oh you were talking about pesisting state across hard reset, that's of
course achievable. I think hard reset is more or less the same as
reboot.

That's still somewhat orthogonal to my work though. Not having the
capability to presist state across in libxl doesn't prevent us from
introducing "reset". I think this is the status quo of "reboot" API,
isn't it?

Wei.


> Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found] <1407204567-4131-1-git-send-email-jfehlig@suse.com>
  2014-08-05  8:33 ` [PATCH] libxl: support domainReset Ian Campbell
       [not found] ` <1407227582.2120.3.camel@kazak.uk.xensource.com>
@ 2014-08-06 16:05 ` Jim Fehlig
  2014-09-10 19:48 ` Jim Fehlig
  3 siblings, 0 replies; 16+ messages in thread
From: Jim Fehlig @ 2014-08-06 16:05 UTC (permalink / raw)
  To: libvir-list; +Cc: xen-devel

Jim Fehlig wrote:
> Currently, libxl_send_trigger() does not implement the LIBXL_TRIGGER_RESET
> option, but domainReset can be implemented in the libxl driver by
> forcibly destroying the domain and starting it again.
>   

Any other comments on this from a libvirt perspective?

Regards,
Jim

> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
>  src/libxl/libxl_driver.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 57 insertions(+)
>
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 67fd7bc6..08018d4 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -979,6 +979,62 @@ libxlDomainReboot(virDomainPtr dom, unsigned int flags)
>  }
>  
>  static int
> +libxlDomainReset(virDomainPtr dom, unsigned int flags)
> +{
> +    libxlDriverPrivatePtr driver = dom->conn->privateData;
> +    virDomainObjPtr vm;
> +    int ret = -1;
> +    libxlDomainObjPrivatePtr priv;
> +
> +    virCheckFlags(0, -1);
> +
> +    if (!(vm = libxlDomObjFromDomain(dom)))
> +        goto cleanup;
> +
> +    if (virDomainResetEnsureACL(dom->conn, vm->def) < 0)
> +        goto cleanup;
> +
> +    if (!virDomainObjIsActive(vm)) {
> +        virReportError(VIR_ERR_OPERATION_INVALID,
> +                       "%s", _("Domain is not running"));
> +        goto cleanup;
> +    }
> +
> +    /*
> +     * The semantics of reset can be achieved by forcibly destroying
> +     * the domain and starting it again.
> +     */
> +    priv = vm->privateData;
> +    if (libxl_domain_destroy(priv->ctx, vm->def->id, NULL) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("Failed to reset domain '%d'"), vm->def->id);
> +        goto cleanup;
> +    }
> +
> +    if (!libxlDomainCleanupJob(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED)) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("Failed to cleanup domain '%d' after reset"),
> +                       vm->def->id);
> +        vm = NULL;
> +        goto cleanup;
> +    }
> +
> +    if (libxlDomainStart(driver, vm, false, -1) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("Failed to start domain '%d' after reset"),
> +                       vm->def->id);
> +        goto cleanup;
> +    }
> +
> +    ret = 0;
> +
> + cleanup:
> +    if (vm)
> +        virObjectUnlock(vm);
> +    return ret;
> +}
> +
> +static int
>  libxlDomainDestroyFlags(virDomainPtr dom,
>                          unsigned int flags)
>  {
> @@ -4758,6 +4814,7 @@ static virDriver libxlDriver = {
>      .domainShutdown = libxlDomainShutdown, /* 0.9.0 */
>      .domainShutdownFlags = libxlDomainShutdownFlags, /* 0.9.10 */
>      .domainReboot = libxlDomainReboot, /* 0.9.0 */
> +    .domainReset = libxlDomainReset, /* 1.2.8 */
>      .domainDestroy = libxlDomainDestroy, /* 0.9.0 */
>      .domainDestroyFlags = libxlDomainDestroyFlags, /* 0.9.4 */
>      .domainGetOSType = libxlDomainGetOSType, /* 0.9.0 */
>   

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found]                       ` <20140805193006.GA5899@zion.uk.xensource.com>
@ 2014-08-21 20:43                         ` Ian Campbell
  0 siblings, 0 replies; 16+ messages in thread
From: Ian Campbell @ 2014-08-21 20:43 UTC (permalink / raw)
  To: Wei Liu; +Cc: libvir-list, Jim Fehlig, Olaf Hering, xen-devel

On Tue, 2014-08-05 at 20:30 +0100, Wei Liu wrote:
> On Tue, Aug 05, 2014 at 07:45:48PM +0100, Ian Campbell wrote:
> [...]
> > > > > Sure.  I think having an API that emulates a power reset button would be
> > > > > a nice addition to libxl's domain operations.  The destroy/start
> > > > > approach incurs a small bit of overhead, which would be avoided with
> > > > > such an API.  Clients (perhaps incorrectly) implementing their own
> > > > > notion of reset  would also be avoided.
> > > > 
> > > > I think this ought to become pretty easy once Wei's patches to record
> > > > the guest cfg in libxl are completed. Wei -- what do you think?
> > > > 
> > > 
> > > I don't think this "reset" API will need to record any state, i.e. this
> > > feature looks unrelated to my work. What do I miss?
> > 
> > It's a forced reboot, so the API would need to destroy and then recreate
> > the domain. Recreate would need to use the state your patches arrange
> > for libxl to store.
> > 
> 
> Oh you were talking about pesisting state across hard reset, that's of
> course achievable. I think hard reset is more or less the same as
> reboot.
> 
> That's still somewhat orthogonal to my work though. Not having the
> capability to presist state across in libxl doesn't prevent us from
> introducing "reset". I think this is the status quo of "reboot" API,
> isn't it?

There is no "reboot" API in the sense we are talking about.
libxl_domain_reboot() asks the guest to reboot itself. The resulting
actual reboot is handled by the toolstack receiving
LIBXL_EVENT_TYPE_DOMAIN_DEATH and using libxl_domain_destroy
+libxl_domain_create to recreate the domain, prior to your changes only
the toolstack app could do this because only xl/libvirt knew the actual
domain cfg. With your changes a new libxl_domain_hard_reboot could, I
think, be written which does the reboot.

Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] libxl: support domainReset
       [not found] <1407204567-4131-1-git-send-email-jfehlig@suse.com>
                   ` (2 preceding siblings ...)
  2014-08-06 16:05 ` Jim Fehlig
@ 2014-09-10 19:48 ` Jim Fehlig
  3 siblings, 0 replies; 16+ messages in thread
From: Jim Fehlig @ 2014-09-10 19:48 UTC (permalink / raw)
  To: libvir-list; +Cc: xen-devel

Jim Fehlig wrote:
> Currently, libxl_send_trigger() does not implement the LIBXL_TRIGGER_RESET
> option, but domainReset can be implemented in the libxl driver by
> forcibly destroying the domain and starting it again.
>   

Any objections to pushing this patch?  I have several patches on the
list getting stale...

Regards,
Jim

> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
>  src/libxl/libxl_driver.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 57 insertions(+)
>
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 67fd7bc6..08018d4 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -979,6 +979,62 @@ libxlDomainReboot(virDomainPtr dom, unsigned int flags)
>  }
>  
>  static int
> +libxlDomainReset(virDomainPtr dom, unsigned int flags)
> +{
> +    libxlDriverPrivatePtr driver = dom->conn->privateData;
> +    virDomainObjPtr vm;
> +    int ret = -1;
> +    libxlDomainObjPrivatePtr priv;
> +
> +    virCheckFlags(0, -1);
> +
> +    if (!(vm = libxlDomObjFromDomain(dom)))
> +        goto cleanup;
> +
> +    if (virDomainResetEnsureACL(dom->conn, vm->def) < 0)
> +        goto cleanup;
> +
> +    if (!virDomainObjIsActive(vm)) {
> +        virReportError(VIR_ERR_OPERATION_INVALID,
> +                       "%s", _("Domain is not running"));
> +        goto cleanup;
> +    }
> +
> +    /*
> +     * The semantics of reset can be achieved by forcibly destroying
> +     * the domain and starting it again.
> +     */
> +    priv = vm->privateData;
> +    if (libxl_domain_destroy(priv->ctx, vm->def->id, NULL) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("Failed to reset domain '%d'"), vm->def->id);
> +        goto cleanup;
> +    }
> +
> +    if (!libxlDomainCleanupJob(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED)) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("Failed to cleanup domain '%d' after reset"),
> +                       vm->def->id);
> +        vm = NULL;
> +        goto cleanup;
> +    }
> +
> +    if (libxlDomainStart(driver, vm, false, -1) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("Failed to start domain '%d' after reset"),
> +                       vm->def->id);
> +        goto cleanup;
> +    }
> +
> +    ret = 0;
> +
> + cleanup:
> +    if (vm)
> +        virObjectUnlock(vm);
> +    return ret;
> +}
> +
> +static int
>  libxlDomainDestroyFlags(virDomainPtr dom,
>                          unsigned int flags)
>  {
> @@ -4758,6 +4814,7 @@ static virDriver libxlDriver = {
>      .domainShutdown = libxlDomainShutdown, /* 0.9.0 */
>      .domainShutdownFlags = libxlDomainShutdownFlags, /* 0.9.10 */
>      .domainReboot = libxlDomainReboot, /* 0.9.0 */
> +    .domainReset = libxlDomainReset, /* 1.2.8 */
>      .domainDestroy = libxlDomainDestroy, /* 0.9.0 */
>      .domainDestroyFlags = libxlDomainDestroyFlags, /* 0.9.4 */
>      .domainGetOSType = libxlDomainGetOSType, /* 0.9.0 */
>   

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] libxl: support domainReset
@ 2014-08-05  2:09 Jim Fehlig
  0 siblings, 0 replies; 16+ messages in thread
From: Jim Fehlig @ 2014-08-05  2:09 UTC (permalink / raw)
  To: libvir-list; +Cc: Jim Fehlig, xen-devel

Currently, libxl_send_trigger() does not implement the LIBXL_TRIGGER_RESET
option, but domainReset can be implemented in the libxl driver by
forcibly destroying the domain and starting it again.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 src/libxl/libxl_driver.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 67fd7bc6..08018d4 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -979,6 +979,62 @@ libxlDomainReboot(virDomainPtr dom, unsigned int flags)
 }
 
 static int
+libxlDomainReset(virDomainPtr dom, unsigned int flags)
+{
+    libxlDriverPrivatePtr driver = dom->conn->privateData;
+    virDomainObjPtr vm;
+    int ret = -1;
+    libxlDomainObjPrivatePtr priv;
+
+    virCheckFlags(0, -1);
+
+    if (!(vm = libxlDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (virDomainResetEnsureACL(dom->conn, vm->def) < 0)
+        goto cleanup;
+
+    if (!virDomainObjIsActive(vm)) {
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("Domain is not running"));
+        goto cleanup;
+    }
+
+    /*
+     * The semantics of reset can be achieved by forcibly destroying
+     * the domain and starting it again.
+     */
+    priv = vm->privateData;
+    if (libxl_domain_destroy(priv->ctx, vm->def->id, NULL) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to reset domain '%d'"), vm->def->id);
+        goto cleanup;
+    }
+
+    if (!libxlDomainCleanupJob(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED)) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to cleanup domain '%d' after reset"),
+                       vm->def->id);
+        vm = NULL;
+        goto cleanup;
+    }
+
+    if (libxlDomainStart(driver, vm, false, -1) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to start domain '%d' after reset"),
+                       vm->def->id);
+        goto cleanup;
+    }
+
+    ret = 0;
+
+ cleanup:
+    if (vm)
+        virObjectUnlock(vm);
+    return ret;
+}
+
+static int
 libxlDomainDestroyFlags(virDomainPtr dom,
                         unsigned int flags)
 {
@@ -4758,6 +4814,7 @@ static virDriver libxlDriver = {
     .domainShutdown = libxlDomainShutdown, /* 0.9.0 */
     .domainShutdownFlags = libxlDomainShutdownFlags, /* 0.9.10 */
     .domainReboot = libxlDomainReboot, /* 0.9.0 */
+    .domainReset = libxlDomainReset, /* 1.2.8 */
     .domainDestroy = libxlDomainDestroy, /* 0.9.0 */
     .domainDestroyFlags = libxlDomainDestroyFlags, /* 0.9.4 */
     .domainGetOSType = libxlDomainGetOSType, /* 0.9.0 */
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-09-10 19:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1407204567-4131-1-git-send-email-jfehlig@suse.com>
2014-08-05  8:33 ` [PATCH] libxl: support domainReset Ian Campbell
     [not found] ` <1407227582.2120.3.camel@kazak.uk.xensource.com>
2014-08-05  8:41   ` Olaf Hering
     [not found]   ` <20140805084151.GA27835@aepfle.de>
2014-08-05  8:45     ` Ian Campbell
     [not found]     ` <1407228326.2120.15.camel@kazak.uk.xensource.com>
2014-08-05  8:55       ` Olaf Hering
     [not found]       ` <20140805085520.GA30208@aepfle.de>
2014-08-05  8:59         ` Ian Campbell
     [not found]         ` <1407229149.2120.26.camel@kazak.uk.xensource.com>
2014-08-05 14:06           ` Jim Fehlig
     [not found]           ` <53E0E4DE.30506@suse.com>
2014-08-05 14:12             ` Ian Campbell
     [not found]             ` <1407247933.2120.37.camel@kazak.uk.xensource.com>
2014-08-05 15:10               ` Jim Fehlig
2014-08-05 15:30                 ` Ian Campbell
     [not found]                 ` <1407252647.2120.45.camel@kazak.uk.xensource.com>
2014-08-05 16:12                   ` Wei Liu
2014-08-05 18:45                     ` Ian Campbell
     [not found]                     ` <1407264348.23472.44.camel@dagon.hellion.org.uk>
2014-08-05 19:30                       ` Wei Liu
     [not found]                       ` <20140805193006.GA5899@zion.uk.xensource.com>
2014-08-21 20:43                         ` Ian Campbell
2014-08-06 16:05 ` Jim Fehlig
2014-09-10 19:48 ` Jim Fehlig
2014-08-05  2:09 Jim Fehlig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.