|
@@ -29,6 +29,7 @@ import java.util.Comparator;
|
|
|
|
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
+import org.apache.hadoop.fs.permission.AclEntry;
|
|
|
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.CacheDirectiveInfoExpirationProto;
|
|
|
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.CacheDirectiveInfoProto;
|
|
|
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.CachePoolInfoProto;
|
|
@@ -41,6 +42,7 @@ import org.apache.hadoop.hdfs.server.namenode.FsImageProto.FileSummary;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.FsImageProto.FilesUnderConstructionSection.FileUnderConstructionEntry;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeDirectorySection;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection;
|
|
|
+import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.AclFeatureProto;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INodeDirectory;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INodeSymlink;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeReferenceSection;
|
|
@@ -51,7 +53,7 @@ import org.apache.hadoop.hdfs.server.namenode.FsImageProto.SnapshotSection;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection;
|
|
|
import org.apache.hadoop.hdfs.util.XMLUtils;
|
|
|
import org.apache.hadoop.util.LimitInputStream;
|
|
|
-
|
|
|
+import com.google.common.collect.ImmutableList;
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
|
/**
|
|
@@ -188,7 +190,7 @@ public final class PBImageXmlWriter {
|
|
|
private void dumpINodeDirectory(INodeDirectory d) {
|
|
|
o("mtime", d.getModificationTime()).o("permission",
|
|
|
dumpPermission(d.getPermission()));
|
|
|
-
|
|
|
+ dumpAcls(d.getAcl());
|
|
|
if (d.hasDsQuota() && d.hasNsQuota()) {
|
|
|
o("nsquota", d.getNsQuota()).o("dsquota", d.getDsQuota());
|
|
|
}
|
|
@@ -242,7 +244,7 @@ public final class PBImageXmlWriter {
|
|
|
.o("atime", f.getAccessTime())
|
|
|
.o("perferredBlockSize", f.getPreferredBlockSize())
|
|
|
.o("permission", dumpPermission(f.getPermission()));
|
|
|
-
|
|
|
+ dumpAcls(f.getAcl());
|
|
|
if (f.getBlocksCount() > 0) {
|
|
|
out.print("<blocks>");
|
|
|
for (BlockProto b : f.getBlocksList()) {
|
|
@@ -263,6 +265,18 @@ public final class PBImageXmlWriter {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void dumpAcls(AclFeatureProto aclFeatureProto) {
|
|
|
+ ImmutableList<AclEntry> aclEntryList = FSImageFormatPBINode.Loader
|
|
|
+ .loadAclEntries(aclFeatureProto, stringTable);
|
|
|
+ if (aclEntryList.size() > 0) {
|
|
|
+ out.print("<acls>");
|
|
|
+ for (AclEntry aclEntry : aclEntryList) {
|
|
|
+ o("acl", aclEntry.toString());
|
|
|
+ }
|
|
|
+ out.print("</acls>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void dumpINodeSection(InputStream in) throws IOException {
|
|
|
INodeSection s = INodeSection.parseDelimitedFrom(in);
|
|
|
out.print("<INodeSection>");
|