Markus Groß wrote:
> Am Dienstag 24 Mai 2011 06:06:08 schrieb Jim Fehlig:
>   
>>> +
>>> +        event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED,
>>> +                                         VIR_DOMAIN_EVENT_STOPPED_SAVED);
>>> +
>>> +        if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_SAVED) != 0) {
>>> +            libxlError(VIR_ERR_INTERNAL_ERROR,
>>> +                       _("Failed to destroy domain '%d'"), dom->id);
>>> +            goto cleanup;
>>> +        }
>>>   
>>>       
>> And here call libxl_domain_destroy() directly instead of libxlVmReap(),
>> allowing the event handler to cleanup the vm.
>>
>> Can you make these changes and ensure all the save/restore issues are
>> resolved in your environment?
>>     
>
> I made these changes but this leads to another issue.
> When using the event handler to cleanup the domain
> there seems to be a race condition.
> The call to libxl_event_get_domain_death_info returns a value != 1
>   

That should be fine though.  libxl_event_get_domain_death_info() will
return 1 if the event is for the specified domid.  If it returns a value
!= 1, we goto cleanup and keep listening.

> sometimes and the domain gets not cleaned up.
>   

Did you use the force flag when invoking
libxl_event_get_domain_death_info()?  I've noticed that no events are
generated when using that flag.

> The latest version of the patch I posted in this thread earlier does
> not have this issue as it cleans up the domain directly.
>   

How about this adjustment to your latest version?  I can't find any
issues using this change, and it follows the same pattern used in xl client.

Regards,
Jim


--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -378,6 +378,9 @@ static void libxlEventHandler(int watch,
                 libxlVmReap(driver, vm, 0, VIR_DOMAIN_SHUTOFF_SHUTDOWN);
                 libxlVmStart(driver, vm, 0, -1);
                 break;
+            case SHUTDOWN_suspend:
+                libxlVmCleanup(driver, vm, VIR_DOMAIN_SHUTOFF_SAVED);
+                break;
             default:
                 VIR_INFO("Unhandled shutdown_reason %d",
info.shutdown_reason);
                 break;
@@ -1719,7 +1722,7 @@ libxlDomainSave(virDomainPtr dom, const char *to)
         event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED,
                                          VIR_DOMAIN_EVENT_STOPPED_SAVED);

-        if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_SAVED) != 0) {
+        if (libxl_domain_destroy(&priv->ctx, dom->id, 0) < 0) {
             libxlError(VIR_ERR_INTERNAL_ERROR,
                        _("Failed to destroy domain '%d'"), dom->id);
             goto cleanup;

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to