Bug 822916 - pre-migration hook just cat guest xml file on destination will get error
pre-migration hook just cat guest xml file on destination will get error
Status: CLOSED DEFERRED
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
unspecified
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Jiri Denemark
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-18 09:50 EDT by EricLee
Modified: 2016-04-26 12:22 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-03-23 18:01:59 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
the xml file (2.92 KB, application/xml)
2012-05-23 07:14 EDT, EricLee
no flags Details
case 1 guest xml (2.25 KB, text/xml)
2012-05-29 02:26 EDT, zhpeng
no flags Details
case 2 guest xml (2.24 KB, text/plain)
2012-05-29 02:27 EDT, zhpeng
no flags Details
case 1 guest xml new (2.25 KB, text/plain)
2012-05-31 22:46 EDT, zhpeng
no flags Details
case 1 migrated xml (2.25 KB, text/plain)
2012-05-31 22:46 EDT, zhpeng
no flags Details
case 2 guest xml new (2.24 KB, text/plain)
2012-05-31 22:47 EDT, zhpeng
no flags Details
case 2 migrated xml (2.25 KB, text/plain)
2012-05-31 22:47 EDT, zhpeng
no flags Details

  None (edit)
Description EricLee 2012-05-18 09:50:09 EDT
Description of problem:
pre-migration hook just cat guest xml file on destination will get error

Version-Release number of selected component (if applicable):
libvirt-0.9.10-20.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.292.el6.x86_64
kernel-2.6.32-272.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a nfs server

write /etc/exports with

/var/lib/libvirt/images    *(rw,no_root_squash,async)

Then start nfs service

# service nfs start

Stop iptables

# iptables -F

2. Prepare 2 different hosts(my machines are DELL OPTIPLEX 760 and DELL OPTIPLEX 755) and mount nfs dir on both hosts in the same dir, and setting the virt_use_nfs boolean on both sides

on host1

  # mount  $NFS_IP:/var/lib/libvirt/images /mnt/7191nfs  -o vers=3

on host2

  # mount  $NFS_IP:/var/lib/libvirt/images /mnt/7191nfs  -o vers=3

  # setsebool -P virt_use_nfs 1

   and close the iptable on both sides

  # iptables -F
  
3. Start guest:
   # virsh start mig

4. Add hooks in both hosts:
source:
   # cat /etc/libvirt/hooks/qemu
   #!/bin/bash
   echo "$0" "$@" >> /tmp/qemu.log
   exit 0
target:
   # cat /etc/libvirt/hooks/qemu
   #!/bin/bash
   echo "$0" "$@" >> /tmp/qemu.log
   exit 0

  And add execute permission for this file on both sides

  # chmod +x /etc/libvirt/hooks/qemu

  Restart libvirtd service on both sides

  # service libvirtd restart

5. Do migration:
# virsh migrate --live mig qemu+ssh://10.66.5.143/system --verbose

Succeed without error as expected.

6. But just modified the /etc/libvirt/hooks/qemu file in target host to :
   # cat /etc/libvirt/hooks/qemu
   #!/bin/bash
   echo "$0" "$@" >> /tmp/qemu.log
   cat /mnt/719nfs/mig.xml
   exit 0

and dumpxml source guest xml to /mnt/7191nfs/ dir
   # virsh dumpxml mig > /mnt/7191nfs/mig.xml

Restart libvirtd service on both sides

  # service libvirtd restart

Do migration:
# virsh migrate --live mig qemu+ssh://10.66.5.143/system --verbose
error: unsupported configuration: Target device address type pci does not match source none

Actual results:
As steps.
And target machine's libvirtd get log:
# cat /var/log/libvirt/libvirtd.log
2012-05-18 13:47:26.861+0000: 7918: error : virDomainDeviceInfoCheckABIStability:9236 : unsupported configuration: Target device address type pci does not match source none

Expected results:
Migration succeed without error.

Additional info:
Two same machines will not get error.
Comment 2 Jiri Denemark 2012-05-21 05:29:03 EDT
This is most likely not a bug. The pre-migration hook is wrong, the XML you get with virsh dumpxml may be different from the XML used for migration. Within the hook script, you need to use the XML passed to stdin of the script.

Anyway, if you attach the XML the script got on its stdin and the XML you got with virsh dumpxml, I can check that the failure is correct.
Comment 3 EricLee 2012-05-23 07:13:14 EDT
Hi Jiri,

Sorry to tell you that I can not reproduce the bug because I have updated my hosts' OS. And mounting the nfs server to two different dir is alse working well now. 

I will attach my xml file, and I used the same file in the hooks' configuration, and it works well now.

So I will close it as workforme, and I will reopen it if I reproduce it again in the future, how do you think ?
Comment 4 EricLee 2012-05-23 07:14:39 EDT
Created attachment 586307 [details]
the xml file
Comment 5 zhpeng 2012-05-29 02:23:51 EDT
I retest this issue with:
libvirt-client-0.9.10-21.el6.x86_64
libvirt-python-0.9.10-21.el6.x86_64
libvirt-0.9.10-21.el6.x86_64

qemu-img-rhev-0.12.1.2-2.294.el6.x86_64
qemu-kvm-rhev-tools-0.12.1.2-2.294.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.294.el6.x86_64

I tested 2 ways, 1, source and target mount the pool to the same location. 2, source and target mount the pool to different location

1,source: mount -o vers=3 10.66.6.209:/virt /var/lib/libvirt/images/
  target: mount -o vers=3 10.66.6.209:/virt /var/lib/libvirt/images/
  
  source hook:
  #!/bin/bash
  echo "$0" "$@" >> /tmp/qemu.log
  exit 0
  
  target hook:
  #!/bin/bash
  echo "$0" "$@" >> /tmp/qemu.log
  cat /var/lib/libvirt/images/mig.xml
  exit 0

 virsh # migrate aaa --live qemu+ssh://10.66.7.230/system
error: unsupported configuration: Target controller type usb does not match source virtio-serial

 # tail /var/log/libvirt/libvirtd.log
...
2012-05-29 06:17:59.451+0000: 3027: error : virDomainControllerDefCheckABIStability:9365 : unsupported configuration: Target controller type usb does not match source virtio-serial

2,source: mount -o vers=3 10.66.6.209:/virt /var/lib/libvirt/images/
  target: mount -o vers=3 10.66.6.209:/virt /mnt

  source hook:
  #!/bin/bash
  echo "$0" "$@" >> /tmp/qemu.log
  exit 0

  target hook:
  #!/bin/bash
  echo "$0" "$@" >> /tmp/qemu.log
  cat /mnt/mig.xml
  exit 0

 virsh # migrate aaa --live qemu+ssh://10.66.7.230/system
error: unsupported configuration: Target controller type usb does not match source virtio-serial

 # tail /var/log/libvirt/libvirtd.log
...
2012-05-29 06:21:29.659+0000: 3303: error : virDomainControllerDefCheckABIStability:9365 : unsupported configuration: Target controller type usb does not match source virtio-serial


next 2 comments are case 1 and 2 guest xml.
Comment 6 zhpeng 2012-05-29 02:26:19 EDT
Created attachment 587317 [details]
case 1 guest xml
Comment 7 zhpeng 2012-05-29 02:27:26 EDT
Created attachment 587318 [details]
case 2 guest xml
Comment 8 zhpeng 2012-05-30 05:33:05 EDT
According comment 5 - 7, change the status to ASSIGNED
Comment 9 Jiri Denemark 2012-05-30 06:06:30 EDT
Can you modify the hook so that it looks like the following:

    #!/bin/bash

    echo "$0" "$@" >> /tmp/qemu.log

    if [ "$2" = "migrate" ]; then
        cat >/tmp/migrated.xml
        cat /mnt/mig.xml
    fi

    exit 0

and attach /tmp/migrated.xml? I expect /mnt/mig.xml would be the same as the
"case 2 guest xml" attachment. If it differs, please attach it as well.
Comment 10 zhpeng 2012-05-31 22:46:13 EDT
Created attachment 588244 [details]
case 1 guest xml new
Comment 11 zhpeng 2012-05-31 22:46:48 EDT
Created attachment 588245 [details]
case 1 migrated xml
Comment 12 zhpeng 2012-05-31 22:47:20 EDT
Created attachment 588246 [details]
case 2 guest xml new
Comment 13 zhpeng 2012-05-31 22:47:51 EDT
Created attachment 588247 [details]
case 2 migrated xml
Comment 14 zhpeng 2012-05-31 22:49:12 EDT
They are different.
case 1 xmls are mig-1.xml and migrated-1.xml, case 2 are -2.
Pls check the last 4 attachments
Comment 15 Jiri Denemark 2012-06-01 05:56:53 EDT
Thanks. BTW, the above script may serve as a test for our XML compatibility
checker but it's not the right way of doing this... The correct way is to
filter the XML send to stdin of the hook script. In other words to change
location of the disk image from /var/lib/libvirt/images to /mnt, one would use
the following script:

    #!/bin/bash

    echo "$0" "$@" >> /tmp/qemu.log

    if [ "$2" = "migrate" ]; then
        sed -e 's,/var/lib/libvirt/images,/mnt,'
    fi

    exit 0


Anyway, the bad script revealed that our XML compatibility checker is a bit
too strict. One of the XMLs has

    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>

while the other one has

    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <controller type='usb' index='0'/>

which is perfectly compatible. However, this is a low priority bug since using
the correct script, one would never hit this issue.
Comment 18 Cole Robinson 2016-03-23 18:01:59 EDT
Given the bug's age and how minor it is, just closing as DEFERRED.

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