HDFS-4116. Add auditlog for some snapshot operations. Contributed by Jing Zhao.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2802@1404860 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
04b2adca05
commit
98c0f13b19
@ -40,3 +40,5 @@ Branch-2802 Snapshot (Unreleased)
|
|||||||
|
|
||||||
HDFS-4133. Add testcases for testing basic snapshot functionalities.
|
HDFS-4133. Add testcases for testing basic snapshot functionalities.
|
||||||
(Jing Zhao via suresh)
|
(Jing Zhao via suresh)
|
||||||
|
|
||||||
|
HDFS-4116. Add auditlog for some snapshot operations. (Jing Zhao via suresh)
|
||||||
|
@ -5519,7 +5519,8 @@ public void allowSnapshot(String path) throws SafeModeException, IOException {
|
|||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
if (isInSafeMode()) {
|
if (isInSafeMode()) {
|
||||||
throw new SafeModeException("Cannot allow snapshot for " + path, safeMode);
|
throw new SafeModeException("Cannot allow snapshot for " + path,
|
||||||
|
safeMode);
|
||||||
}
|
}
|
||||||
checkOwner(path);
|
checkOwner(path);
|
||||||
|
|
||||||
@ -5531,7 +5532,10 @@ public void allowSnapshot(String path) throws SafeModeException, IOException {
|
|||||||
}
|
}
|
||||||
getEditLog().logSync();
|
getEditLog().logSync();
|
||||||
|
|
||||||
//TODO: audit log
|
if (auditLog.isInfoEnabled() && isExternalInvocation()) {
|
||||||
|
logAuditEvent(UserGroupInformation.getCurrentUser(), getRemoteIp(),
|
||||||
|
"allowSnapshot", path, null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disallow snapshot on a directory.
|
// Disallow snapshot on a directory.
|
||||||
@ -5539,6 +5543,11 @@ public void allowSnapshot(String path) throws SafeModeException, IOException {
|
|||||||
public void disallowSnapshot(String snapshotRoot)
|
public void disallowSnapshot(String snapshotRoot)
|
||||||
throws SafeModeException, IOException {
|
throws SafeModeException, IOException {
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
|
|
||||||
|
if (auditLog.isInfoEnabled() && isExternalInvocation()) {
|
||||||
|
logAuditEvent(UserGroupInformation.getCurrentUser(), getRemoteIp(),
|
||||||
|
"disallowSnapshot", snapshotRoot, null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -5552,7 +5561,8 @@ public void createSnapshot(String snapshotName, String path)
|
|||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
if (isInSafeMode()) {
|
if (isInSafeMode()) {
|
||||||
throw new SafeModeException("Cannot create snapshot for " + path, safeMode);
|
throw new SafeModeException("Cannot create snapshot for " + path,
|
||||||
|
safeMode);
|
||||||
}
|
}
|
||||||
checkOwner(path);
|
checkOwner(path);
|
||||||
|
|
||||||
@ -5568,6 +5578,10 @@ public void createSnapshot(String snapshotName, String path)
|
|||||||
}
|
}
|
||||||
getEditLog().logSync();
|
getEditLog().logSync();
|
||||||
|
|
||||||
//TODO: audit log
|
if (auditLog.isInfoEnabled() && isExternalInvocation()) {
|
||||||
|
Path snapshotRoot = new Path(path, ".snapshot/" + snapshotName);
|
||||||
|
logAuditEvent(UserGroupInformation.getCurrentUser(), getRemoteIp(),
|
||||||
|
"createSnapshot", path, snapshotRoot.toString(), null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user