GitHub user leo79901 added a comment to the discussion: Issue with Fenced
I don't know much about Java. This is just a conclusion drawn from my little
understanding of the code.
I think there may be a bug.
I found these code here:
```
@Override
public boolean fence(Host r) throws HAFenceException {
try {
if (outOfBandManagementService.isOutOfBandManagementEnabled(r)){
final OutOfBandManagementResponse resp =
outOfBandManagementService.executePowerOperation(r, PowerOperation.OFF, null);
return resp.getSuccess();
} else {
LOG.warn("OOBM fence operation failed for this host " +
r.getName());
return false;
}
} catch (Exception e){
LOG.warn("OOBM service is not configured or enabled for this host "
+ r.getName() + " error is " + e.getMessage());
throw new HAFenceException("OBM service is not configured or
enabled for this host " + r.getName() , e);
}
}
```
ACS wants to shut down the host by IPMI in the `fencing` step.
from here:
```
if (outOfBandManagementService.isOutOfBandManagementEnabled(r)){
final OutOfBandManagementResponse resp =
outOfBandManagementService.executePowerOperation(r, PowerOperation.OFF, null);
```
finally , it run this command:
`
/usr/bin/ipmitool -I lanplus -R 1 -v -H 10.21.0.22 -p 623 -U root -P XXXXXXXXX
chassis power off
`
But it is wrong while shutting down a server which is already shut. I have run
it manually and get this error.
```
[root@idnode1 ~]# /usr/bin/ipmitool -I lanplus -R 1 -v -H 10.21.0.22 -p 623 -U
root -P XXXXXXXXX chassis power off
Set Chassis Power Control to Down/Off failed: Command not supported in present
state
```
So it was run again and again.
Maybe we can add some code to resolve it.
Return true if the host is already down
```
public boolean fence(Host r) throws HAFenceException {
try {
// check host status
if (r.getStatus().equals(Host.Status.DOWN)) {
LOG.info("Host " + r.getName() + " is already down. Returning
success.");
return true;
}
if (outOfBandManagementService.isOutOfBandManagementEnabled(r)) {
final OutOfBandManagementResponse resp =
outOfBandManagementService.executePowerOperation(r, PowerOperation.OFF, null);
return resp.getSuccess();
} else {
LOG.warn("OOBM fence operation failed for this host " +
r.getName());
return false;
}
} catch (Exception e) {
LOG.warn("OOBM service is not configured or enabled for this host " +
r.getName() + " error is " + e.getMessage());
throw new HAFenceException("OBM service is not configured or enabled
for this host " + r.getName(), e);
}
}
```
GitHub link:
https://github.com/apache/cloudstack/discussions/10026#discussioncomment-11449123
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]