Update nova service state

The primitive ChangeNovaServiceState allows us to change the state of
the nova-compute by calling nova api. The state of a nova-compute can
be ENABLED or DISABLED, however in the current implementation we use
OFFLINE and ONLINE.

Update the code to use ENABLED or DISABLED.

Change-Id: If3d9726bc5ae980b66c7fd4c5b7986f89d8bc690
Closes-Bug: #1523891
This commit is contained in:
Tin Lam
2016-02-21 01:38:51 -06:00
parent 1ddf69a68f
commit 6e380b685b
3 changed files with 13 additions and 13 deletions

View File

@@ -398,7 +398,7 @@ class BasicConsolidation(base.BaseStrategy):
self.add_change_service_state(mig_src_hypervisor.
uuid,
hyper_state.HypervisorState.
OFFLINE.value)
DISABLED.value)
self.number_of_released_nodes += 1
def calculate_num_migrations(self, sorted_vms, current_model,
@@ -455,10 +455,10 @@ class BasicConsolidation(base.BaseStrategy):
count = current_model.get_mapping(). \
get_node_vms_from_id(hypervisor_id)
if len(count) == 0:
if hypervisor.state == hyper_state.HypervisorState.ONLINE:
if hypervisor.state == hyper_state.HypervisorState.ENABLED:
self.add_change_service_state(hypervisor_id,
hyper_state.HypervisorState.
OFFLINE.value)
DISABLED.value)
while self.get_allowed_migration_attempts() >= unsuccessful_migration:
if not first_migration: