components/openstack/nova/patches/08-confirm_migration_context.patch
changeset 4982 df1be607c345
child 5405 66fd59fecd68
equal deleted inserted replaced
4981:2da2d7a85ba2 4982:df1be607c345
       
     1 In-house patch to fix a long standing "TODO" for adding the context
       
     2 argument to the confirm_migration() function.
       
     3 
       
     4 --- ./nova/virt/driver.py.~1~	2015-07-06 14:54:33.047120275 -0700
       
     5 +++ ./nova/virt/driver.py	2015-07-06 14:54:38.753366130 -0700
       
     6 @@ -532,7 +532,7 @@ class ComputeDriver(object):
       
     7          """
       
     8          raise NotImplementedError()
       
     9  
       
    10 -    def confirm_migration(self, migration, instance, network_info):
       
    11 +    def confirm_migration(self, context, migration, instance, network_info):
       
    12          """Confirms a resize, destroying the source VM.
       
    13  
       
    14          :param instance: nova.objects.instance.Instance
       
    15 --- ./nova/virt/hyperv/driver.py.~1~	2015-07-06 14:54:08.762060896 -0700
       
    16 +++ ./nova/virt/hyperv/driver.py	2015-07-06 14:54:15.312335765 -0700
       
    17 @@ -205,7 +205,7 @@ class HyperVDriver(driver.ComputeDriver)
       
    18                                                               timeout,
       
    19                                                               retry_interval)
       
    20  
       
    21 -    def confirm_migration(self, migration, instance, network_info):
       
    22 +    def confirm_migration(self, context, migration, instance, network_info):
       
    23          self._migrationops.confirm_migration(migration, instance, network_info)
       
    24  
       
    25      def finish_revert_migration(self, context, instance, network_info,
       
    26 --- ./nova/virt/hyperv/migrationops.py.~1~	2015-07-06 14:54:01.054149365 -0700
       
    27 +++ ./nova/virt/hyperv/migrationops.py	2015-07-06 14:54:07.641370995 -0700
       
    28 @@ -134,7 +134,7 @@ class MigrationOps(object):
       
    29          # disk_info is not used
       
    30          return ""
       
    31  
       
    32 -    def confirm_migration(self, migration, instance, network_info):
       
    33 +    def confirm_migration(self, context, migration, instance, network_info):
       
    34          LOG.debug("confirm_migration called", instance=instance)
       
    35  
       
    36          self._pathutils.get_instance_migr_revert_dir(instance['name'],
       
    37 --- ./nova/virt/vmwareapi/driver.py.~1~	2015-07-06 14:54:25.357745275 -0700
       
    38 +++ ./nova/virt/vmwareapi/driver.py	2015-07-06 14:54:31.960294652 -0700
       
    39 @@ -240,7 +240,7 @@ class VMwareVCDriver(driver.ComputeDrive
       
    40          return _vmops.migrate_disk_and_power_off(context, instance,
       
    41                                                   dest, flavor)
       
    42  
       
    43 -    def confirm_migration(self, migration, instance, network_info):
       
    44 +    def confirm_migration(self, context, migration, instance, network_info):
       
    45          """Confirms a resize, destroying the source VM."""
       
    46          _vmops = self._get_vmops_for_compute_node(instance['node'])
       
    47          _vmops.confirm_migration(migration, instance, network_info)
       
    48 --- ./nova/virt/vmwareapi/vmops.py.~1~	2015-07-06 14:54:16.425639034 -0700
       
    49 +++ ./nova/virt/vmwareapi/vmops.py	2015-07-06 14:54:24.242155495 -0700
       
    50 @@ -1038,7 +1038,7 @@ class VMwareVMOps(object):
       
    51                                         step=3,
       
    52                                         total_steps=RESIZE_TOTAL_STEPS)
       
    53  
       
    54 -    def confirm_migration(self, migration, instance, network_info):
       
    55 +    def confirm_migration(self, context, migration, instance, network_info):
       
    56          """Confirms a resize, destroying the source VM."""
       
    57          # Destroy the original VM. The vm_ref needs to be searched using the
       
    58          # instance.uuid + self._migrate_suffix as the identifier. We will
       
    59 --- ./nova/virt/xenapi/driver.py.~1~	2015-07-06 14:54:39.888243081 -0700
       
    60 +++ ./nova/virt/xenapi/driver.py	2015-07-06 14:54:57.800183720 -0700
       
    61 @@ -203,9 +203,8 @@ class XenAPIDriver(driver.ComputeDriver)
       
    62          self._vmops.spawn(context, instance, image_meta, injected_files,
       
    63                            admin_password, network_info, block_device_info)
       
    64  
       
    65 -    def confirm_migration(self, migration, instance, network_info):
       
    66 +    def confirm_migration(self, context, migration, instance, network_info):
       
    67          """Confirms a resize, destroying the source VM."""
       
    68 -        # TODO(Vek): Need to pass context in for access to auth_token
       
    69          self._vmops.confirm_migration(migration, instance, network_info)
       
    70  
       
    71      def finish_revert_migration(self, context, instance, network_info,
       
    72 --- ./nova/virt/xenapi/vmops.py.~1~	2015-07-06 14:54:59.066221974 -0700
       
    73 +++ ./nova/virt/xenapi/vmops.py	2015-07-06 14:55:06.185514152 -0700
       
    74 @@ -203,7 +203,7 @@ class VMOps(object):
       
    75                  nova_uuids.append(nova_uuid)
       
    76          return nova_uuids
       
    77  
       
    78 -    def confirm_migration(self, migration, instance, network_info):
       
    79 +    def confirm_migration(self, context, migration, instance, network_info):
       
    80          self._destroy_orig_vm(instance, network_info)
       
    81  
       
    82      def _destroy_orig_vm(self, instance, network_info):
       
    83 --- ./nova/virt/fake.py.~1~	2015-07-06 14:53:48.635021003 -0700
       
    84 +++ ./nova/virt/fake.py	2015-07-06 14:53:59.952265943 -0700
       
    85 @@ -434,7 +434,7 @@ class FakeDriver(driver.ComputeDriver):
       
    86                           block_device_info=None, power_on=True):
       
    87          return
       
    88  
       
    89 -    def confirm_migration(self, migration, instance, network_info):
       
    90 +    def confirm_migration(self, context, migration, instance, network_info):
       
    91          return
       
    92  
       
    93      def pre_live_migration(self, context, instance_ref, block_device_info,
       
    94 --- ./nova/virt/libvirt/driver.py.~1~	2015-07-06 14:55:07.301721887 -0700
       
    95 +++ ./nova/virt/libvirt/driver.py	2015-07-06 14:55:13.513983532 -0700
       
    96 @@ -6095,7 +6095,7 @@ class LibvirtDriver(driver.ComputeDriver
       
    97                                                      instance)
       
    98              timer.start(interval=0.5).wait()
       
    99  
       
   100 -    def confirm_migration(self, migration, instance, network_info):
       
   101 +    def confirm_migration(self, context, migration, instance, network_info):
       
   102          """Confirms a resize, destroying the source VM."""
       
   103          self._cleanup_resize(instance, network_info)
       
   104  
       
   105 --- ./nova/compute/manager.py.~1~	2015-07-06 14:56:34.328028956 -0700
       
   106 +++ ./nova/compute/manager.py	2015-07-06 14:56:48.919044192 -0700
       
   107 @@ -3431,7 +3431,7 @@ class ComputeManager(manager.Manager):
       
   108                                 migration.source_compute, teardown=True)
       
   109  
       
   110              network_info = self._get_instance_nw_info(context, instance)
       
   111 -            self.driver.confirm_migration(migration, instance,
       
   112 +            self.driver.confirm_migration(context, migration, instance,
       
   113                                            network_info)
       
   114  
       
   115              migration.status = 'confirmed'