Define constants for types of reboot job
Adds constants, instead of arbitrary strings, for specifying the type of reboot job. Change-Id: I4f404bdb158899b4d0f50f87a120a222f4bd5939
This commit is contained in:
parent
873a86e9c5
commit
6599e7f814
|
@ -439,8 +439,9 @@ class DRACClient(object):
|
|||
reboot=reboot,
|
||||
start_time=start_time)
|
||||
|
||||
def create_reboot_job(self,
|
||||
reboot_type='graceful_reboot_with_forced_shutdown'):
|
||||
def create_reboot_job(
|
||||
self,
|
||||
reboot_type=constants.RebootJobType.reboot_forced_shutdown):
|
||||
"""Creates a reboot job.
|
||||
|
||||
:param reboot_type: type of reboot
|
||||
|
|
|
@ -50,3 +50,24 @@ class RebootRequired(object):
|
|||
@classmethod
|
||||
def all(cls):
|
||||
return [cls.true, cls.optional, cls.false]
|
||||
|
||||
|
||||
class RebootJobType(object):
|
||||
"""Enumeration of different reboot job types."""
|
||||
|
||||
power_cycle = 'power_cycle'
|
||||
"""Hard power off, power on cycle"""
|
||||
|
||||
graceful_reboot = 'graceful_reboot'
|
||||
"""OS level reboot and wait for OS shutdown"""
|
||||
|
||||
reboot_forced_shutdown = 'reboot_forced_shutdown'
|
||||
"""OS level reboot and force power cycle if OS does not shut
|
||||
down
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def all(cls):
|
||||
return [cls.power_cycle,
|
||||
cls.graceful_reboot,
|
||||
cls.reboot_forced_shutdown]
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
import collections
|
||||
import logging
|
||||
|
||||
from dracclient import constants
|
||||
import dracclient.exceptions as exceptions
|
||||
from dracclient.resources import uris
|
||||
from dracclient import utils
|
||||
|
@ -27,9 +28,9 @@ JobTuple = collections.namedtuple(
|
|||
'percent_complete'])
|
||||
|
||||
REBOOT_TYPES = {
|
||||
'power_cycle': '1',
|
||||
'graceful_reboot_without_forced_shutdown': '2',
|
||||
'graceful_reboot_with_forced_shutdown': '3',
|
||||
constants.RebootJobType.power_cycle: '1',
|
||||
constants.RebootJobType.graceful_reboot: '2',
|
||||
constants.RebootJobType.reboot_forced_shutdown: '3',
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,8 +169,9 @@ class JobManagement(object):
|
|||
|
||||
return self._get_job_id(doc)
|
||||
|
||||
def create_reboot_job(self,
|
||||
reboot_type='graceful_reboot_with_forced_shutdown'):
|
||||
def create_reboot_job(
|
||||
self,
|
||||
reboot_type=constants.RebootJobType.reboot_forced_shutdown):
|
||||
"""Creates a reboot job.
|
||||
|
||||
:param reboot_type: type of reboot
|
||||
|
|
Loading…
Reference in New Issue