Files
deb-python-proliantutils/proliantutils/ilo/common.py
Shivanand Tendulker 19be723a66 Add RIS support for updating boot device
Added methods:-
get_persistent_boot_device()
update_persistent_boot()
get_one_time_boot()
set_one_time_boot()

Removed these methods from IloClient as they are not used
by drivers:-
get_persistent_boot()
set_persistent_boot()

Change-Id: I5e9b89e73d560404bc8395d029db8d2fd9fa64d2
2015-07-21 01:09:31 -07:00

49 lines
1.4 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 = 10
def wait_for_ilo_after_reset(ilo_object):
"""Checks if iLO is up after reset."""
retry_count = RETRY_COUNT
# Delay for 10 sec, for the reset operation to take effect.
time.sleep(10)
while retry_count:
try:
ilo_object.get_product_name()
break
except exception.IloError:
retry_count -= 1
time.sleep(5)
else:
msg = ('iLO is not up after reset.')
raise exception.IloConnectionError(msg)
def isDisk(result):
"""Checks if result has a disk related strings."""
disk_identifier = ["Logical Drive", "HDD", "Storage", "LogVol"]
return any(e in result for e in disk_identifier)