Bug 1215357

Summary: Cannot access text consoles of Xen guests
Product: [Community] Virtualization Tools Reporter: Ting-Wei Lan <lantw44>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: berrange, crobinso, gscrivan, lantw44, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-26 15:55:22 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 Ting-Wei Lan 2015-04-25 18:55:50 UTC
Description of problem:
I can access text consoles of Xen guests with 'xl console' and 'virsh console', but virt-manager shows 'Error connecting to text console: Cannot open a device with no alias name'.

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

How reproducible:
always

Steps to Reproduce:
1. Create a Xen guest and configure it to run getty on its serial console or Xen PV console.
2. Use 'xl console' or 'virsh console' to make sure it works.
3. Use 'View->Text Consoles->Serial 1' or 'View->Text Consoles->Text Console 1' to access the text console.

Actual results:
It doesn't work and shows 'Error connecting to text console: Cannot open a device with no alias name'.

Expected results:
It should work without manual configuration just like KVM.

Additional info:
I found some distributions just remove the check.
https://bugzilla.novell.com/show_bug.cgi?id=780859
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=693969

Comment 1 Cole Robinson 2015-04-26 15:26:14 UTC
Thanks for the report. Can you provide:

- virt-manager --debug when reproducing
- sudo virsh dumpxml $vmname    for the running VM

Comment 2 Ting-Wei Lan 2015-04-26 15:47:39 UTC
- virt-manager --debug when reproducing

[Sun, 26 Apr 2015 23:45:55 virt-manager 3570] DEBUG (cli:246) Launched with command line: ./virt-manager --debug -c xen+ssh://lantw44.1.71/
[Sun, 26 Apr 2015 23:45:55 virt-manager 3570] DEBUG (virt-manager:153) virt-manager version: 1.1.0
[Sun, 26 Apr 2015 23:45:55 virt-manager 3570] DEBUG (virt-manager:154) virtManager import: <module 'virtManager' from '/tmp/ram/virt-manager/virtManager/__init__.pyc'>
[Sun, 26 Apr 2015 23:45:55 virt-manager 3570] DEBUG (virt-manager:213) GTK version: 3.14.12
[Sun, 26 Apr 2015 23:45:55 virt-manager 3570] DEBUG (engine:456) libguestfs inspection support: False
[Sun, 26 Apr 2015 23:45:55 virt-manager 3570] DEBUG (systray:150) Showing systray: False
[Sun, 26 Apr 2015 23:45:55 virt-manager 3570] DEBUG (manager:207) Showing manager
[Sun, 26 Apr 2015 23:45:55 virt-manager 3570] DEBUG (engine:357) window counter incremented to 1
[Sun, 26 Apr 2015 23:45:55 virt-manager 3570] DEBUG (connection:541) conn=xen+ssh://lantw44.1.71/ changed to state=Connecting
[Sun, 26 Apr 2015 23:45:55 virt-manager 3570] DEBUG (connection:842) Scheduling background open thread for xen+ssh://lantw44.1.71/
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:891) libvirt version=1002009
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:893) daemon version=1002009
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:894) conn version=4004000
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:896) xen+ssh://lantw44.1.71/ capabilities:
<capabilities>

  <host>
    <cpu>
      <arch>x86_64</arch>
      <features>
        <pae/>
      </features>
    </cpu>
    <power_management/>
    <migration_features>
      <live/>
    </migration_features>
    <topology>
      <cells num="1">
        <cell id="0">
          <memory unit="KiB">9164800</memory>
          <cpus num="8">
            <cpu id="0" socket_id="0" core_id="0" siblings="0-1"/>
            <cpu id="1" socket_id="0" core_id="0" siblings="0-1"/>
            <cpu id="2" socket_id="0" core_id="1" siblings="2-3"/>
            <cpu id="3" socket_id="0" core_id="1" siblings="2-3"/>
            <cpu id="4" socket_id="0" core_id="2" siblings="4-5"/>
            <cpu id="5" socket_id="0" core_id="2" siblings="4-5"/>
            <cpu id="6" socket_id="0" core_id="3" siblings="6-7"/>
            <cpu id="7" socket_id="0" core_id="3" siblings="6-7"/>
          </cpus>
        </cell>
      </cells>
    </topology>
  </host>

  <guest>
    <os_type>xen</os_type>
    <arch name="x86_64">
      <wordsize>64</wordsize>
      <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
      <machine>xenpv</machine>
      <domain type="xen">
        <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
      </domain>
    </arch>
  </guest>

  <guest>
    <os_type>xen</os_type>
    <arch name="i686">
      <wordsize>32</wordsize>
      <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
      <machine>xenpv</machine>
      <domain type="xen">
        <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
      </domain>
    </arch>
    <features>
      <pae/>
    </features>
  </guest>

  <guest>
    <os_type>hvm</os_type>
    <arch name="i686">
      <wordsize>32</wordsize>
      <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
      <loader>/usr/lib/xen/boot/hvmloader</loader>
      <machine>xenfv</machine>
      <domain type="xen">
        <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
      </domain>
    </arch>
    <features>
      <pae/>
      <nonpae/>
      <acpi default="on" toggle="yes"/>
      <apic default="on" toggle="no"/>
      <hap default="off" toggle="yes"/>
    </features>
  </guest>

  <guest>
    <os_type>hvm</os_type>
    <arch name="x86_64">
      <wordsize>64</wordsize>
      <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
      <loader>/usr/lib/xen/boot/hvmloader</loader>
      <machine>xenfv</machine>
      <domain type="xen">
        <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
      </domain>
    </arch>
    <features>
      <acpi default="on" toggle="yes"/>
      <apic default="on" toggle="no"/>
      <hap default="off" toggle="yes"/>
    </features>
  </guest>

</capabilities>

[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:754) Using domain events
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:788) Using network events
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) network=default status=Active added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) interface=lo status=Active added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) domain=builder-freebsd status=Shutoff added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) domain=xentest-gentoo-hardened status=Shutoff added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) pool=default status=Active added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) domain=xentest-debian-sid-pv status=Running added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) domain=builder-windows status=Shutoff added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) domain=xentest-fedora-hv status=Shutoff added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) pool=fwnlvm status=Active added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) pool=boot-scratch-1 status=Active added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:995) pool=boot-scratch status=Active added
[Sun, 26 Apr 2015 23:45:56 virt-manager 3570] DEBUG (connection:541) conn=xen+ssh://lantw44.1.71/ changed to state=Active
[Sun, 26 Apr 2015 23:46:14 virt-manager 3570] ERROR (details:796) Error determining machine list
Traceback (most recent call last):
  File "/tmp/ram/virt-manager/virtManager/details.py", line 792, in init_details
    machine=self.vm.get_machtype())
  File "/tmp/ram/virt-manager/virtinst/capabilities.py", line 471, in guest_lookup
    {'virttype' : osstr, 'arch' : archstr})
ValueError: Host does not support virtualization type 'linux' for arch 'x86_64'
[Sun, 26 Apr 2015 23:46:14 virt-manager 3570] DEBUG (details:619) Showing VM details: <vmmDomain object at 0x7fc6cd41ce10 (virtManager+domain+vmmDomain at 0x1245b60)>
[Sun, 26 Apr 2015 23:46:14 virt-manager 3570] DEBUG (engine:357) window counter incremented to 2
[Sun, 26 Apr 2015 23:46:14 virt-manager 3570] DEBUG (console:650) Starting connect process for proto=vnc trans=ssh connhost=192.168.1.71 connuser=lantw44 connport= gaddr=127.0.0.1 gport=5900 gtlsport=None gsocket=None
[Sun, 26 Apr 2015 23:46:14 virt-manager 3570] DEBUG (sshtunnels:247) Pre-generated ssh command for ginfo: ssh -l lantw44 192.168.1.71 sh -c 'nc -q 2>&1 | grep "requires an argument" >/dev/null;if [ $? -eq 0 ] ; then   CMD="nc -q 0 127.0.0.1 5900";else   CMD="nc 127.0.0.1 5900";fi;eval "$CMD";'
[Sun, 26 Apr 2015 23:46:14 virt-manager 3570] DEBUG (sshtunnels:271) Generated tunnel fd=23 for viewer
[Sun, 26 Apr 2015 23:46:14 virt-manager 3570] DEBUG (sshtunnels:196) Opened tunnel PID=4029 ERRFD=21
[Sun, 26 Apr 2015 23:46:14 virt-manager 3570] DEBUG (console:771) Viewer connected
[Sun, 26 Apr 2015 23:46:18 virt-manager 3570] DEBUG (serialcon:429) Serial console '0' path changed to /dev/pts/3
[Sun, 26 Apr 2015 23:46:18 virt-manager 3570] DEBUG (serialcon:207) Opening console stream for dev=<virtinst.devicechar.VirtualConsoleDevice object at 0x7fc6cc53fdd0> alias=None
[Sun, 26 Apr 2015 23:46:18 virt-manager 3570] ERROR (serialcon:405) Error opening serial console
Traceback (most recent call last):
  File "/tmp/ram/virt-manager/virtManager/serialcon.py", line 401, in open_console
    self.console.open(self.lookup_dev(), self.terminal)
  File "/tmp/ram/virt-manager/virtManager/serialcon.py", line 209, in open
    raise RuntimeError(_("Cannot open a device with no alias name"))
RuntimeError: Cannot open a device with no alias name

- sudo virsh dumpxml $vmname    for the running VM

<domain type='xen' id='1'>
  <name>xentest-debian-sid-pv</name>
  <uuid>eaae80bf-78ce-4aab-bc89-fc37690c2aa3</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <bootloader>/usr/bin/pygrub</bootloader>
  <os>
    <type arch='x86_64' machine='xenpv'>linux</type>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <disk type='block' device='disk'>
      <source dev='/dev/fwnws/xentest-debian-sid-pv'/>
      <backingStore/>
      <target dev='xvda' bus='xen'/>
    </disk>
    <interface type='bridge'>
      <mac address='00:16:3e:44:0e:49'/>
      <source bridge='br0'/>
    </interface>
    <console type='pty' tty='/dev/pts/3'>
      <source path='/dev/pts/3'/>
      <target type='xen' port='0'/>
    </console>
    <input type='mouse' bus='xen'/>
    <input type='keyboard' bus='xen'/>
    <graphics type='vnc' port='5900' autoport='yes' keymap='en-us'/>
    <video>
      <model type='xen' vram='4096' heads='1'/>
    </video>
  </devices>
</domain>

Comment 3 Cole Robinson 2015-04-26 15:55:22 UTC
Thanks for the info, fixed upstream now:

commit 0aeee5c449d608d75f5632e9aa47f5e433eb3879
Author: Cole Robinson <crobinso>
Date:   Sun Apr 26 11:50:01 2015 -0400

    serialcon: Fix opening with xen (bz 1215357)
    
    Apparently xen doesn't set <serial> device alias names, and OpenConsole
    just opens the first <console> device unconditionally.
    
    Properly handling that would be to report it in the UI that we can
    only open the first console, but for now just drop the alias check.
    Apparently SUSE already does this as mentioned in the RH bug
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1215357

Comment 4 Ting-Wei Lan 2015-04-28 08:52:12 UTC
Thanks for the fix. Will we get the patch in Fedora 21?