mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
libvirt: lxc: don't mkdir when selinux is disabled
libvirt lxc will fail to start when selinux is disabled. error: Failed to start domain noroot error: internal error guest failed to start: PATH=/bin:/sbin TERM=linux container=lxc-libvirt container_uuid=b9873916-3516-c199-8112-1592ff694a9e LIBVIRT_LXC_UUID=b9873916-3516-c199-8112-1592ff694a9e LIBVIRT_LXC_NAME=noroot /bin/sh 2013-01-09 11:04:05.384+0000: 1: info : libvirt version: 1.0.1 2013-01-09 11:04:05.384+0000: 1: error : lxcContainerMountBasicFS:546 : Failed to mkdir /sys/fs/selinux: No such file or directory 2013-01-09 11:04:05.384+0000: 7536: info : libvirt version: 1.0.1 2013-01-09 11:04:05.384+0000: 7536: error : virLXCControllerRun:1466 : error receiving signal from container: Input/output error 2013-01-09 11:04:05.404+0000: 7536: error : virCommandWait:2287 : internal error Child process (ip link del veth1) unexpected exit status 1: Cannot find device "veth1" fix this problem by checking if selinuxfs is mounted in host before we try to create dir /sys/fs/selinux. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
This commit is contained in:
parent
0899322d61
commit
8d63af22de
@ -540,13 +540,6 @@ static int lxcContainerMountBasicFS(bool pivotRoot,
|
|||||||
VIR_DEBUG("Processing %s -> %s",
|
VIR_DEBUG("Processing %s -> %s",
|
||||||
mnts[i].src, mnts[i].dst);
|
mnts[i].src, mnts[i].dst);
|
||||||
|
|
||||||
if (virFileMakePath(mnts[i].dst) < 0) {
|
|
||||||
virReportSystemError(errno,
|
|
||||||
_("Failed to mkdir %s"),
|
|
||||||
mnts[i].src);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
srcpath = mnts[i].src;
|
srcpath = mnts[i].src;
|
||||||
|
|
||||||
/* Skip if mount doesn't exist in source */
|
/* Skip if mount doesn't exist in source */
|
||||||
@ -554,6 +547,13 @@ static int lxcContainerMountBasicFS(bool pivotRoot,
|
|||||||
(access(srcpath, R_OK) < 0))
|
(access(srcpath, R_OK) < 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (virFileMakePath(mnts[i].dst) < 0) {
|
||||||
|
virReportSystemError(errno,
|
||||||
|
_("Failed to mkdir %s"),
|
||||||
|
mnts[i].src);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user