Bug 507304

Summary: Re-detection of transient VMs not working with migrated domains
Product: [Community] Virtualization Tools Reporter: Federico Simoncelli <federico.simoncelli>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: berrange, crobinso, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 507537 (view as bug list) Environment:
Last Closed: 2009-06-27 13:49:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test1.xml
none
test1-node1.xml
none
test1-node2.xml
none
libvirtd-debug.log
none
libvirt-0.6.5-save-status-on-migration.patch none

Description Federico Simoncelli 2009-06-22 09:18:59 UTC
Description of problem:
The "re-detection of transient VMs after libvirtd restart" seems not to work if the transient domain was migrated.

Version-Release number of selected component (if applicable):
libvirt-0.6.4 + "Fix re-detection of transient VMs after libvirtd restart" patch.

Ref:
http://git.et.redhat.com/?p=libvirt.git;a=commit;h=524188b221f5e8dc66a7f203e1633dab3aa8dcf2

(I searched for other related fix which might affect my tests but I didn't find any).

Steps to Reproduce:
1. Start a transient vm on one node.
2. Migrate the vm to a second node.
3. Restart libvirtd daemon on the second node.
  
Actual results:
The vm now is in the "pause" status and on destroy it remains defined.

Expected results:
The vm should be in the "running" status and a destroy should completely remove the vm from the defined domains.

Additional info:

[root@node1 ~]# ls /var/run/libvirt/qemu/
[root@node1 ~]# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
[root@node1 ~]# virsh list --all
 Id Name                 State
----------------------------------

[root@node2 ~]# ls /var/run/libvirt/qemu/
[root@node2 ~]# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
[root@node2 ~]# virsh list --all
 Id Name                 State
----------------------------------

[root@node1 ~]# virsh create test1.xml 
Domain test1 created from test1.xml

[root@node1 ~]# virsh list --all
 Id Name                 State
----------------------------------
  1 test1                running

[root@node1 ~]# virsh migrate test1 qemu+ssh://node2/system

[root@node1 ~]# virsh list --all
 Id Name                 State
----------------------------------

[root@node2 ~]# virsh list --all
 Id Name                 State
----------------------------------
  1 test1                running

[root@node2 ~]# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
# virsh list --all
 Id Name                 State
----------------------------------
  1 test1                paused

[root@node2 ~]# virsh destroy test1
Domain test1 destroyed

[root@node2 ~]# virsh list --all
 Id Name                 State
----------------------------------
  - test1                shut off

Comment 1 Federico Simoncelli 2009-06-22 13:19:43 UTC
Created attachment 348891 [details]
test1.xml

VM test1.xml creation file.

Comment 2 Federico Simoncelli 2009-06-22 13:21:23 UTC
Created attachment 348892 [details]
test1-node1.xml

VM test1 xml file before migration:
# cp /var/run/libvirt/qemu/test1.xml test1-node1.xml

Comment 3 Federico Simoncelli 2009-06-22 13:22:29 UTC
Created attachment 348893 [details]
test1-node2.xml

VM test1 xml file after migration:
# cp /var/run/libvirt/qemu/test1.xml test1-node1.xml

Comment 4 Federico Simoncelli 2009-06-22 13:24:14 UTC
Created attachment 348894 [details]
libvirtd-debug.log

libvirtd debug on restart.

Comment 5 Daniel Veillard 2009-06-22 13:32:33 UTC
Hum, 

paphio:~ -> diff test1-node1.xml test1-node2.xml 
1,3c1,3
< <domstatus state='running' pid='6969'>
<   <monitor path='/dev/pts/12'/>
< <domain type='kvm' id='9'>
---
> <domstatus state='paused' pid='7290'>
>   <monitor path='/dev/pts/7'/>
> <domain type='kvm' id='6'>

  So I would think it's that when the migration is started on node2 the
domain is defined as paused but we forget to mark it as running once the
migration completed and the guest is actually resumed.

Daniel

Comment 6 Federico Simoncelli 2009-06-23 07:36:30 UTC
Created attachment 349050 [details]
libvirt-0.6.5-save-status-on-migration.patch

Proposed patch.

Comment 7 Federico Simoncelli 2009-06-23 08:00:56 UTC
I should point out that the patch I posted resolves only the "paused" issue.
If you destroy a migrated transient domain it sill remain defined. (Expected result: the migrated transient domain should be completely removed).

Comment 8 Daniel Berrangé 2009-06-23 09:13:56 UTC
This patch looks suitable for committing upstream to me

Comment 9 Daniel Veillard 2009-06-27 13:49:12 UTC
Yup applied upstream, so that will make 0.6.5,

  thanks !

Daniel