Bug 1170743 - Xen pty console <source> element not available in dumpxml (or to openstack nova) until after connecting with 'virsh console'.
Summary: Xen pty console <source> element not available in dumpxml (or to openstack no...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-04 18:35 UTC by clark.laughlin
Modified: 2015-09-04 13:46 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-09-04 13:46:28 UTC
Embargoed:


Attachments (Terms of Use)

Description clark.laughlin 2014-12-04 18:35:53 UTC
Description of problem:

I am testing Openstack on arm64 using Xen and am using the libvirt driver (xenlight).  I was working on an issue where 'nova console-log' throws an exception.  It turns out that the <source path=""> element is not being added to the <console> element by libvirt after the domain is created.  Nova is expecting this element to be there, doesn't handle the missing data correctly, and throws an exception.

I can manually connect to the console using 'virsh console' and after that, the correct <source path=""/> element is added to the domain XML and nova picks it up and the exception goes away.

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

I build libvirt from git master


How reproducible:

This can be reproduced using only virsh.

Steps to Reproduce:
1. run virsh to connect to Xen ("virsh -c xen:///")
2. define a domain with XML containing "<console type='pty'/>"
3. run 'virsh dumpxml' (and verify no <source path='...'/> is present)
4. run 'virsh console <domid>'
5. run 'virsh dumpxml' (and verify <source path='...'/> has been added)

Actual results:

** Before running virsh console:

<console type='pty'>
  <target type='xen' port='0'/>
</console>

** After running virsh console:

<console type='pty' tty='/dev/pts/4'>
  <source path='/dev/pts/4'/>
  <target type='xen' port='0'/>
</console>

Expected results:

I would expect the source path information to be present immediately after defining/creating the domain so that it is immediately available to nova for capture of console output as the domain is booting.

Additional info:

Comment 1 Ján Tomko 2015-09-04 13:46:28 UTC
Pushed upstream as:
commit 368042cf4a6bca34c7da45517a6e3ce91876c53c
Author:     Anthony PERARD <anthony.perard>
AuthorDate: 2015-01-15 16:40:19 +0000
Commit:     Jim Fehlig <jfehlig>
CommitDate: 2015-01-16 15:57:10 -0700

    libxl: Set path to console on domain startup.
    
    The path to the pty of a Xen PV console is set only in
    virDomainOpenConsole. But this is done too late. A call to
    virDomainGetXMLDesc done before OpenConsole will not have the path to
    the pty, but a call after OpenConsole will.
    
    e.g. of the current issue.
    Starting a domain with '<console type="pty"/>'
    Then:
    virDomainGetXMLDesc():
      <devices>
        <console type='pty'>
          <target type='xen' port='0'/>
        </console>
      </devices>
    virDomainOpenConsole()
    virDomainGetXMLDesc():
      <devices>
        <console type='pty' tty='/dev/pts/30'>
          <source path='/dev/pts/30'/>
          <target type='xen' port='0'/>
        </console>
      </devices>
    
    The patch intend to have the TTY path on the first call of GetXMLDesc.
    This is done by setting up the path at domain start up instead of in
    OpenConsole.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1170743
    
    Signed-off-by: Anthony PERARD <anthony.perard>

git describe: v1.2.11-199-g368042c contains: v1.2.12-rc1~10


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