Merge "Add api to query an upgrade is in progress"
This commit is contained in:
commit
0781b817d9
@ -33,5 +33,6 @@ app = {
|
||||
'/v1/ihosts/[a-z0-9\-]+/icpus/platform_cpu_list',
|
||||
'/v1/ihosts/[a-z0-9\-]+/icpus/vswitch_cpu_list',
|
||||
'/v1/upgrade/[a-zA-Z0-9\-]+/in_upgrade',
|
||||
'/v1/upgrade/[a-zA-Z0-9\-]+/upgrade_in_progress',
|
||||
]
|
||||
}
|
||||
|
@ -124,6 +124,7 @@ class UpgradeController(rest.RestController):
|
||||
_custom_actions = {
|
||||
'check_reinstall': ['GET'],
|
||||
'in_upgrade': ['GET'],
|
||||
'upgrade_in_progress': ['GET'],
|
||||
}
|
||||
|
||||
def __init__(self, parent=None, **kwargs):
|
||||
@ -449,3 +450,20 @@ class UpgradeController(rest.RestController):
|
||||
except exception.NotFound:
|
||||
return False
|
||||
return True
|
||||
|
||||
@wsme_pecan.wsexpose(wtypes.text, six.text_type)
|
||||
def upgrade_in_progress(self, uuid):
|
||||
# uuid is added here for potential future use
|
||||
try:
|
||||
upgrade = pecan.request.dbapi.software_upgrade_get_one()
|
||||
|
||||
# upgrade in progress only when upgrade starts and not abort
|
||||
if upgrade.state and upgrade.state not in [
|
||||
constants.UPGRADE_ABORTING_ROLLBACK,
|
||||
constants.UPGRADE_ABORTING,
|
||||
constants.UPGRADE_ABORT_COMPLETING]:
|
||||
return True
|
||||
|
||||
except exception.NotFound:
|
||||
return False
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user