From 88047a458b94ab2db3af360b6615f5812f22819a Mon Sep 17 00:00:00 2001 From: "Frank.Zhang" Date: Fri, 8 Nov 2013 13:44:07 -0800 Subject: [PATCH] CLOUDSTACK-5112 [Baremetal]Make IPMI retry times configurable --- .../networkservice/BareMetalResourceBase.java | 12 ++++++++++-- server/src/com/cloud/configuration/Config.java | 2 +- setup/db/db/schema-420to421.sql | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) 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 2ce6670cf33..2d12dcdf50d 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java @@ -90,6 +90,8 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource protected Script2 _bootOrRebootCommand; protected String _vmName; protected VMInstanceDao vmDao; + protected int ipmiRetryTimes = 5; + private void changeVmState(String vmName, VirtualMachine.State state) { synchronized (_vms) { @@ -157,14 +159,20 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource _isEchoScAgent = Boolean.valueOf(echoScAgent); } + ConfigurationDao configDao = ComponentContext.getComponent(ConfigurationDao.class); String ipmiIface = "default"; try { - ConfigurationDao configDao = ComponentContext.getComponent(ConfigurationDao.class); ipmiIface = configDao.getValue(Config.BaremetalIpmiLanInterface.key()); } catch (Exception e) { s_logger.debug(e.getMessage(), e); } + try { + ipmiRetryTimes = Integer.valueOf(configDao.getValue(Config.BaremetalIpmiRetryTimes.key())); + } catch (Exception e) { + s_logger.debug(e.getMessage(), e); + } + String injectScript = "scripts/util/ipmi.py"; String scriptPath = Script.findScript("", injectScript); if (scriptPath == null) { @@ -260,7 +268,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource } protected boolean doScript(Script cmd, OutputInterpreter interpreter) { - return doScript(cmd, interpreter, 5); + return doScript(cmd, interpreter, ipmiRetryTimes); } protected boolean doScript(Script cmd, OutputInterpreter interpreter, int retry) { diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index f3cb9196658..f06b4631f51 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -230,7 +230,6 @@ public enum Config { "If true, when account has dedicated guest vlan range(s), once the vlans dedicated to the account have been" + " consumed vlans will be allocated from the system pool", null, ConfigurationParameterScope.account.toString()), - // LB HealthCheck Interval. LBHealthCheck("Advanced", ManagementServer.class, String.class, "healthcheck.update.interval", "600", "Time Interval to fetch the LB health check states (in sec)", null), @@ -424,6 +423,7 @@ public enum Config { IntervalToEchoBaremetalSecurityGroupAgent("Advanced", ManagementServer.class, Integer.class, "interval.baremetal.securitygroup.agent.echo", "10", "Interval to echo baremetal security group agent, in seconds", null), TimeoutToEchoBaremetalSecurityGroupAgent("Advanced", ManagementServer.class, Integer.class, "timeout.baremetal.securitygroup.agent.echo", "3600", "Timeout to echo baremetal security group agent, in seconds, the provisioning process will be treated as a failure", null), BaremetalIpmiLanInterface("Advanced", ManagementServer.class, String.class, "baremetal.ipmi.lan.interface", "default", "option specified in -I option of impitool. candidates are: open/bmc/lipmi/lan/lanplus/free/imb, see ipmitool man page for details. default valule 'default' means using default option of ipmitool", null), + BaremetalIpmiRetryTimes("Advanced", ManagementServer.class, String.class, "baremetal.ipmi.fail.retry", "5", "ipmi interface will be temporary out of order after power opertions(e.g. cycle, on), it leads following commands fail immediately. The value specifies retry times before accounting it as real failure", null), ApiLimitEnabled("Advanced", ManagementServer.class, Boolean.class, "api.throttling.enabled", "false", "Enable/disable Api rate limit", null), ApiLimitInterval("Advanced", ManagementServer.class, Integer.class, "api.throttling.interval", "1", "Time interval (in seconds) to reset API count", null), diff --git a/setup/db/db/schema-420to421.sql b/setup/db/db/schema-420to421.sql index d429b30c014..baadbda22b4 100644 --- a/setup/db/db/schema-420to421.sql +++ b/setup/db/db/schema-420to421.sql @@ -221,3 +221,5 @@ CREATE VIEW `cloud`.`user_vm_view` AS update `cloud`.`volumes` v, `cloud`.`volume_host_ref` vhr set v.format=vhr.format where v.id=vhr.volume_id and v.format is null; +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'baremetal.ipmi.lan.interface', 'default', 'option specified in -I option of impitool. candidates are: open/bmc/lipmi/lan/lanplus/free/imb, see ipmitool man page for details. default valule "default" means using default option of ipmitool'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'baremetal.ipmi.fail.retry', 'default', "ipmi interface will be temporary out of order after power opertions(e.g. cycle, on), it leads following commands fail immediately. The value specifies retry times before accounting it as real failure");