Bug 1188914 - improve the error when add a input device to lxc domain and forbid add a unsupported input device to lxc domain
Summary: improve the error when add a input device to lxc domain and forbid add a unsu...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-04 02:32 UTC by Luyao Huang
Modified: 2015-11-19 06:09 UTC (History)
5 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:09:38 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2015-02-04 02:32:17 UTC
Description of problem:
improve the error when add a input device to lxc domain and forbid add a unsupported input device to lxc domain

Version-Release number of selected component (if applicable):
libvirt-1.2.8-15.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.try to add a inpurt deivce like this to lxc domain:
<input type='tablet' bus='usb'/>

# virsh -c lxc:/// edit helloworld
error: internal error: xen bus does not support tablet input device
Failed. Try again? [y,n,f,?]:

2.try to add a inpurt deivce like this to lxc domain:
<input type='mouse' bus='usb'/>

# virsh -c lxc:/// edit helloworld
Domain helloworld XML configuration edited.

3.check the xml:
# virsh -c lxc:/// dumpxml helloworld
<domain type='lxc'>
  <name>helloworld</name>
  <uuid>ed1955f7-4e72-40ae-8265-c193e7436c8a</uuid>
  <memory unit='KiB'>102400</memory>
  <currentMemory unit='KiB'>102300</currentMemory>
  <vcpu placement='static' cpuset='1-3'>2</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64'>exe</type>
    <init>/bin/sh</init>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/'/>
      <target dir='/'/>
    </filesystem>
    <console type='pty'>
      <target type='lxc' port='0'/>
    </console>
    <input type='mouse' bus='usb'/>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'/>
</domain>


Actual results:
libvirt report 
 xen bus does not support tablet input device
in step 1, but it is not a xen bus.

lxc do not support input device mouse but can add it to xml.

Expected results:
improve the error when add a input device to lxc domain and forbid add a unsupported input device to lxc domain

Additional info:

Comment 1 Peter Krempa 2015-02-04 07:32:26 UTC
Fixed upstream:

commit 76b284c968ffd630f97b35464d7836699b5482be
Author: Luyao Huang <lhuang@redhat.com>
Date:   Wed Feb 4 10:33:29 2015 +0800

    conf: Properly report error of unsupported input bus type
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1188914
    
    Add a missing jump to the error label in case the input device bus is
    invalid.

v1.2.12-72-g76b284c

Comment 3 Yang Yang 2015-05-14 03:03:20 UTC
Verified on libvirt-1.2.15-1.el7.x86_64

Steps
1. define a lxc
# virsh -c lxc:/// define lxc.xml 
Domain helloworld defined from lxc.xml
# cat /yy/lxc.xml 
<domain type='lxc'>
  <name>helloworld</name>
  <uuid>ed1955f7-4e72-40ae-8265-c193e7436c8a</uuid>
  <memory unit='KiB'>102400</memory>
  <currentMemory unit='KiB'>102300</currentMemory>
  <vcpu placement='static' cpuset='1-3'>2</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64'>exe</type>
    <init>/bin/sh</init>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/'/>
      <target dir='/'/>
    </filesystem>
    <console type='pty'>
      <target type='lxc' port='0'/>
    </console>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'/>
</domain>

2. edit lxc with input element
add <input type='mouse' bus='usb'/>
<input type='keyboard' bus='xen'/>
<input type='tablet' bus='ps2'/>
# virsh -c lxc:/// edit helloworld
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Element domain has extra content: input

Comment 5 errata-xmlrpc 2015-11-19 06:09:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


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