RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1176503 - libvirt will remove the seclabel model of lxc vm after guest start fail
Summary: libvirt will remove the seclabel model of lxc vm after guest start fail
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
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-22 07:17 UTC by Luyao Huang
Modified: 2015-11-19 06:05 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:05:28 UTC
Target Upstream Version:
Embargoed:


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 2014-12-22 07:17:46 UTC
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.

Comment 1 John Ferlan 2015-02-13 18:59:18 UTC
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.

Comment 2 zhenfeng wang 2015-05-04 06:35:18 UTC
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'/>

Comment 4 zhenfeng wang 2015-06-24 10:10:47 UTC
Retest comment 2 with the libvirt-1.2.16-1.el7.x86_64, could also get the same result, so mark this bug verifed

Comment 6 errata-xmlrpc 2015-11-19 06:05:28 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.