cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From frankzh...@apache.org
Subject git commit: updated refs/heads/4.2 to 6032a11
Date Wed, 30 Oct 2013 00:50:48 GMT
Updated Branches:
  refs/heads/4.2 bab3f0fa0 -> 6032a113a


[UCS] increate ipmi command retry


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6032a113
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6032a113
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6032a113

Branch: refs/heads/4.2
Commit: 6032a113a18a0052669f4a0352b8d66911933cc4
Parents: bab3f0f
Author: Frank.Zhang <frank.zhang@citrix.com>
Authored: Tue Oct 29 17:49:39 2013 -0700
Committer: Frank.Zhang <frank.zhang@citrix.com>
Committed: Tue Oct 29 17:49:39 2013 -0700

----------------------------------------------------------------------
 .../networkservice/BareMetalResourceBase.java   | 33 ++++++++++++++++----
 1 file changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6032a113/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
index abe1d4d..2ce6670 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
@@ -255,8 +255,15 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
 		return doScript(cmd, null);
 	}
 
-	protected boolean doScript(Script cmd, OutputInterpreter interpreter) {
-		int retry = 5;
+    protected boolean doScript(Script cmd, int retry) {
+        return doScript(cmd, null, retry);
+    }
+
+    protected boolean doScript(Script cmd, OutputInterpreter interpreter) {
+        return doScript(cmd, interpreter, 5);
+    }
+
+	protected boolean doScript(Script cmd, OutputInterpreter interpreter, int retry) {
 		String res = null;
 		while (retry-- > 0) {
 			if (interpreter == null) {
@@ -266,7 +273,11 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
 			}
 			if (res != null && res.startsWith("Error: Unable to establish LAN")) {
 				s_logger.warn("IPMI script timeout(" + cmd.toString() + "), will retry " + retry + "
times");
-				continue;
+                try {
+                    TimeUnit.SECONDS.sleep(1);
+                } catch (InterruptedException e) {
+                }
+                continue;
 			} else if (res == null) {
 				return true;
 			} else {
@@ -489,8 +500,17 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
 	}
 
 	protected RebootAnswer execute(final RebootCommand cmd) {
-		if (!doScript(_rebootCommand)) {
-			return new RebootAnswer(cmd, "IPMI reboot failed", false);
+        String infoStr = "Command not supported in present state";
+        OutputInterpreter.AllLinesParser interpreter = new OutputInterpreter.AllLinesParser();
+		if (!doScript(_rebootCommand, interpreter, 10)) {
+            if (interpreter.getLines().contains(infoStr)) {
+                // try again, this error should be temporary
+                if (!doScript(_rebootCommand, interpreter, 10)) {
+                    return new RebootAnswer(cmd, "IPMI reboot failed", false);
+                }
+            } else {
+			    return new RebootAnswer(cmd, "IPMI reboot failed", false);
+            }
 		}
 
 		return new RebootAnswer(cmd, "reboot succeeded", true);
@@ -514,7 +534,8 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
 
 			OutputInterpreter.AllLinesParser interpreter = new OutputInterpreter.AllLinesParser();
 			if (!doScript(_getStatusCommand, interpreter)) {
-				s_logger.warn("Cannot get power status of " + _name + ", assume VM state was not changed");
+                success = true;
+				s_logger.warn("Cannot get power status of " + _name + ", assume VM state changed successfully");
 				break;
 			}
 


Mime
View raw message