Bug 861331

Summary: Allow non-seamless migration of vms with usb-redir devices
Product: Red Hat Enterprise Linux 6 Reporter: Hans de Goede <hdegoede>
Component: qemu-kvmAssignee: Hans de Goede <hdegoede>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: acathrow, areis, bsarathy, dyasny, juzhang, mkenneth, qzhang, qzhou, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.327.el6 Doc Type: Release Note
Doc Text:
Guest Live Migration Using USB Forwarding via SPICE In Red Hat Enterprise Linux 6.4, KVM supports live migration of guests using USB forwarding via SPICE, while maintaining existing USB device redirection for all configured devices.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:40:08 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 Hans de Goede 2012-09-28 07:56:49 UTC
In 6.4 we will have / allow migration of vms with usb-redir devices. Currently the receiving side of the migration will fail the migration if it detects that it is non seamless. This also means that vms with usb-redir devices saved to disk cannot be restored!

I've posted a patch-set upstream:
http://lists.gnu.org/archive/html/qemu-devel/2012-09/msg04880.html
http://lists.gnu.org/archive/html/qemu-devel/2012-09/msg04879.html

Which changes the usb-redir device to not fail migration in the non-seamless case, instead it will
report the devices as disconnected to the guest immediately after the migration.

This allows migration of vms with a non-seamless capable client connected and also allows restoring vms saved to disk, as such I believe it is desirable to have this behavior in RHEL-6 too.

Comment 3 Qunfang Zhang 2012-10-16 04:58:15 UTC
Reproduced on qemu-kvm-0.12.1.2-2.323.el6, migration failed on the destination side with usb-redir devices.
Steps:
1. Boot guest with usb redirection
-device usb-ehci,id=ehci,addr=0x7 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=ehci.0,debug=3

2. Connect spice client with spicy tools (provided by spice-gtk-tools)

3. Select "Auto redirect newly plugged in USB devices" in "Option" menu. And then plug a USB disk to spice client host.
  
4. Migrate guest.
(qemu) __com.redhat_spice_migrate_info $dst_host_ip $dst_host_port 
(qemu) migrate -d tcp:$dst_host_ip:5800

Result:
Migration failed on dst host:

(qemu) red_dispatcher_loadvm_commands: 
qemu-kvm: usb-redir error: get_parser called with closed chardev, failing migration
qemu: warning: error while loading state for instance 0x0 of device '0000:00:07.0/1/usb-redir'

Verified on qemu-kvm-0.12.1.2-2.327.el6:

(1) seamless-migration (seamless-migration=on):
Test with the same steps as above, migration finished successfully and the usb disk is still over there, can read/write the USB disk.

(2) Non seamless migration (seamless-migraton=off):
Migration could finish successfully. But usb disk is gone inside guest after migration.  
Some qemu log:

(qemu) main_channel_link: add main channel client
red_dispatcher_loadvm_commands: 
main_channel_send_item: Init msg for client 0x7fbba91286d0 was not sent yet (client is probably during semi-seamless migration). Ignoring msg type 103
main_channel_send_item: Init msg for client 0x7fbba91286d0 was not sent yet (client is probably during semi-seamless migration). Ignoring msg type 116
qemu-kvm: usb-redir warning: usb-redir connection broken during migration

Hi, Hans
I have two questions:
(1) Is it the expected result that the usb-redir connection broken during migration with the non seamless migration? Why? 
(2) What does it mean in your bug description: "This allows migration of vms with a non-seamless capable client connected and also allows restoring vms saved to disk"?  What does the "allows restoring vms saved to disk"? 


Thanks,
Qunfang

Comment 4 Hans de Goede 2012-10-16 08:07:05 UTC
(In reply to comment #3)
> Hi, Hans
> I have two questions:
> (1) Is it the expected result that the usb-redir connection broken during
> migration with the non seamless migration?

Yes

> Why? 

Successfull migration with USB-devices enabled requires seamless migration. The reason we
want to also allow it without seamless is because of 2:

> (2) What does it mean in your bug description: "This allows migration of vms
> with a non-seamless capable client connected and also allows restoring vms
> saved to disk"?  What does the "allows restoring vms saved to disk"? 

What I mean is that it allows migrate to / from disk, which can be used to save
the state of a vm to disk to later restore it. Without this patch the restoring
would be impossible, as it would detect a non seamless migration and abort the
migrate from disk.

Regards,

Hans

Comment 5 Qunfang Zhang 2012-10-17 09:27:43 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Hi, Hans
> > I have two questions:
> > (1) Is it the expected result that the usb-redir connection broken during
> > migration with the non seamless migration?
> 
> Yes
> 
> > Why? 
> 
> Successfull migration with USB-devices enabled requires seamless migration.
> The reason we
> want to also allow it without seamless is because of 2:
> 
> > (2) What does it mean in your bug description: "This allows migration of vms
> > with a non-seamless capable client connected and also allows restoring vms
> > saved to disk"?  What does the "allows restoring vms saved to disk"? 
> 
> What I mean is that it allows migrate to / from disk, which can be used to
> save
> the state of a vm to disk to later restore it. Without this patch the
> restoring
> would be impossible, as it would detect a non seamless migration and abort
> the
> migrate from disk.
> 
> Regards,
> 
> Hans

OK, so this bug can be verified pass, right? BTW, when do we plan to allow the successfully migration with usb-redirection devices with non seamless migration? Do we have a bz to track it? 

Thanks,
Qunfang

Comment 6 Hans de Goede 2012-10-17 10:23:56 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > Hi, Hans
> > > I have two questions:
> > > (1) Is it the expected result that the usb-redir connection broken during
> > > migration with the non seamless migration?
> > 
> > Yes
> > 
> > > Why? 
> > 
> > Successfull migration with USB-devices enabled requires seamless migration.
> > The reason we
> > want to also allow it without seamless is because of 2:
> > 
> > > (2) What does it mean in your bug description: "This allows migration of vms
> > > with a non-seamless capable client connected and also allows restoring vms
> > > saved to disk"?  What does the "allows restoring vms saved to disk"? 
> > 
> > What I mean is that it allows migrate to / from disk, which can be used to
> > save
> > the state of a vm to disk to later restore it. Without this patch the
> > restoring
> > would be impossible, as it would detect a non seamless migration and abort
> > the
> > migrate from disk.
> > 
> > Regards,
> > 
> > Hans
> 
> OK, so this bug can be verified pass, right?

Right.

> BTW, when do we plan to allow
> the successfully migration with usb-redirection devices with non seamless
> migration?

Never, migration with usb-redirection devices connected, and keeping them
connected after migration is only supported with seamless migraton.

Comment 7 Qunfang Zhang 2012-10-17 11:40:42 UTC
OK, get it and thank you.

Comment 9 errata-xmlrpc 2013-02-21 07:40:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0527.html