Bug 1447183

Summary: Detach a console device from running guest should be rejected
Product: [Community] Virtualization Tools Reporter: yafu <yafu>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: chhu, dyuan, jsuchane, libvirt-maint, xuzhang, yalzhang, zpeng
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 yafu 2017-05-02 04:11:58 UTC
Description of problem:
Detach a console device from running guest should be rejected.

Version-Release number of selected component (if applicable):
libvirt-3.2.0-3.el7.x86_64
qemu-kvm-rhev-2.9.0-2.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1.Start a guest with console device:
#virsh dumpxml rhel7.3-min
...
 <console type='pty' tty='/dev/pts/13'>
      <source path='/dev/pts/13'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
...

2.Prepare the console device xml:
#cat console.xml
 <console type='pty' tty='/dev/pts/13'>
      <source path='/dev/pts/13'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>


3.Detach the console device from the guest:
#virsh detach-device rhel7.3-min console.xml
Device detached successfully

4.Check the active xml of the guest, the console device is not detached actually:
#virsh dumpxml rhel7.3-min
...
 <console type='pty' tty='/dev/pts/13'>
      <source path='/dev/pts/13'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
...

5.Detach the console device with --config, it failed:
# virsh detach-device rhel7.3-min console.xml  --config
error: Failed to detach device from console.xml
error: Requested operation is not valid: detaching serial console is not supported


Actual results:
Detach a console device from running guest returns successfully, but actually not detached.

Expected results:
Since detach a console device with --config is rejected, detach from the running guest should also be rejected.