提交 37cebfec 编写于 作者: D Daniel P. Berrange 提交者: Michal Privoznik

Remove obsolete pivotRoot flag in LXC driver

The lxcContainerMountBasicFS method had a 'bool pivotRoot'
flag to control whether it mounted a private /dev. Since
removal of the non-pivot root container setup codepaths,
this flag is obsolete as the only caller always passes
'true'.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 9a8f39d0
...@@ -655,8 +655,7 @@ err: ...@@ -655,8 +655,7 @@ err:
} }
static int lxcContainerMountBasicFS(bool pivotRoot, static int lxcContainerMountBasicFS(char *sec_mount_options)
char *sec_mount_options)
{ {
const struct { const struct {
const char *src; const char *src;
...@@ -684,7 +683,7 @@ static int lxcContainerMountBasicFS(bool pivotRoot, ...@@ -684,7 +683,7 @@ static int lxcContainerMountBasicFS(bool pivotRoot,
int i, rc = -1; int i, rc = -1;
char *opts = NULL; char *opts = NULL;
VIR_DEBUG("Mounting basic filesystems pivotRoot=%d", pivotRoot); VIR_DEBUG("Mounting basic filesystems sec_mount_options=%s", sec_mount_options);
for (i = 0 ; i < ARRAY_CARDINALITY(mnts) ; i++) { for (i = 0 ; i < ARRAY_CARDINALITY(mnts) ; i++) {
const char *srcpath = NULL; const char *srcpath = NULL;
...@@ -717,27 +716,24 @@ static int lxcContainerMountBasicFS(bool pivotRoot, ...@@ -717,27 +716,24 @@ static int lxcContainerMountBasicFS(bool pivotRoot,
} }
} }
if (pivotRoot) { /*
/* * tmpfs is limited to 64kb, since we only have device nodes in there
* tmpfs is limited to 64kb, since we only have device nodes in there * and don't want to DOS the entire OS RAM usage
* and don't want to DOS the entire OS RAM usage */
*/
ignore_value(virAsprintf(&opts, if (virAsprintf(&opts,
"mode=755,size=65536%s", sec_mount_options)); "mode=755,size=65536%s", sec_mount_options) < 0) {
if (!opts) { virReportOOMError();
virReportOOMError(); goto cleanup;
goto cleanup; }
}
VIR_DEBUG("Mount devfs on /dev type=tmpfs flags=%x, opts=%s", VIR_DEBUG("Mount devfs on /dev type=tmpfs flags=%x, opts=%s",
MS_NOSUID, opts); MS_NOSUID, opts);
if (mount("devfs", "/dev", "tmpfs", MS_NOSUID, opts) < 0) { if (mount("devfs", "/dev", "tmpfs", MS_NOSUID, opts) < 0) {
virReportSystemError(errno, virReportSystemError(errno,
_("Failed to mount %s on %s type %s (%s)"), _("Failed to mount %s on %s type %s (%s)"),
"devfs", "/dev", "tmpfs", opts); "devfs", "/dev", "tmpfs", opts);
goto cleanup; goto cleanup;
}
} }
rc = 0; rc = 0;
...@@ -1789,7 +1785,7 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef, ...@@ -1789,7 +1785,7 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
goto cleanup; goto cleanup;
/* Mounts the core /proc, /sys, etc filesystems */ /* Mounts the core /proc, /sys, etc filesystems */
if (lxcContainerMountBasicFS(true, sec_mount_options) < 0) if (lxcContainerMountBasicFS(sec_mount_options) < 0)
goto cleanup; goto cleanup;
/* Mounts /proc/meminfo etc sysinfo */ /* Mounts /proc/meminfo etc sysinfo */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册