Skip to content
Permalink
Browse files

Merge pull request #46 from redhat-performance/development

Fix for double reboot.
  • Loading branch information...
sadsfae committed Jul 25, 2019
2 parents 05d41a5 + c150aa8 commit 3ddd9946ff9daf88fb2f75794012ef772b886e1c
Showing with 15 additions and 8 deletions.
  1. +7 −0 README.md
  2. +7 −7 badfish.py
  3. +1 −1 tests/config.py
@@ -15,6 +15,7 @@
* [Forcing a one time boot to a specific device](#forcing-a-one-time-boot-to-a-specific-device)
* [Forcing a one-time boot to PXE](#forcing-a-one-time-boot-to-pxe)
* [Rebooting a System](#rebooting-a-system)
* [Power Cycling a System](#power-cycling-a-system)
* [Resetting iDRAC](#resetting-idrac)
* [Check current boot order](#check-current-boot-order)
* [Variable number of retries](#variable-number-of-retries)
@@ -108,6 +109,12 @@ In certain cases you might need to only reboot the host, for this case we includ
./badfish.py -H mgmt-your-server.example.com -u root -p yourpass --reboot-only
```

### Power cycling a system
For a hard reset you can use ```--power-cycle``` flag which will run a ForceOff instruction on the target host. Note that this option is not to be used with any other option.
```
./badfish.py -H mgmt-your-server.example.com -u root -p yourpass --power-cycle
```

### Resetting iDRAC
For the replacement of `racadm racreset`, the optional argument `--racreset` was added. When this argument is passed to ```badfish```, a graceful restart is triggered on the iDRAC itself.
```
@@ -499,13 +499,9 @@ def reboot_server(self, graceful=True):
if graceful:
self.send_reset("GracefulRestart")

host_down = self.polling_host_state("Off")

if not host_down:
self.logger.warning(
"Unable to graceful shutdown the server, will perform forced shutdown now."
)
self.send_reset("ForceOff")
self.logger.warning(
"Graceful shutdown executed. This might take a few minutes."
)
else:
self.send_reset("ForceOff")

@@ -748,6 +744,7 @@ def execute_badfish(_host, _args, logger):
device = _args["boot_to"]
boot_to_type = _args["boot_to_type"]
reboot_only = _args["reboot_only"]
power_cycle = _args["power_cycle"]
racreset = _args["racreset"]
check_boot = _args["check_boot"]
firmware_inventory = _args["firmware_inventory"]
@@ -762,6 +759,8 @@ def execute_badfish(_host, _args, logger):

if reboot_only:
badfish.reboot_server()
elif power_cycle:
badfish.reboot_server(graceful=False)
elif racreset:
badfish.reset_idrac()
elif device:
@@ -799,6 +798,7 @@ def main(argv=None):
parser.add_argument("--boot-to", help="Set next boot to one-shot boot to a specific device")
parser.add_argument("--boot-to-type", help="Set next boot to one-shot boot to either director or foreman")
parser.add_argument("--reboot-only", help="Flag for only rebooting the host", action="store_true")
parser.add_argument("--power-cycle", help="Flag for sending ForceOff instruction to the host", action="store_true")
parser.add_argument("--racreset", help="Flag for iDRAC reset", action="store_true")
parser.add_argument("--check-boot", help="Flag for checking the host boot order", action="store_true")
parser.add_argument("--firmware-inventory", help="Get firmware inventory", action="store_true")
@@ -75,7 +75,7 @@ def render_device_dict(index, device):
RESPONSE_REBOOT_ONLY_SUCCESS = "- INFO - Systems service: /redfish/v1/Systems/System.Embedded.1.\n" \
"- INFO - Managers service: /redfish/v1/Managers/iDRAC.Embedded.1.\n" \
"- INFO - Command passed to GracefulRestart server, code return is 204.\n" \
"- INFO - Polling for host state: Off\n" \
"- WARNING - Graceful shutdown executed. This might take a few minutes.\n" \
"- INFO - Polling for host state: Not Down\n" \
"- INFO - Command passed to On server, code return is 204.\n"

0 comments on commit 3ddd994

Please sign in to comment.
You can’t perform that action at this time.