Bug 1176503
| Summary: | libvirt will remove the seclabel model of lxc vm after guest start fail | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Luyao Huang <lhuang> |
| Component: | libvirt | Assignee: | John Ferlan <jferlan> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | CC: | dyuan, jferlan, mzhan, rbalakri, zhwang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.13-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 06:05:28 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: | |||
Moving to POST as code was pushed upstream:
$ git describe 72129907c1e6f35af5dadee48aa8a998e6fb7f68
v1.2.12-135-g7212990
$ git show 72129907c1e6f35af5dadee48aa8a998e6fb7f68
commit 72129907c1e6f35af5dadee48aa8a998e6fb7f68
Author: Luyao Huang <lhuang>
Date: Thu Feb 12 14:43:26 2015 -0500
lxc: Move console checks in LXCProcessStart
https://bugzilla.redhat.com/show_bug.cgi?id=1176503
Move the two console checks - one for zero nconsoles present and the
other for an invalid console type to earlier in the processing rather than
getting after performing some setup that has to be undone for what amounts
to an invalid configuration.
This resolves the above bug since it's not not possible to have changed
the security labels when we cause the configuration check failure.
I can reproduce the comment0's issue with libvirt-1.2.8-16.el7.x86_64, the verify steps as following 1.prepare a lxc vm like this(i remove the console to make guest cannot start): <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='auto'>2</vcpu> <numatune> <memory mode='strict' placement='auto'/> </numatune> <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> </devices> <seclabel type='dynamic' model='selinux' relabel='yes'/> <-----have a selinux label </domain> 2.start it (will fail): virsh # start helloworld error: Failed to start domain helloworld error: unsupported configuration: At least one PTY console is required 3.check the guest xml, the seclabel for guest still over there #virsh -c lxc:/// dumpxml helloworld -- <seclabel type='dynamic' model='selinux' relabel='yes'/> 4.Restart libvirtd service, then re-check the label, the label still over there #systemctl restart libvirtd #virsh -c lxc:/// dumpxml helloworld -- <seclabel type='dynamic' model='selinux' relabel='yes'/> Retest comment 2 with the libvirt-1.2.16-1.el7.x86_64, could also get the same result, so mark this bug verifed 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 |
Description of problem: libvirt will remove the seclabel model of lxc vm after guest start fail Version-Release number of selected component (if applicable): libvirt-1.2.8-10.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.prepare a lxc vm like this(i remove the console to make guest cannot start): <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='auto'>2</vcpu> <numatune> <memory mode='strict' placement='auto'/> </numatune> <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> </devices> <seclabel type='dynamic' model='selinux' relabel='yes'/> <-----have a selinux label </domain> 2.start it (will fail): virsh # start helloworld error: Failed to start domain helloworld error: unsupported configuration: At least one PTY console is required 3.check the guest xml: virsh # dumpxml helloworld <seclabel type='dynamic' relabel='yes'/> Actual results: libvirt will remove the seclabel model of lxc vm after guest start fail Expected results: model still exist Additional info: After do some debug, i found libvirt remove the model is right(it is a part of cleanup work) but miss pass 'newDef' to 'def' after do the clear, so we will get wrong XML after guest start failed.