Bug 1141663

Summary: Remote RHEL 5 Xen has no <os><type arch='...'> attribute when guest is running
Product: Red Hat Enterprise Linux 7 Reporter: Richard W.M. Jones <rjones>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.1CC: codong, dyuan, juzhou, lcui, mbooth, mzhan, ptoscano, rbalakri, rjones, tzheng, virt-bugs
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1141145 Environment:
Last Closed: 2014-09-17 09:13:30 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 Richard W.M. Jones 2014-09-15 07:46:21 UTC
Tested with:
virt-v2v-1.27.45-1.1.el7.x86_64
libguestfs-1.27.45-1.1.el7.x86_64

# virt-v2v -ic xen+ssh://10.66.106.64 -os default  xen-pv-rhel5.8-x86_64 -v -x 
[   0.0] Opening the source -i libvirt -ic xen+ssh://10.66.106.64 xen-pv-rhel5.8-x86_64
libvirt: Remote Driver error : unknown procedure: 212
virt-v2v: error: in the libvirt XML metadata, <os><type arch='...'> is 
missing or empty

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]
libvirt xml is:
<domain type='xen' id='5'>
  <name>xen-pv-rhel5.8-x86_64</name>
  <uuid>a25c918c-d838-6323-1944-6ae214992d5d</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <bootloader>/usr/bin/pygrub</bootloader>
  <os>
    <type>linux</type>
    <kernel>/var/lib/xen/boot_kernel.r5G2qO</kernel>
    <initrd>/var/lib/xen/boot_ramdisk.w1Y-8E</initrd>
    <cmdline>ro root=/dev/VolGroup00/LogVol00 rhgb quiet</cmdline>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <driver name='tap' type='aio'/>
      <source file='/var/lib/xen/images/xen/xen-pv/xen-pv-rhel5.8-x86_64.img'/>
      <target dev='xvda' bus='xen'/>
    </disk>
    <interface type='bridge'>
      <mac address='00:16:3e:f0:6c:2e'/>
      <source bridge='xenbr0'/>
      <script path='vif-bridge'/>
      <target dev='vif5.0'/>
    </interface>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
      <target port='0'/>
    </console>
    <input type='mouse' bus='xen'/>
    <graphics type='vnc' port='5900' autoport='yes' keymap='en-us'/>
  </devices>
</domain>

Comment 2 tingting zheng 2014-09-15 08:47:31 UTC
The bug only occurs when I converting xen hvm/pv guest which is running.
For shutdown guest,no such error shows.

Comment 3 Richard W.M. Jones 2014-09-15 09:39:37 UTC
I think this is a bug in libvirt.  Unfortunately in this case
I think that it will turn out to be a bug in libvirt *on RHEL 5*
which is what generates the XML in this case, and therefore this
is going to be difficult to fix.

Unfortunately virt-v2v really needs to know the arch of the guest,
and we cannot realistically guess it, especially in this case where
we are talking to a remote host.

Comment 4 tingting zheng 2014-09-15 10:51:43 UTC
(In reply to Richard W.M. Jones from comment #3)
> I think this is a bug in libvirt.  Unfortunately in this case
> I think that it will turn out to be a bug in libvirt *on RHEL 5*
> which is what generates the XML in this case, and therefore this
> is going to be difficult to fix.
> 
> Unfortunately virt-v2v really needs to know the arch of the guest,
> and we cannot realistically guess it, especially in this case where
> we are talking to a remote host.

Why doesn't virt-v2v firstly check whether the xen guest is running,as Bug 1138586 shows,an error info should show.

Comment 5 Richard W.M. Jones 2014-09-15 10:55:38 UTC
(In reply to tingting zheng from comment #4)
> (In reply to Richard W.M. Jones from comment #3)
> > I think this is a bug in libvirt.  Unfortunately in this case
> > I think that it will turn out to be a bug in libvirt *on RHEL 5*
> > which is what generates the XML in this case, and therefore this
> > is going to be difficult to fix.
> > 
> > Unfortunately virt-v2v really needs to know the arch of the guest,
> > and we cannot realistically guess it, especially in this case where
> > we are talking to a remote host.
> 
> Why doesn't virt-v2v firstly check whether the xen guest is running,as Bug
> 1138586 shows,an error info should show.

TBH I'm not sure.  It *should* be checking the running state of
the guest first, followed by parsing the XML.

Is the guest really running?  What is the output of:

virsh -c xen+ssh://10.66.106.64 list --all

Comment 6 tingting zheng 2014-09-16 01:28:28 UTC
Detailed info:
# virt-v2v -ic xen+ssh://10.66.106.64 -os default  xen-pv-rhel5.8-x86_64 
[   0.0] Opening the source -i libvirt -ic xen+ssh://10.66.106.64 xen-pv-rhel5.8-x86_64
libvirt: Remote Driver error : unknown procedure: 212
virt-v2v: error: in the libvirt XML metadata, <os><type arch='...'> is 
missing or empty

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

The status of the guest is idle.
# virsh -c xen+ssh://10.66.106.64 list
 Id    Name                           State
----------------------------------------------------
 0     Domain-0                       running
 9     xen-pv-rhel5.8-x86_64          idle
 10    rhel6.6-i386-hvm               idle
 12    xen-hvm-rhel4.8-i386           idle

Comment 7 Richard W.M. Jones 2014-09-16 15:49:51 UTC
(In reply to tingting zheng from comment #6)
> Detailed info:
> # virt-v2v -ic xen+ssh://10.66.106.64 -os default  xen-pv-rhel5.8-x86_64 
> [   0.0] Opening the source -i libvirt -ic xen+ssh://10.66.106.64
> xen-pv-rhel5.8-x86_64
> libvirt: Remote Driver error : unknown procedure: 212
> virt-v2v: error: in the libvirt XML metadata, <os><type arch='...'> is 
> missing or empty
> 
> If reporting bugs, run virt-v2v with debugging enabled and include the 
> complete output:
> 
>   virt-v2v -v -x [...]
> 
> The status of the guest is idle.
> # virsh -c xen+ssh://10.66.106.64 list
>  Id    Name                           State
> ----------------------------------------------------
>  0     Domain-0                       running
>  9     xen-pv-rhel5.8-x86_64          idle
>  10    rhel6.6-i386-hvm               idle
>  12    xen-hvm-rhel4.8-i386           idle

One change which I have made in libguestfs >= 1.27.47 is to stop
you trying to convert idle guests.  idle == running, so converting
them is actually dangerous.

This should prevent this error from being manifested in virt-v2v, and
TBH if it does work, then we should just close this bug since I don't
see any value in trying to fix this in libvirt.

So let me know if 1.27.47 fixes this.

Comment 8 tingting zheng 2014-09-17 03:24:42 UTC
Tested with:
libguestfs-1.27.47-1.1.el7.x86_64
virt-v2v-1.27.47-1.1.el7.x86_64

# virsh -c xen+ssh://10.66.106.64 list
 Id Name                 State
----------------------------------
  0 Domain-0             running
 16 xen-pv-rhel5.8-i386  paused
 17 xen-pv-rhel5.8-x86_64 idle

# virt-v2v -ic xen+ssh://10.66.106.64 -os default  xen-pv-rhel5.8-x86_64
[   0.0] Opening the source -i libvirt -ic xen+ssh://10.66.106.64 xen-pv-rhel5.8-x86_64
virt-v2v: error: internal error: invalid argument: libvirt domain 
'xen-pv-rhel5.8-x86_64' is running or paused.  It must be shut down in 
order to perform virt-v2v conversion

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

# virt-v2v -ic xen+ssh://10.66.106.64 -os default  xen-pv-rhel5.8-i386 
[   0.0] Opening the source -i libvirt -ic xen+ssh://10.66.106.64 xen-pv-rhel5.8-i386
virt-v2v: error: internal error: invalid argument: libvirt domain 
'xen-pv-rhel5.8-i386' is running or paused.  It must be shut down in order 
to perform virt-v2v conversion

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

So for running/pause/idle guests,virt-v2v will firstly print a error info.

Comment 9 Richard W.M. Jones 2014-09-17 09:13:30 UTC
Good, in that case I think we can close this.