Bug 589989 - RFE: support for seemless SPICE migration
Summary: RFE: support for seemless SPICE migration
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
Depends On:
Blocks: 620748 730753
TreeView+ depends on / blocked
Reported: 2010-05-07 13:10 UTC by Daniel Berrangé
Modified: 2011-08-15 16:27 UTC (History)
9 users (show)

Fixed In Version: libvirt-0.8.1-2.el6
Doc Type: Enhancement
Doc Text:
Clone Of:
: 620748 730753 (view as bug list)
Last Closed: 2010-11-10 21:05:25 UTC
Target Upstream Version:

Attachments (Terms of Use)
spice migration (249.38 KB, image/png)
2010-07-22 13:25 UTC, weizhang
no flags Details

Description Daniel Berrangé 2010-05-07 13:10:02 UTC
Description of problem:

SPICE supports seemless reconnect of clients after migration of a guest. This is done by issing the following command on the src QEMU before migration starts

   __com.redhat_spice_migrate_info hostname port tls-port cert-subject

libvirt needs to support this feature.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Launch a guest using SPICE graphics, eg

    <graphics type='spice' port='5900' tlsPort='5901' autoport='yes' keymap='en-us'/>

2. Connect using  spicec client app
3. Trigger migration fo the guest to another host
Actual results:
The spice client disconnects after migration

Expected results:
The spice client remains connected & active throughout migration & after completion

Additional info:

Comment 2 RHEL Program Management 2010-05-07 14:07:37 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for

Comment 3 Daniel Veillard 2010-05-07 16:30:33 UTC
libvirt-0.8.1-2.el6 has been built in RHEL-6-candidate with the patch


Comment 6 Daniel Berrangé 2010-05-13 12:00:30 UTC
FYI the v1 patch for this RFE was found to contain a bug in PEER2PEER migration as per 


Comment 7 weizhang 2010-07-22 13:19:18 UTC
I test with the following steps:
1. #iptables -F
   #setenforce 0
and connect the remote connection and set nfs on both side

2. define spice.xml like this
<domain type='kvm'>
    <type arch='x86_64' machine='rhel6.0.0'>hvm</type>
    <boot dev='hd'/>
  <clock offset='utc'/>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/netfs/RHEL55-i386.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    <interface type='network'>
      <mac address='52:54:00:aa:da:4e'/>
      <source network='default'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    <serial type='pty'>
      <target port='0'/>
    <console type='pty'>
      <target port='0'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='spice' port='5900' tlsPort='5901' autoport='yes' keymap='en-us'/>
    <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>

3. #virsh define spice.xml
4. #virsh start spice
5. #/usr/libexec/spicec -h -p 5900
6. #virsh migrate --live test-mig qemu+ssh://

an error occured when doing migration: the spicec is stoped and the domain spice is destoried

pop-up information:

Unable to migrate guest:
 Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/migrate.py", line 457, in _async_migrate
    vm.migrate(dstconn, migrate_uri, rate, live, secure)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1387, in migrate
    self._backend.migrate(destconn.vmm, flags, newname, interface, rate)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 511, in migrate
    if ret is None:raise libvirtError('virDomainMigrate() failed', dom=self)
libvirtError: cannot send monitor command '{"execute":"query-migrate"}': Connection reset by peer

on /var/log/messages 

Jul 22 21:08:01 dhcp-66-92-126 abrt[3955]: saved core dump of pid 3512 (/usr/libexec/qemu-kvm) to /var/spool/abrt/ccpp-1279804074-3512.new/coredump (625086464 bytes)
Jul 22 21:08:01 dhcp-66-92-126 abrtd: Directory 'ccpp-1279804074-3512' creation detected
Jul 22 21:08:01 dhcp-66-92-126 abrtd: Size of '/var/spool/abrt' >= 1000 MB, deleting 'ccpp-1279803344-18292'
Jul 22 21:08:01 dhcp-66-92-126 libvirtd: 21:08:01.286: error : qemuMonitorJSONCommandWithFd:242 : cannot send monitor command '{"execute":"query-migrate"}': Connection reset by peer
Jul 22 21:08:01 dhcp-66-92-126 avahi-daemon[1633]: Withdrawing address record for fe80::94dc:7aff:fe17:9fbc on vnet0.
Jul 22 21:08:01 dhcp-66-92-126 kernel: virbr0: port 1(vnet0) entering disabled state
Jul 22 21:08:01 dhcp-66-92-126 kernel: device vnet0 left promiscuous mode
Jul 22 21:08:01 dhcp-66-92-126 kernel: virbr0: port 1(vnet0) entering disabled state
Jul 22 21:08:01 dhcp-66-92-126 abrtd: New crash /var/spool/abrt/ccpp-1279804074-3512, processing

on /var/log/libvirt/qemu/spice.log

handle_dev_input: stop
qemu-kvm: migration.c:295: migrate_fd_cleanup: Assertion `s->state != 2' failed.

Comment 8 Daniel Berrangé 2010-07-22 13:23:03 UTC
Please provide the libvirt guest XML and the /var/log/libvirt/qemu/$GUEST.log file. QEMU crashing doesn't sound like it'll be a bug in libvirt's seemless SPICE migration  though.

Comment 9 weizhang 2010-07-22 13:25:41 UTC
Created attachment 433694 [details]
spice migration

when migration, it occured . Look at the warning.
The MaxCrashReportSize in my system is 1000

Comment 10 weizhang 2010-07-22 13:28:23 UTC
following the comment 7

[root@dhcp-66-92-126 images]# rpm -qa libvirt
[root@dhcp-66-92-126 images]# uname -r
[root@dhcp-66-92-126 images]# rpm -qa qemu-kvm
[root@dhcp-66-92-126 images]# rpm -qa spice-client

Comment 12 Chris Lalancette 2010-08-03 11:57:39 UTC
Since this looks like a bug in qemu, I'm going to clone this over to qemu and set this back to ON_QA (but note that we may not be able to VERIFY it before we figure out the qemu problem).

Chris Lalancette

Comment 13 weizhang 2010-08-06 09:10:21 UTC
I test it again with steps of comment 7 and after migration, the spice client disconnected with WARN:

[root@dhcp-66-92-126 images]# /usr/libexec/spicec -h -p 5902
WARN    : [12952:12954] RedChannel::run: cannot resolve host address dhcp-93-195.nay.redhat.com

Comment 14 Daniel Berrangé 2010-08-06 09:19:58 UTC
This does not look like a problem with libvirt impl of SPICE migration. The warning message shows you have a missing configuration with spicec being unable to resolve the hostname.

Comment 15 weizhang 2010-08-06 09:27:37 UTC
But I have already connected before migration an no problem. After migration, it stopped

Comment 16 Daniel Berrangé 2010-08-06 09:30:27 UTC
That problem should be reported against the spice client, not libvirt.

Comment 19 Johnny Liu 2010-08-12 04:12:00 UTC
Verified this defect with libvirt-0.8.1-23.el6.x86_64, and PASSED.


1. Define a domain with spice graphic.
<graphics type='spice' port='5900' tlsPort='5901' autoport='yes' keymap='en-us'/>

2. Edit the following line in /etc/libvirt/qemu.conf:
# spice_listen = ""
spice_listen = ""

3. Restart libvirtd service

4. Start the domain on source host (
# virsh start spice

5. Use spice client to connect the domain on source host.
# /usr/libexec/spicec -h -p 5900

6. Migrate the domain to destination host (
# virsh migrate --live spice qemu+ssh://

7. Check the spice client on the source host during migration.

Found that the spice client remains connected & active throughout migration & after completion.

So this bug is fixed.

Comment 20 Johnny Liu 2010-08-12 05:03:32 UTC
BTW, about the warning in comment 13:
# /usr/libexec/spicec -h -p 5902
WARN    : [12952:12954] RedChannel::run: cannot resolve host address

It is because the destination host name - dhcp-93-195.nay.redhat.com, can not be resolved. I guess need add a entry in /etc/hosts on source host, such as:    dhcp-93-195.nay.redhat.com

Comment 21 releng-rhel@redhat.com 2010-11-10 21:05:25 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.

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