live migration did not send notification for other componments

Bug #1167759 reported by Guangya Liu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Guangya Liu (Jay Lau)

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)

Revision history for this message
John Garbutt (johngarbutt) wrote :

Please submit patch into Gerrit for review:
https://wiki.openstack.org/wiki/Gerrit_Workflow

Changed in nova:
status: New → Incomplete
Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Medium
status: Incomplete → Triaged
Changed in nova:
assignee: nobody → Jay Lau (jay-lau-513)
Changed in nova:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/28871

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/28871
Committed: http://github.com/openstack/nova/commit/fe8bddc0f25c78af3cd98ba06b0768f2a99b9093
Submitter: Jenkins
Branch: master

commit fe8bddc0f25c78af3cd98ba06b0768f2a99b9093
Author: Jay Lau <email address hidden>
Date: Sat May 11 21:53:20 2013 +0800

    Add notification for live migration

    Fix bug 1167759

    Currently, if live migration failed, nova compute did not send
    notification, this causes other services such as nova-scheduler
    to have no chance to do some operations

    The fix add notification logic for live_migration like other
    VM instance operations such as resize, run instance etc.

    Change-Id: Iaf61f5268e07284fd7d69ff331ce3bacd380c02b

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-1
status: Fix Committed → Fix Released
GuoHui Liu (guohliu)
tags: added: grizzly-backport-potential
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-1 → 2013.2
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.