Skip to contentSkip to conversation

domain never exits after using 'xl save'

DISCUSSION James Dingwall 2 participants 2 messages Sep 23, 2021

lore
Share & tools
lore
#0 lore raw

Hi,

This is an issue that was observed on 4.11.3 but I have reproduced on 4.14.3. After using the xl save command the associated xl create process exits which later results in the domain not being cleaned up when the guest is shutdown.

e.g.:

# xl list -v | grep d13cc54d-dcb8-4337-9dfe-3b04f671b16
guest01  15  2048     3     -b----    1555.9 d13cc54d-dcb8-4337-9dfe-3b04f671b16a        - system_u:system_r:migrate_domU_t
# ps -ef | grep d13cc54d-dcb8-4337-9dfe-3b04f671b16
root     18694     1  0 Sep22 ?        00:00:00 /usr/sbin/xl create -p /etc/xen/config/d13cc54d-dcb8-4337-9dfe-3b04f671b16a.cfg
# xl save -p guest01 /vmsave/guest01.mem
Saving to /vmsave/guest01.mem new xl format (info 0x3/0x0/2900)
xc: info: Saving domain 15, type x86 HVM
xc: Frames: 1044480/1044480  100%
xc: End of stream: 0/0    0%
# xl list -v | grep d13cc54d-dcb8-4337-9dfe-3b04f671b16
guest01  15  2048     3     --p---    1558.3 d13cc54d-dcb8-4337-9dfe-3b04f671b16a        - system_u:system_r:migrate_domU_t
# ps -ef | grep d13cc54d-dcb8-4337-9dfe-3b04f671b16
- no matches -
# xl unpause guest01
# xl list -v | grep d13cc54d-dcb8-4337-9dfe-3b04f671b16
guest01  15  2048     3     -b----    1559.0 d13cc54d-dcb8-4337-9dfe-3b04f671b16a        - system_u:system_r:migrate_domU_t
# xl shutdown guest01
# xl list -v | grep d13cc54d-dcb8-4337-9dfe-3b04f671b16
guest01  15  2048     3     ---s--    1575.8 d13cc54d-dcb8-4337-9dfe-3b04f671b16a        0 system_u:system_r:migrate_domU_t

What we would expect is that the xl create process remains running so that when the domain is later shutdown then it gets cleaned up without having to manually xl destroy.

tools/xl/xl_vmcontrol.c handle_domain_death() has (0 == DOMAIN_RESTART_NONE in xl.h)

    case LIBXL_SHUTDOWN_REASON_SUSPEND:
        LOG("Domain has suspended.");
        return 0;

The while(1) loop of create_domain() has a switch statement which handles this return value with:

            case DOMAIN_RESTART_NONE:
                LOG("Done. Exiting now");
                libxl_event_free(ctx, event);
                ret = 0;
                goto out;

Is this the expected behaviour? Would an approach to getting the behaviour we want be to change the return value from handle_domain_death() to one which doesn't trigger the exit?

Thanks,
James