Ignore failure to mount SELinux filesystem in container

User namespaces will deny the ability to mount the SELinux
filesystem. This is harmless for libvirt's LXC needs, so the
error can be ignored.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-07-01 17:41:21 +01:00
parent 1528e8b23a
commit 293f717028

View File

@ -741,6 +741,12 @@ static int lxcContainerMountBasicFS(void)
VIR_DEBUG("Mount %s on %s type=%s flags=%x, opts=%s", VIR_DEBUG("Mount %s on %s type=%s flags=%x, opts=%s",
srcpath, mnts[i].dst, mnts[i].type, mnts[i].mflags, mnts[i].opts); srcpath, mnts[i].dst, mnts[i].type, mnts[i].mflags, mnts[i].opts);
if (mount(srcpath, mnts[i].dst, mnts[i].type, mnts[i].mflags, mnts[i].opts) < 0) { if (mount(srcpath, mnts[i].dst, mnts[i].type, mnts[i].mflags, mnts[i].opts) < 0) {
#if WITH_SELINUX
if (STREQ(mnts[i].src, SELINUX_MOUNT) &&
(errno == EINVAL || errno == EPERM))
continue;
#endif
virReportSystemError(errno, virReportSystemError(errno,
_("Failed to mount %s on %s type %s flags=%x opts=%s"), _("Failed to mount %s on %s type %s flags=%x opts=%s"),
srcpath, mnts[i].dst, NULLSTR(mnts[i].type), srcpath, mnts[i].dst, NULLSTR(mnts[i].type),