Files
deb-python-proliantutils/proliantutils/ilo/common.py
Anusha Ramineni ff214c1fd3 ILO:Check if iLO is up after reset_ilo
This commit adds a function to check if the iLO link is up again
after resetting the iLO.

Change-Id: I70901f35097639dab20edce65cd1fc1dfe68fa43
2015-03-23 09:18:31 +00:00

40 lines
1.2 KiB
Python

# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Common functionalities used by both RIBCL and RIS."""
import time
from proliantutils import exception
# Max number of times an operation to be retried
RETRY_COUNT = 2
def wait_for_ilo_after_reset(ilo_object):
"""Checks if iLO is up after reset."""
retry_count = RETRY_COUNT
while retry_count:
try:
# Delay for 5 sec, for the reset operation to take effect.
time.sleep(5)
ilo_object.get_product_name()
break
except exception.IloError:
retry_count -= 1
else:
msg = ('iLO is not up after reset.')
raise exception.IloConnectionError(msg)