Bug 1360963

Summary: Migrate a guest with ccid smartcard from RHEL7.3 to RHEL7.2 failed.
Product: Red Hat Enterprise Linux 7 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED CANTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: chayang, dgilbert, dyuan, huding, jdenemar, jtomko, juzhang, mzhan, rbalakri, yafu, yanqzhan, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-07 16:13:35 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 2016-07-28 03:28:39 UTC
Description of problem:
Start a guest with ccid smartcard on RHEL7.3 host, then migrate it RHEL7.2 host, migration failed with error "Controllers must use the 'pci' address type"

# virsh migrate rhel7.2 qemu+ssh://10.66.4.113/system --live --verbose
error: internal error: Controllers must use the 'pci' address type

Version-Release number of selected component:
RHEL7.2:
libvirt-1.2.17-13.el7.x86_64
qemu-kvm-rhev-2.3.0-31.el7.x86_64

RHEL7.3:
libvirt-2.0.0-3.el7.x86_64
qemu-kvm-rhev-2.6.0-15.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
0. On rhel7.3 host, prepare a guest xml with smartcard:
# cat rhel7.2.xml
...
    <smartcard mode='passthrough' type='spicevmc'>
      <address type='ccid' controller='0' slot='0'/>
    </smartcard>
...

1. # virsh define rhel7.2.xml

2. # virsh dumpxml rhel7.2
...
    <controller type='ccid' index='0'>
      <address type='usb' bus='0' port='1'/>
    </controller>                             
===> The above three lines are added by libvirt automatically.
...
    <smartcard mode='passthrough' type='spicevmc'>
      <address type='ccid' controller='0' slot='0'/>
    </smartcard>
...

3. # virsh start rhel7.2

4. Migrate the guest to RHEL7.2 host


Actual results:
Migration failed

Expected results:
Migration can succeed.


Additional info:
If define the guest on RHEL7.2 host with exactly same xml, the dumpxml is as:
# virsh define rhel7.2.xml

# virsh dumpxml rhel7.2
...
    <controller type='ccid' index='0'/>
...
    <smartcard mode='passthrough' type='spicevmc'>
      <address type='ccid' controller='0' slot='0'/>
    </smartcard>
...

Comment 2 Ján Tomko 2016-08-16 14:31:07 UTC
Since older libvirt does not support specifying USB addresses for usb-ccid controllers, such domain cannot be reliably migrated.

We can try omitting the USB address in migration XML, which should work as long as QEMU on the destination makes up the same address as we gave it on the source.

But if it does not, there can be a clash with other devices which have an address assigned in the XML.

If that fails, WONTFIX/CANTFIX?

Comment 3 Dr. David Alan Gilbert 2016-08-16 16:09:35 UTC
I'd recommend not setting the USB address except on hosts with a new machine type; that way machine types that can migrate backwards are as safe/broken as they were before, but new machines are safe.

Note that QEMU migration previously worked reliably with USB devices as long as they were either:
  a) Added in the same order on both command lines
  b) The only device on a particular USB controller

So actually most USB migrations worked; it was normally only hotplugging which broke things; so we shouldn't make it any worse than that, and thus I think it needs fixing.

Comment 4 Dr. David Alan Gilbert 2016-08-16 16:09:51 UTC
I'd recommend not setting the USB address except on VMs with a new machine type; that way machine types that can migrate backwards are as safe/broken as they were before, but new machines are safe.

Note that QEMU migration previously worked reliably with USB devices as long as they were either:
  a) Added in the same order on both command lines
  b) The only device on a particular USB controller

So actually most USB migrations worked; it was normally only hotplugging which broke things; so we shouldn't make it any worse than that, and thus I think it needs fixing.

Comment 5 Ján Tomko 2016-08-17 16:18:03 UTC
Thanks, that would work for downstream.

But upstream we cannot make assumptions on libvirt versions based on the machine type version. And I realized that depending on the use case, the solution I proposed in comment 2 might break more things than fix. I have sent a mail to the upstream list to see if anyone has a better idea:
https://www.redhat.com/archives/libvir-list/2016-August/msg00875.html

Comment 6 Dr. David Alan Gilbert 2016-08-17 16:29:48 UTC
(In reply to Ján Tomko from comment #5)
> Thanks, that would work for downstream.
> 
> But upstream we cannot make assumptions on libvirt versions based on the
> machine type version. And I realized that depending on the use case, the
> solution I proposed in comment 2 might break more things than fix. I have
> sent a mail to the upstream list to see if anyone has a better idea:
> https://www.redhat.com/archives/libvir-list/2016-August/msg00875.html

Hmm that's tricky then.
My other suggestion would be not adding addresses unless an addr=auto tag was in the xml, but then when do you add that tag? Only if you somehow know all your libvirts you could migrate to are going to do it.

Dave

Comment 9 Ján Tomko 2016-09-07 16:13:35 UTC
I'm afraid this cannot be reasonably fixed, apart from reverting the address assignment completely.