merge YARN-615 from trunk. Rename ContainerLaunchContext.containerTokens to tokens. Contributed by Vinod Kumar Vavilapalli.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1482200 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6706e58f61
commit
1f922d3c51
|
@ -810,7 +810,7 @@ public abstract class TaskAttemptImpl implements
|
|||
ContainerLaunchContext container = BuilderUtils.newContainerLaunchContext(
|
||||
commonContainerSpec.getUser(),
|
||||
commonContainerSpec.getLocalResources(), myEnv, commands,
|
||||
myServiceData, commonContainerSpec.getContainerTokens().duplicate(),
|
||||
myServiceData, commonContainerSpec.getTokens().duplicate(),
|
||||
applicationACLs);
|
||||
|
||||
return container;
|
||||
|
|
|
@ -123,7 +123,7 @@ public class TestTaskAttemptContainerRequest {
|
|||
Credentials launchCredentials = new Credentials();
|
||||
|
||||
DataInputByteBuffer dibb = new DataInputByteBuffer();
|
||||
dibb.reset(launchCtx.getContainerTokens());
|
||||
dibb.reset(launchCtx.getTokens());
|
||||
launchCredentials.readTokenStorageStream(dibb);
|
||||
|
||||
// verify all tokens specified for the task attempt are in the launch context
|
||||
|
|
|
@ -46,6 +46,9 @@ Release 2.0.5-beta - UNRELEASED
|
|||
YARN-630. Changed AMRMProtocol api to throw IOException and
|
||||
YarnRemoteException. (Xuan Gong via vinodkv)
|
||||
|
||||
YARN-615. Rename ContainerLaunchContext.containerTokens to tokens.
|
||||
(Vinod Kumar Vavilapalli via sseth)
|
||||
|
||||
NEW FEATURES
|
||||
|
||||
YARN-482. FS: Extend SchedulingMode to intermediate queues.
|
||||
|
|
|
@ -68,20 +68,24 @@ public interface ContainerLaunchContext {
|
|||
void setUser(String user);
|
||||
|
||||
/**
|
||||
* Get security tokens (if security is enabled).
|
||||
* @return security tokens (if security is enabled)
|
||||
* Get all the tokens needed by this container. It may include file-system
|
||||
* tokens, ApplicationMaster related tokens if this container is an
|
||||
* ApplicationMaster or framework level tokens needed by this container to
|
||||
* communicate to various services in a secure manner.
|
||||
*
|
||||
* @return tokens needed by this container.
|
||||
*/
|
||||
@Public
|
||||
@Stable
|
||||
ByteBuffer getContainerTokens();
|
||||
ByteBuffer getTokens();
|
||||
|
||||
/**
|
||||
* Set security tokens (if security is enabled).
|
||||
* @param containerToken security tokens
|
||||
* Set security tokens needed by this container.
|
||||
* @param tokens security tokens
|
||||
*/
|
||||
@Public
|
||||
@Stable
|
||||
void setContainerTokens(ByteBuffer containerToken);
|
||||
void setTokens(ByteBuffer tokens);
|
||||
|
||||
/**
|
||||
* Get <code>LocalResource</code> required by the container.
|
||||
|
|
|
@ -47,7 +47,7 @@ implements ContainerLaunchContext {
|
|||
boolean viaProto = false;
|
||||
|
||||
private Map<String, LocalResource> localResources = null;
|
||||
private ByteBuffer containerTokens = null;
|
||||
private ByteBuffer tokens = null;
|
||||
private Map<String, ByteBuffer> serviceData = null;
|
||||
private Map<String, String> environment = null;
|
||||
private List<String> commands = null;
|
||||
|
@ -73,8 +73,8 @@ implements ContainerLaunchContext {
|
|||
if (this.localResources != null) {
|
||||
addLocalResourcesToProto();
|
||||
}
|
||||
if (this.containerTokens != null) {
|
||||
builder.setContainerTokens(convertToProtoFormat(this.containerTokens));
|
||||
if (this.tokens != null) {
|
||||
builder.setTokens(convertToProtoFormat(this.tokens));
|
||||
}
|
||||
if (this.serviceData != null) {
|
||||
addServiceDataToProto();
|
||||
|
@ -226,25 +226,25 @@ implements ContainerLaunchContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ByteBuffer getContainerTokens() {
|
||||
public ByteBuffer getTokens() {
|
||||
ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder;
|
||||
if (this.containerTokens != null) {
|
||||
return this.containerTokens;
|
||||
if (this.tokens != null) {
|
||||
return this.tokens;
|
||||
}
|
||||
if (!p.hasContainerTokens()) {
|
||||
if (!p.hasTokens()) {
|
||||
return null;
|
||||
}
|
||||
this.containerTokens = convertFromProtoFormat(p.getContainerTokens());
|
||||
return this.containerTokens;
|
||||
this.tokens = convertFromProtoFormat(p.getTokens());
|
||||
return this.tokens;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContainerTokens(ByteBuffer containerTokens) {
|
||||
public void setTokens(ByteBuffer tokens) {
|
||||
maybeInitBuilder();
|
||||
if (containerTokens == null) {
|
||||
builder.clearContainerTokens();
|
||||
if (tokens == null) {
|
||||
builder.clearTokens();
|
||||
}
|
||||
this.containerTokens = containerTokens;
|
||||
this.tokens = tokens;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -269,7 +269,7 @@ message QueueUserACLInfoProto {
|
|||
message ContainerLaunchContextProto {
|
||||
optional string user = 1;
|
||||
repeated StringLocalResourceMapProto localResources = 2;
|
||||
optional bytes container_tokens = 3;
|
||||
optional bytes tokens = 3;
|
||||
repeated StringBytesMapProto service_data = 4;
|
||||
repeated StringStringMapProto environment = 5;
|
||||
repeated string command = 6;
|
||||
|
|
|
@ -288,7 +288,7 @@ public class BuilderUtils {
|
|||
public static ContainerLaunchContext newContainerLaunchContext(
|
||||
String user, Map<String, LocalResource> localResources,
|
||||
Map<String, String> environment, List<String> commands,
|
||||
Map<String, ByteBuffer> serviceData, ByteBuffer containerTokens,
|
||||
Map<String, ByteBuffer> serviceData, ByteBuffer tokens,
|
||||
Map<ApplicationAccessType, String> acls) {
|
||||
ContainerLaunchContext container = recordFactory
|
||||
.newRecordInstance(ContainerLaunchContext.class);
|
||||
|
@ -297,7 +297,7 @@ public class BuilderUtils {
|
|||
container.setEnvironment(environment);
|
||||
container.setCommands(commands);
|
||||
container.setServiceData(serviceData);
|
||||
container.setContainerTokens(containerTokens);
|
||||
container.setTokens(tokens);
|
||||
container.setApplicationACLs(acls);
|
||||
return container;
|
||||
}
|
||||
|
|
|
@ -427,7 +427,7 @@ public class ContainerManagerImpl extends CompositeService implements
|
|||
+ launchContext.getUser());
|
||||
|
||||
// //////////// Parse credentials
|
||||
ByteBuffer tokens = launchContext.getContainerTokens();
|
||||
ByteBuffer tokens = launchContext.getTokens();
|
||||
Credentials credentials = new Credentials();
|
||||
if (tokens != null) {
|
||||
DataInputByteBuffer buf = new DataInputByteBuffer();
|
||||
|
|
|
@ -316,7 +316,7 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
|||
throws IOException {
|
||||
Credentials credentials = new Credentials();
|
||||
DataInputByteBuffer dibb = new DataInputByteBuffer();
|
||||
ByteBuffer tokens = application.getAMContainerSpec().getContainerTokens();
|
||||
ByteBuffer tokens = application.getAMContainerSpec().getTokens();
|
||||
if (tokens != null) {
|
||||
dibb.reset(tokens);
|
||||
credentials.readTokenStorageStream(dibb);
|
||||
|
|
|
@ -195,9 +195,9 @@ public class AMLauncher implements Runnable {
|
|||
Credentials credentials = new Credentials();
|
||||
|
||||
DataInputByteBuffer dibb = new DataInputByteBuffer();
|
||||
if (container.getContainerTokens() != null) {
|
||||
if (container.getTokens() != null) {
|
||||
// TODO: Don't do this kind of checks everywhere.
|
||||
dibb.reset(container.getContainerTokens());
|
||||
dibb.reset(container.getTokens());
|
||||
credentials.readTokenStorageStream(dibb);
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ public class AMLauncher implements Runnable {
|
|||
}
|
||||
DataOutputBuffer dob = new DataOutputBuffer();
|
||||
credentials.writeTokenStorageToStream(dob);
|
||||
container.setContainerTokens(ByteBuffer.wrap(dob.getData(), 0,
|
||||
container.setTokens(ByteBuffer.wrap(dob.getData(), 0,
|
||||
dob.getLength()));
|
||||
|
||||
SecretKey clientSecretKey =
|
||||
|
|
|
@ -184,7 +184,7 @@ public class MockRM extends ResourceManager {
|
|||
DataOutputBuffer dob = new DataOutputBuffer();
|
||||
ts.writeTokenStorageToStream(dob);
|
||||
ByteBuffer securityTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength());
|
||||
clc.setContainerTokens(securityTokens);
|
||||
clc.setTokens(securityTokens);
|
||||
}
|
||||
sub.setAMContainerSpec(clc);
|
||||
req.setApplicationSubmissionContext(sub);
|
||||
|
|
|
@ -78,7 +78,7 @@ public class TestAMAuthorization {
|
|||
public StartContainerResponse
|
||||
startContainer(StartContainerRequest request)
|
||||
throws YarnRemoteException {
|
||||
amTokens = request.getContainerLaunchContext().getContainerTokens();
|
||||
amTokens = request.getContainerLaunchContext().getTokens();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -474,7 +474,7 @@ public class TestRMRestart {
|
|||
securityTokens.rewind();
|
||||
Assert.assertEquals(securityTokens, appState
|
||||
.getApplicationSubmissionContext().getAMContainerSpec()
|
||||
.getContainerTokens());
|
||||
.getTokens());
|
||||
|
||||
// start new RM
|
||||
MockRM rm2 = new TestSecurityMockRM(conf, memStore);
|
||||
|
|
Loading…
Reference in New Issue