YARN-87. NM ResourceLocalizationService does not set permissions of local cache directories (Jason Lowe via tgraves)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1381459 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4d265345b7
commit
02c0317eff
|
@ -114,3 +114,6 @@ Release 0.23.3 - Unreleased
|
||||||
|
|
||||||
YARN-68. NodeManager will refuse to shutdown indefinitely due to container
|
YARN-68. NodeManager will refuse to shutdown indefinitely due to container
|
||||||
log aggregation (daryn via bobby)
|
log aggregation (daryn via bobby)
|
||||||
|
|
||||||
|
YARN-87. NM ResourceLocalizationService does not set permissions of local
|
||||||
|
cache directories (Jason Lowe via tgraves)
|
||||||
|
|
|
@ -181,6 +181,7 @@ public class ResourceLocalizationService extends CompositeService
|
||||||
try {
|
try {
|
||||||
// TODO queue deletions here, rather than NM init?
|
// TODO queue deletions here, rather than NM init?
|
||||||
FileContext lfs = getLocalFileContext(conf);
|
FileContext lfs = getLocalFileContext(conf);
|
||||||
|
lfs.setUMask(new FsPermission((short)FsPermission.DEFAULT_UMASK));
|
||||||
List<String> localDirs = dirsHandler.getLocalDirs();
|
List<String> localDirs = dirsHandler.getLocalDirs();
|
||||||
for (String localDir : localDirs) {
|
for (String localDir : localDirs) {
|
||||||
// $local/usercache
|
// $local/usercache
|
||||||
|
|
|
@ -50,6 +50,7 @@ import junit.framework.Assert;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.AbstractFileSystem;
|
import org.apache.hadoop.fs.AbstractFileSystem;
|
||||||
|
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||||
import org.apache.hadoop.fs.FSDataOutputStream;
|
import org.apache.hadoop.fs.FSDataOutputStream;
|
||||||
import org.apache.hadoop.fs.FileContext;
|
import org.apache.hadoop.fs.FileContext;
|
||||||
import org.apache.hadoop.fs.Options.ChecksumOpt;
|
import org.apache.hadoop.fs.Options.ChecksumOpt;
|
||||||
|
@ -116,6 +117,7 @@ public class TestResourceLocalizationService {
|
||||||
@Test
|
@Test
|
||||||
public void testLocalizationInit() throws Exception {
|
public void testLocalizationInit() throws Exception {
|
||||||
final Configuration conf = new Configuration();
|
final Configuration conf = new Configuration();
|
||||||
|
conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "077");
|
||||||
AsyncDispatcher dispatcher = new AsyncDispatcher();
|
AsyncDispatcher dispatcher = new AsyncDispatcher();
|
||||||
dispatcher.init(new Configuration());
|
dispatcher.init(new Configuration());
|
||||||
|
|
||||||
|
@ -151,14 +153,18 @@ public class TestResourceLocalizationService {
|
||||||
// initialize ResourceLocalizationService
|
// initialize ResourceLocalizationService
|
||||||
locService.init(conf);
|
locService.init(conf);
|
||||||
|
|
||||||
|
final FsPermission defaultPerm = new FsPermission((short)0755);
|
||||||
|
|
||||||
// verify directory creation
|
// verify directory creation
|
||||||
for (Path p : localDirs) {
|
for (Path p : localDirs) {
|
||||||
Path usercache = new Path(p, ContainerLocalizer.USERCACHE);
|
Path usercache = new Path(p, ContainerLocalizer.USERCACHE);
|
||||||
verify(spylfs)
|
verify(spylfs)
|
||||||
.mkdir(eq(usercache), isA(FsPermission.class), eq(true));
|
.mkdir(eq(usercache),
|
||||||
|
eq(defaultPerm), eq(true));
|
||||||
Path publicCache = new Path(p, ContainerLocalizer.FILECACHE);
|
Path publicCache = new Path(p, ContainerLocalizer.FILECACHE);
|
||||||
verify(spylfs)
|
verify(spylfs)
|
||||||
.mkdir(eq(publicCache), isA(FsPermission.class), eq(true));
|
.mkdir(eq(publicCache),
|
||||||
|
eq(defaultPerm), eq(true));
|
||||||
Path nmPriv = new Path(p, ResourceLocalizationService.NM_PRIVATE_DIR);
|
Path nmPriv = new Path(p, ResourceLocalizationService.NM_PRIVATE_DIR);
|
||||||
verify(spylfs).mkdir(eq(nmPriv),
|
verify(spylfs).mkdir(eq(nmPriv),
|
||||||
eq(ResourceLocalizationService.NM_PRIVATE_PERM), eq(true));
|
eq(ResourceLocalizationService.NM_PRIVATE_PERM), eq(true));
|
||||||
|
|
Loading…
Reference in New Issue