Use consistent tense for VM states
Replace "failed" with "fail" and "disabled" with "disable" for consistency with the remaining states.
This commit is contained in:
parent
6a4c75deb8
commit
531578fd28
|
@ -73,7 +73,7 @@ def getClusterInformation(zk_conn):
|
|||
vm_report_status = list(range(0, vm_count))
|
||||
for index, vm in enumerate(vm_list):
|
||||
vm_state = vm['state']
|
||||
if vm_state != 'start' and vm_state != 'disabled':
|
||||
if vm_state != 'start' and vm_state != 'disable':
|
||||
vm_healthy_status[index] = False
|
||||
else:
|
||||
vm_healthy_status[index] = True
|
||||
|
@ -114,7 +114,7 @@ def getClusterInformation(zk_conn):
|
|||
'stop,ready', 'stop,flush', 'stop,flushed', 'stop,unflush'
|
||||
]
|
||||
vm_state_combinations = [
|
||||
'start', 'restart', 'shutdown', 'stop', 'disabled', 'failed', 'migrate', 'unmigrate'
|
||||
'start', 'restart', 'shutdown', 'stop', 'disable', 'fail', 'migrate', 'unmigrate'
|
||||
]
|
||||
ceph_osd_state_combinations = [
|
||||
'up,in', 'up,out', 'down,in', 'down,out'
|
||||
|
@ -219,7 +219,7 @@ def format_info(cluster_information, oformat):
|
|||
if state == 'total' or state == 'start':
|
||||
continue
|
||||
|
||||
if state == 'disabled':
|
||||
if state == 'disable':
|
||||
colour = ansiprint.blue()
|
||||
else:
|
||||
colour = ansiprint.yellow()
|
||||
|
|
|
@ -400,9 +400,9 @@ def disable_vm(zk_conn, domain):
|
|||
return False, 'ERROR: VM "{}" must be stopped before disabling!'.format(domain)
|
||||
|
||||
# Set the VM to start
|
||||
zkhandler.writedata(zk_conn, {'/domains/{}/state'.format(dom_uuid): 'disabled'})
|
||||
zkhandler.writedata(zk_conn, {'/domains/{}/state'.format(dom_uuid): 'disable'})
|
||||
|
||||
return True, 'Marked VM "{}" as disabled.'.format(domain)
|
||||
return True, 'Marked VM "{}" as disable.'.format(domain)
|
||||
|
||||
def move_vm(zk_conn, domain, target_node):
|
||||
# Validate that VM exists in cluster
|
||||
|
@ -622,7 +622,7 @@ def get_list(zk_conn, node, state, limit, is_fuzzy=True):
|
|||
return False, 'Specified node "{}" is invalid.'.format(node)
|
||||
|
||||
if state:
|
||||
valid_states = [ 'start', 'restart', 'shutdown', 'stop', 'disabled', 'failed', 'migrate', 'unmigrate' ]
|
||||
valid_states = [ 'start', 'restart', 'shutdown', 'stop', 'disable', 'fail', 'migrate', 'unmigrate' ]
|
||||
if not state in valid_states:
|
||||
return False, 'VM state "{}" is not valid.'.format(state)
|
||||
|
||||
|
@ -708,8 +708,8 @@ def format_info(zk_conn, domain_information, long_output):
|
|||
'restart': ansiprint.yellow(),
|
||||
'shutdown': ansiprint.yellow(),
|
||||
'stop': ansiprint.red(),
|
||||
'disabled': ansiprint.blue(),
|
||||
'failed': ansiprint.red(),
|
||||
'disable': ansiprint.blue(),
|
||||
'fail': ansiprint.red(),
|
||||
'migrate': ansiprint.blue(),
|
||||
'unmigrate': ansiprint.blue()
|
||||
}
|
||||
|
@ -868,7 +868,7 @@ def format_list(zk_conn, vm_list, raw):
|
|||
vm_state_colour = ansiprint.yellow()
|
||||
elif domain_information['state'] == 'stop':
|
||||
vm_state_colour = ansiprint.red()
|
||||
elif domain_information['state'] == 'failed':
|
||||
elif domain_information['state'] == 'fail':
|
||||
vm_state_colour = ansiprint.red()
|
||||
else:
|
||||
vm_state_colour = ansiprint.blue()
|
||||
|
|
|
@ -221,7 +221,7 @@ class VMInstance(object):
|
|||
zkhandler.writedata(self.zk_conn, { '/domains/{}/failedreason'.format(self.domuuid): '' })
|
||||
except libvirt.libvirtError as e:
|
||||
self.logger.out('Failed to create VM', state='e', prefix='Domain {}:'.format(self.domuuid))
|
||||
zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(self.domuuid): 'failed' })
|
||||
zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(self.domuuid): 'fail' })
|
||||
zkhandler.writedata(self.zk_conn, { '/domains/{}/failedreason'.format(self.domuuid): str(e) })
|
||||
self.dom = None
|
||||
|
||||
|
@ -420,7 +420,7 @@ class VMInstance(object):
|
|||
# HARDCODE: 90s should be plenty of time for even extremely large VMs on reasonable networks
|
||||
if tick > 90:
|
||||
# The receive timed out
|
||||
zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(self.domuuid): 'failed' })
|
||||
zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(self.domuuid): 'fail' })
|
||||
self.logger.out('Receive timed out without state change', state='e', prefix='Domain {}:'.format(self.domuuid))
|
||||
break
|
||||
|
||||
|
@ -447,9 +447,9 @@ class VMInstance(object):
|
|||
# If we've already been waiting 120s for a shutdown
|
||||
# HARDCODE: The remote timeout is 90s, so an extra 30s of buffer
|
||||
if tick > 120:
|
||||
# The shutdown timed out; something is very amiss, so switch state to failed and abort
|
||||
# The shutdown timed out; something is very amiss, so switch state to fail and abort
|
||||
zkhandler.writedata(self.zk_conn, {
|
||||
'/domains/{}/state'.format(self.domuuid): 'failed',
|
||||
'/domains/{}/state'.format(self.domuuid): 'fail',
|
||||
'/domains/{}/failedreason'.format(self.domuuid): 'Timeout waiting for migrate or shutdown'
|
||||
})
|
||||
self.logger.out('Shutdown timed out without state change', state='e', prefix='Domain {}:'.format(self.domuuid))
|
||||
|
|
Loading…
Reference in New Issue