Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2169967

Summary: [session mode]vm can't be listed by "virsh list" after live migration
Product: Red Hat Enterprise Linux 9 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
libvirt sub component: Live Migration QA Contact: Virtualization Bugs <virt-bugs>
Status: CLOSED NOTABUG Docs Contact:
Severity: unspecified    
Priority: unspecified CC: chhu, nilal, virt-maint, yafu, yalzhang
Version: 9.2Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-02-16 03:23:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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