From eed5940d30a2c17769e6a38df470f6bd6446af52 Mon Sep 17 00:00:00 2001 From: jichenjc Date: Sat, 1 Mar 2014 22:59:14 +0800 Subject: [PATCH] Remove unnecessary check for CONF.notify_on_state_change Already checked CONF.notify_on_state_change at beginning, no need to check it again Change-Id: I757ff7b71bafdee9e2e6009e7489db520704c8cc --- nova/notifications.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/nova/notifications.py b/nova/notifications.py index a18a2419ce..f1f0738e44 100644 --- a/nova/notifications.py +++ b/nova/notifications.py @@ -122,11 +122,10 @@ def send_update(context, old_instance, new_instance, service=None, host=None): if old_vm_state != new_vm_state: # yes, the vm state is changing: update_with_state_change = True - elif CONF.notify_on_state_change: - if (CONF.notify_on_state_change.lower() == "vm_and_task_state" and - old_task_state != new_task_state): - # yes, the task state is changing: - update_with_state_change = True + elif (CONF.notify_on_state_change.lower() == "vm_and_task_state" and + old_task_state != new_task_state): + # yes, the task state is changing: + update_with_state_change = True if update_with_state_change: # send a notification with state changes @@ -170,11 +169,10 @@ def send_update_with_states(context, instance, old_vm_state, new_vm_state, if old_vm_state != new_vm_state: # yes, the vm state is changing: fire_update = True - elif CONF.notify_on_state_change: - if (CONF.notify_on_state_change.lower() == "vm_and_task_state" and - old_task_state != new_task_state): - # yes, the task state is changing: - fire_update = True + elif (CONF.notify_on_state_change.lower() == "vm_and_task_state" and + old_task_state != new_task_state): + # yes, the task state is changing: + fire_update = True if fire_update: # send either a state change or a regular notification