HDFS-13217. Audit log all EC policy names during addErasureCodingPolicies. Contributed by liaoyuxiangqin.
This commit is contained in:
parent
c15853f87a
commit
81fbfe500e
@ -7475,9 +7475,10 @@ AddErasureCodingPolicyResponse[] addErasureCodingPolicies(
|
|||||||
ErasureCodingPolicy[] policies, final boolean logRetryCache)
|
ErasureCodingPolicy[] policies, final boolean logRetryCache)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final String operationName = "addErasureCodingPolicies";
|
final String operationName = "addErasureCodingPolicies";
|
||||||
String addECPolicyName = "";
|
List<String> addECPolicyNames = new ArrayList<>(policies.length);
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
List<AddErasureCodingPolicyResponse> responses = new ArrayList<>();
|
List<AddErasureCodingPolicyResponse> responses =
|
||||||
|
new ArrayList<>(policies.length);
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
@ -7488,7 +7489,7 @@ AddErasureCodingPolicyResponse[] addErasureCodingPolicies(
|
|||||||
ErasureCodingPolicy newPolicy =
|
ErasureCodingPolicy newPolicy =
|
||||||
FSDirErasureCodingOp.addErasureCodingPolicy(this, policy,
|
FSDirErasureCodingOp.addErasureCodingPolicy(this, policy,
|
||||||
logRetryCache);
|
logRetryCache);
|
||||||
addECPolicyName = newPolicy.getName();
|
addECPolicyNames.add(newPolicy.getName());
|
||||||
responses.add(new AddErasureCodingPolicyResponse(newPolicy));
|
responses.add(new AddErasureCodingPolicyResponse(newPolicy));
|
||||||
} catch (HadoopIllegalArgumentException e) {
|
} catch (HadoopIllegalArgumentException e) {
|
||||||
responses.add(new AddErasureCodingPolicyResponse(policy, e));
|
responses.add(new AddErasureCodingPolicyResponse(policy, e));
|
||||||
@ -7501,7 +7502,8 @@ AddErasureCodingPolicyResponse[] addErasureCodingPolicies(
|
|||||||
if (success) {
|
if (success) {
|
||||||
getEditLog().logSync();
|
getEditLog().logSync();
|
||||||
}
|
}
|
||||||
logAuditEvent(success, operationName, addECPolicyName, null, null);
|
logAuditEvent(success, operationName, addECPolicyNames.toString(),
|
||||||
|
null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user