← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1167759] Re: live migration did not send notification for other componments

 

** Changed in: nova
       Status: Fix Committed => Fix Released

** Changed in: nova
    Milestone: None => havana-1

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1167759

Title:
  live migration did not send notification for other componments

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  Currently, if live migration failed, nova compute did not send
  notification, this caused other service such as nova-scheduler has no
  chance to do some operation based on the result of live migration.

  It is better that we add notification logic for live_migration logic
  like other operations such as resize, run instance etc.

  A proposed code diff would be as following, please feel free to show
  your comments if any. Thanks.

  After some discussion with Joe, we work out a draft code diff for
  compute/manager.py. I did not get a chance to do some test, just
  append the logic here. Please show your comments if any.

  root@liugya-ubuntu:~/src/nova-es/nova/nova/compute# git diff
  diff --git a/nova/compute/manager.py b/nova/compute/manager.py
  index 687594a..b8b99b6 100755
  --- a/nova/compute/manager.py
  +++ b/nova/compute/manager.py
  @@ -3127,6 +3127,10 @@ class ComputeManager(manager.SchedulerDependentManager):
           return self.driver.check_can_live_migrate_source(ctxt, instance,
                                                            dest_check_data)
   
  +    @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
  +    @reverts_task_state
  +    @wrap_instance_event
  +    @wrap_instance_fault
       def pre_live_migration(self, context, instance,
                              block_migration=False, disk=None,
                              migrate_data=None):
  @@ -3146,6 +3150,10 @@ class ComputeManager(manager.SchedulerDependentManager):
   
           network_info = self._get_instance_nw_info(context, instance)
   
  +        self._notify_about_instance_usage(
  +            context, instance, "pre.live_migration.start",
  +            network_info=network_info)
  +
           # TODO(tr3buchet): figure out how on the earth this is necessary
           fixed_ips = network_info.fixed_ips()
           if not fixed_ips:
  @@ -3173,7 +3181,14 @@ class ComputeManager(manager.SchedulerDependentManager):
           # Preparation for block migration
           if block_migration:
               self.driver.pre_block_migration(context, instance, disk)
  +        self._notify_about_instance_usage(
  +            context, instance, "pre.live_migration.end",
  +            network_info=network_info)
   
  +    @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
  +    @reverts_task_state
  +    @wrap_instance_event
  +    @wrap_instance_fault
       def live_migration(self, context, dest, instance,
                          block_migration=False, migrate_data=None):
           """Executing live migration.
  @@ -3286,6 +3301,10 @@ class ComputeManager(manager.SchedulerDependentManager):
                      "This error can be safely ignored."),
                    instance=instance_ref)
   
  +    @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
  +    @reverts_task_state
  +    @wrap_instance_event
  +    @wrap_instance_fault
       def post_live_migration_at_destination(self, context, instance,
                                              block_migration=False):
           """Post operations for live migration .
  @@ -3311,6 +3330,9 @@ class ComputeManager(manager.SchedulerDependentManager):
                                                              migration)
   
           network_info = self._get_instance_nw_info(context, instance)
  +        self._notify_about_instance_usage(
  +            context, instance, "post.live_migration.start",
  +            network_info=network_info)
           block_device_info = self._get_instance_volume_block_device_info(
                               context, instance)
   
  @@ -3326,6 +3348,9 @@ class ComputeManager(manager.SchedulerDependentManager):
   
           # NOTE(vish): this is necessary to update dhcp
           self.network_api.setup_networks_on_host(context, instance, self.host)
  +        self._notify_about_instance_usage(
  +            context, instance, "post.live_migration.end",
  +            network_info=network_info)
   
       def _rollback_live_migration(self, context, instance,
                                    dest, block_migration, migrate_data=None):
  @@ -3369,6 +3394,10 @@ class ComputeManager(manager.SchedulerDependentManager):
               self.compute_rpcapi.rollback_live_migration_at_destination(context,
                       instance, dest)
   
  +    @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
  +    @reverts_task_state
  +    @wrap_instance_event
  +    @wrap_instance_fault
       def rollback_live_migration_at_destination(self, context, instance):
           """Cleaning up image directory that is created pre_live_migration.
   
  @@ -3377,6 +3406,9 @@ class ComputeManager(manager.SchedulerDependentManager):
           """
           network_info = self._get_instance_nw_info(context, instance)
   
  +        self._notify_about_instance_usage(
  +            context, instance, "rollback.live_migration.start",
  +            network_info=network_info)
           # NOTE(tr3buchet): tear down networks on destination host
           self.network_api.setup_networks_on_host(context, instance,
                                                   self.host, teardown=True)
  @@ -3387,6 +3419,9 @@ class ComputeManager(manager.SchedulerDependentManager):
                               context, instance)
           self.driver.destroy(instance, self._legacy_nw_info(network_info),
                               block_device_info)
  +        self._notify_about_instance_usage(
  +            context, instance, "rollback.live_migration.end",
  +            network_info=network_info)
   
       @manager.periodic_task
       def _heal_instance_info_cache(self, context)

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1167759/+subscriptions