hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077482 - in /hadoop/common/branches/branch-0.20-security-patches/src/test/system: aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj conf/system-test.xml java/org/apache/hadoop/test/system/DaemonProtocol.java
Date Fri, 04 Mar 2011 04:19:34 GMT
Author: omalley
Date: Fri Mar  4 04:19:34 2011
New Revision: 1077482

URL: http://svn.apache.org/viewvc?rev=1077482&view=rev
Log:
commit a1c1c6a3c2b5d3cd7d5467a73cb1dc7e05c176a0
Author: Vinay Kumar Thota <vinayt@yahoo-inc.com>
Date:   Wed May 26 06:08:59 2010 +0000

    HADOOP:6777 from https://issues.apache.org/jira/secure/attachment/12445529/6777-ydist-security.patch

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
    hadoop/common/branches/branch-0.20-security-patches/src/test/system/conf/system-test.xml
    hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/DaemonProtocol.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj?rev=1077482&r1=1077481&r2=1077482&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
Fri Mar  4 04:19:34 2011
@@ -31,6 +31,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.Shell.ShellCommandExecutor;
+import org.apache.hadoop.util.Shell;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -273,6 +274,56 @@ public aspect DaemonProtocolAspect {
     String output = shexec.getOutput();
     return Integer.parseInt(output.replaceAll("\n", "").trim());
   }
+  
+  /**
+   * This method is used for suspending the process.
+   * @param pid process id
+   * @throws IOException if an I/O error occurs.
+   * @return true if process is suspended otherwise false.
+   */
+  public boolean DaemonProtocol.suspendProcess(String pid) throws IOException {
+    String suspendCmd = getDaemonConf().get("test.system.hdrc.suspend.cmd",
+        "kill -SIGSTOP");
+    String [] command = {"bash", "-c", suspendCmd + " " + pid};
+    ShellCommandExecutor shexec = new ShellCommandExecutor(command);
+    try {
+      shexec.execute();
+    } catch (Shell.ExitCodeException e) {
+      LOG.warn("suspended process throws an exitcode "
+          + "exception for not being suspended the given process id.");
+      return false;
+    }
+    LOG.info("The suspend process command is :"
+        + shexec.toString()
+        + " and the output for the command is "
+        + shexec.getOutput());
+    return true;
+  }
+
+  /**
+   * This method is used for resuming the process
+   * @param pid process id of suspended process.
+   * @throws IOException if an I/O error occurs.
+   * @return true if suspeneded process is resumed otherwise false.
+   */
+  public boolean DaemonProtocol.resumeProcess(String pid) throws IOException {
+    String resumeCmd = getDaemonConf().get("test.system.hdrc.resume.cmd",
+        "kill -SIGCONT");
+    String [] command = {"bash", "-c", resumeCmd + " " + pid};
+    ShellCommandExecutor shexec = new ShellCommandExecutor(command);
+    try {
+      shexec.execute();
+    } catch(Shell.ExitCodeException e) {
+        LOG.warn("Resume process throws an exitcode "
+          + "exception for not being resumed the given process id.");
+      return false;
+    }
+    LOG.info("The resume process command is :"
+        + shexec.toString()
+        + " and the output for the command is "
+        + shexec.getOutput());
+    return true;
+  }
 
   private String DaemonProtocol.user = null;
   
@@ -284,4 +335,3 @@ public aspect DaemonProtocolAspect {
     this.user = user;
   }
 }
-

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/system/conf/system-test.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/system/conf/system-test.xml?rev=1077482&r1=1077481&r2=1077482&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/system/conf/system-test.xml
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/system/conf/system-test.xml
Fri Mar  4 04:19:34 2011
@@ -76,6 +76,21 @@ neutral at the forward-port stage -->
   before pushing into new config folder location in the cluster.
   </description>
 </property>
+<property>
+  <name>test.system.hdrc.suspend.cmd</name>
+  <value>kill -SIGSTOP</value>
+  <description>
+    Command for suspending the given process.
+  </description>
+</property>
+<property>
+  <name>test.system.hdrc.resume.cmd</name>
+  <value>kill -SIGCONT</value>
+  <description>
+  Command for resuming the given suspended process.
+  </description>
+</property>
+
 
 <!-- Mandatory keys to be set for the multi user support to be enabled.  -->
 

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/DaemonProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/DaemonProtocol.java?rev=1077482&r1=1077481&r2=1077482&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/DaemonProtocol.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/DaemonProtocol.java
Fri Mar  4 04:19:34 2011
@@ -162,4 +162,21 @@ public interface DaemonProtocol extends 
    * @throws IOException in case of errors
    */
   String getDaemonUser() throws IOException;
+  
+  /**
+   * It uses for suspending the process.
+   * @param pid process id.
+   * @return true if the process is suspended otherwise false.
+   * @throws IOException if an I/O error occurs.
+   */
+  boolean suspendProcess(String pid) throws IOException;
+
+  /**
+   * It uses for resuming the suspended process.
+   * @param pid process id
+   * @return true if suspended process is resumed otherwise false.
+   * @throws IOException if an I/O error occurs.
+   */
+  boolean resumeProcess(String pid) throws IOException;
+
 }



Mime
View raw message