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:
Thomas Graves 2012-09-06 02:08:37 +00:00
parent 4d265345b7
commit 02c0317eff
3 changed files with 12 additions and 2 deletions

View File

@ -114,3 +114,6 @@ Release 0.23.3 - Unreleased
YARN-68. NodeManager will refuse to shutdown indefinitely due to container
log aggregation (daryn via bobby)
YARN-87. NM ResourceLocalizationService does not set permissions of local
cache directories (Jason Lowe via tgraves)

View File

@ -181,6 +181,7 @@ public void init(Configuration conf) {
try {
// TODO queue deletions here, rather than NM init?
FileContext lfs = getLocalFileContext(conf);
lfs.setUMask(new FsPermission((short)FsPermission.DEFAULT_UMASK));
List<String> localDirs = dirsHandler.getLocalDirs();
for (String localDir : localDirs) {
// $local/usercache

View File

@ -50,6 +50,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.AbstractFileSystem;
import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.fs.Options.ChecksumOpt;
@ -116,6 +117,7 @@ public static void setup() {
@Test
public void testLocalizationInit() throws Exception {
final Configuration conf = new Configuration();
conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "077");
AsyncDispatcher dispatcher = new AsyncDispatcher();
dispatcher.init(new Configuration());
@ -151,14 +153,18 @@ public void testLocalizationInit() throws Exception {
// initialize ResourceLocalizationService
locService.init(conf);
final FsPermission defaultPerm = new FsPermission((short)0755);
// verify directory creation
for (Path p : localDirs) {
Path usercache = new Path(p, ContainerLocalizer.USERCACHE);
verify(spylfs)
.mkdir(eq(usercache), isA(FsPermission.class), eq(true));
.mkdir(eq(usercache),
eq(defaultPerm), eq(true));
Path publicCache = new Path(p, ContainerLocalizer.FILECACHE);
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);
verify(spylfs).mkdir(eq(nmPriv),
eq(ResourceLocalizationService.NM_PRIVATE_PERM), eq(true));