Bug 2169967 - [session mode]vm can't be listed by "virsh list" after live migration
Summary: [session mode]vm can't be listed by "virsh list" after live migration
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-02-15 09:07 UTC by Fangge Jin
Modified: 2023-04-03 13:47 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-02-16 03:23:59 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-148699 0 None None None 2023-02-15 09:07:51 UTC

Description Fangge Jin 2023-02-15 09:07:08 UTC
Description of problem:
Start and migrate vm in session mode, after migration, try to list vm by "virsh list", vm can't be listed.

Version-Release number of selected component (if applicable):
libvirt-9.0.0-5.el9.x86_64
libvirt-8.5.0-7.4.el9_1.x86_64
libvirt-8.0.0-8.5.el9_0.x86_64
libvirt-8.0.0-5.6.module+el8.6.0
libvirt-7.0.0-14.1.module+el8.4.0


How reproducible:
100%

Steps to Reproduce:
1. Start a vm in session node

2. Migrate vm to another host
$ virsh migrate vm qemu+ssh://{target_host}/session --live --p2p --undefinesource --persistent

3. Try to list vm on target host
$ virsh list
 Id   Name   State
--------------------


$ virsh list --all
 Id   Name   State
-----------------------
 -    vm     shut off


Actual results:
As step3, active vm can't be listed after migration in session mode.

Expected results:
Active vm can be listed after migration in session mode.


Additional info:
For local booted vm, the "run" dir has following content:
└── /home/fjin/.cache/libvirt/qemu/run
    ├── /home/fjin/.cache/libvirt/qemu/run/autostarted
    ├── /home/fjin/.cache/libvirt/qemu/run/dbus
    ├── /home/fjin/.cache/libvirt/qemu/run/driver.pid
    ├── /home/fjin/.cache/libvirt/qemu/run/passt
    ├── /home/fjin/.cache/libvirt/qemu/run/slirp
    ├── /home/fjin/.cache/libvirt/qemu/run/vm.pid
    └── /home/fjin/.cache/libvirt/qemu/run/vm.xml

For migrated vm, the "run" dir has following content:
└── /home/fjin/.cache/libvirt/qemu/run
    ├── /home/fjin/.cache/libvirt/qemu/run/autostarted
    ├── /home/fjin/.cache/libvirt/qemu/run/dbus
    ├── /home/fjin/.cache/libvirt/qemu/run/passt
    └── /home/fjin/.cache/libvirt/qemu/run/slirp

Comment 2 Fangge Jin 2023-02-15 09:33:55 UTC
Additional info:
This bug can't be reproduced with unix protocol:
$ virsh migrate vm --desturi qemu+unix:///session?socket=/tmp/22222-sock --live --p2p --migrateuri unix:///tmp/33333-sock

Comment 3 yafu 2023-02-16 01:31:22 UTC
Hi Fangge,

I think it's not a bug. The guest can be listed if you login the target host with non-root user directly instead of login with root user then switching to 
non-root user, because the env is different between these two ways.
So we can list the guest on the target host after migration by:
(1)Login the target host with non-root user directly, execute 'virsh list'
(2)List the guest on the remote host: $ virsh -c qemu+ssh://test@*.*.com/session list

And the pid file of guest is:
$ ll $XDG_RUNTIME_DIR/libvirt/qemu/run/
total 24
-rw-------. 1 test test     0 Feb 15 10:12 autostarted
drwxrwx---. 2 test test    40 Feb 15 10:12 dbus
-rw-r--r--. 1 test test     7 Feb 15 10:12 driver.pid
drwxr-xr-x. 2 test test    40 Feb 15 10:12 passt
drwxr-xr-x. 2 test test    40 Feb 15 10:12 slirp
drwxrwx---. 2 test test    80 Feb 15 10:23 swtpm
-rw-r--r--. 1 test test     7 Feb 15 10:23 test.pid
-rw-------. 1 test test 16261 Feb 15 10:23 test.xml


Note You need to log in before you can comment on or make changes to this bug.