← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1290807] [NEW] Resize on vCenter failed becausee of _VM_REFS_CACHE

 

Public bug reported:

This bug is for ice-house latest code version.

The resize action in vmware environment always fails.

The reason is that nova resized the ****-orign rather than the new
cloned vm.

It is caused by the outdated vm_ref in _VM_REFS_CACHE.

In nova/virt/vmwareapi/vmops.py:

def finish_migration(self, context, migration, instance, disk_info,
                         network_info, image_meta, resize_instance=False,
                         block_device_info=None, power_on=True):
        """Completes a resize, turning on the migrated instance."""
        if resize_instance:
            client_factory = self._session._get_vim().client.factory
            vm_ref = vm_util.get_vm_ref(self._session, instance)
            vm_resize_spec = vm_util.get_vm_resize_spec(client_factory,
                                                        instance)
            reconfig_task = self._session._call_method(
                                            self._session._get_vim(),
                                            "ReconfigVM_Task", vm_ref,
                                            spec=vm_resize_spec)
           .......

>From this code, we can see we get vm_ref by vm_util.get_vm_ref.

In nova/virt/vmwareapi/vm_util.py

@vm_ref_cache_from_instance
def get_vm_ref(session, instance):
    """Get reference to the VM through uuid or vm name."""
    uuid = instance['uuid']
    vm_ref = (_get_vm_ref_from_vm_uuid(session, uuid) or
                  _get_vm_ref_from_extraconfig(session, uuid) or
                  _get_vm_ref_from_uuid(session, uuid) or
                  _get_vm_ref_from_name(session, instance['name']))
    if vm_ref is None:
        raise exception.InstanceNotFound(instance_id=uuid)
    return vm_ref

The "get_vm_ref" method is decorated by "vm_ref_cache_from_instance".
"vm_ref_cache_from_instance" will firstly check cache variable _VM_REFS_CACHE. But _VM_REFS_CACHE contains a outdated vm_ref keyed by our instance_uuid, because the virtual machine's name is changed.

** Affects: nova
     Importance: Undecided
         Status: New

** Description changed:

- This code is for ice-house latest code version.
+ This bug is for ice-house latest code version.
  
  The resize action in vmware environment always failed.
  
  The reason is that nova resized the ****-orign rather than the new
  cloned vm.
  
  It is caused by the outdated vm_ref in _VM_REFS_CACHE.
  
  In nova/virt/vmwareapi/vmops.py:
  
  def finish_migration(self, context, migration, instance, disk_info,
-                          network_info, image_meta, resize_instance=False,
-                          block_device_info=None, power_on=True):
-         """Completes a resize, turning on the migrated instance."""
-         if resize_instance:
-             client_factory = self._session._get_vim().client.factory
-             vm_ref = vm_util.get_vm_ref(self._session, instance)
-             vm_resize_spec = vm_util.get_vm_resize_spec(client_factory,
-                                                         instance)
-             reconfig_task = self._session._call_method(
-                                             self._session._get_vim(),
-                                             "ReconfigVM_Task", vm_ref,
-                                             spec=vm_resize_spec)
-            .......
+                          network_info, image_meta, resize_instance=False,
+                          block_device_info=None, power_on=True):
+         """Completes a resize, turning on the migrated instance."""
+         if resize_instance:
+             client_factory = self._session._get_vim().client.factory
+             vm_ref = vm_util.get_vm_ref(self._session, instance)
+             vm_resize_spec = vm_util.get_vm_resize_spec(client_factory,
+                                                         instance)
+             reconfig_task = self._session._call_method(
+                                             self._session._get_vim(),
+                                             "ReconfigVM_Task", vm_ref,
+                                             spec=vm_resize_spec)
+            .......
  
  From this code, we can see we get vm_ref by vm_util.get_vm_ref.
  
  In nova/virt/vmwareapi/vm_util.py
  
  @vm_ref_cache_from_instance
  def get_vm_ref(session, instance):
-     """Get reference to the VM through uuid or vm name."""
-     uuid = instance['uuid']
-     vm_ref = (_get_vm_ref_from_vm_uuid(session, uuid) or
-                   _get_vm_ref_from_extraconfig(session, uuid) or
-                   _get_vm_ref_from_uuid(session, uuid) or
-                   _get_vm_ref_from_name(session, instance['name']))
-     if vm_ref is None:
-         raise exception.InstanceNotFound(instance_id=uuid)
-     return vm_ref
+     """Get reference to the VM through uuid or vm name."""
+     uuid = instance['uuid']
+     vm_ref = (_get_vm_ref_from_vm_uuid(session, uuid) or
+                   _get_vm_ref_from_extraconfig(session, uuid) or
+                   _get_vm_ref_from_uuid(session, uuid) or
+                   _get_vm_ref_from_name(session, instance['name']))
+     if vm_ref is None:
+         raise exception.InstanceNotFound(instance_id=uuid)
+     return vm_ref
  
- The "get_vm_ref" method is decorated by "vm_ref_cache_from_instance". 
+ The "get_vm_ref" method is decorated by "vm_ref_cache_from_instance".
  "vm_ref_cache_from_instance" will firstly check cache variable _VM_REFS_CACHE. But _VM_REFS_CACHE contains a outdated vm_ref keyed by our instance_uuid, because the virtual machine's name is changed.

** Description changed:

  This bug is for ice-house latest code version.
  
- The resize action in vmware environment always failed.
+ The resize action in vmware environment always fails.
  
  The reason is that nova resized the ****-orign rather than the new
  cloned vm.
  
  It is caused by the outdated vm_ref in _VM_REFS_CACHE.
  
  In nova/virt/vmwareapi/vmops.py:
  
  def finish_migration(self, context, migration, instance, disk_info,
                           network_info, image_meta, resize_instance=False,
                           block_device_info=None, power_on=True):
          """Completes a resize, turning on the migrated instance."""
          if resize_instance:
              client_factory = self._session._get_vim().client.factory
              vm_ref = vm_util.get_vm_ref(self._session, instance)
              vm_resize_spec = vm_util.get_vm_resize_spec(client_factory,
                                                          instance)
              reconfig_task = self._session._call_method(
                                              self._session._get_vim(),
                                              "ReconfigVM_Task", vm_ref,
                                              spec=vm_resize_spec)
             .......
  
  From this code, we can see we get vm_ref by vm_util.get_vm_ref.
  
  In nova/virt/vmwareapi/vm_util.py
  
  @vm_ref_cache_from_instance
  def get_vm_ref(session, instance):
      """Get reference to the VM through uuid or vm name."""
      uuid = instance['uuid']
      vm_ref = (_get_vm_ref_from_vm_uuid(session, uuid) or
                    _get_vm_ref_from_extraconfig(session, uuid) or
                    _get_vm_ref_from_uuid(session, uuid) or
                    _get_vm_ref_from_name(session, instance['name']))
      if vm_ref is None:
          raise exception.InstanceNotFound(instance_id=uuid)
      return vm_ref
  
  The "get_vm_ref" method is decorated by "vm_ref_cache_from_instance".
  "vm_ref_cache_from_instance" will firstly check cache variable _VM_REFS_CACHE. But _VM_REFS_CACHE contains a outdated vm_ref keyed by our instance_uuid, because the virtual machine's name is changed.

-- 
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/1290807

Title:
  Resize on vCenter failed becausee of _VM_REFS_CACHE

Status in OpenStack Compute (Nova):
  New

Bug description:
  This bug is for ice-house latest code version.

  The resize action in vmware environment always fails.

  The reason is that nova resized the ****-orign rather than the new
  cloned vm.

  It is caused by the outdated vm_ref in _VM_REFS_CACHE.

  In nova/virt/vmwareapi/vmops.py:

  def finish_migration(self, context, migration, instance, disk_info,
                           network_info, image_meta, resize_instance=False,
                           block_device_info=None, power_on=True):
          """Completes a resize, turning on the migrated instance."""
          if resize_instance:
              client_factory = self._session._get_vim().client.factory
              vm_ref = vm_util.get_vm_ref(self._session, instance)
              vm_resize_spec = vm_util.get_vm_resize_spec(client_factory,
                                                          instance)
              reconfig_task = self._session._call_method(
                                              self._session._get_vim(),
                                              "ReconfigVM_Task", vm_ref,
                                              spec=vm_resize_spec)
             .......

  From this code, we can see we get vm_ref by vm_util.get_vm_ref.

  In nova/virt/vmwareapi/vm_util.py

  @vm_ref_cache_from_instance
  def get_vm_ref(session, instance):
      """Get reference to the VM through uuid or vm name."""
      uuid = instance['uuid']
      vm_ref = (_get_vm_ref_from_vm_uuid(session, uuid) or
                    _get_vm_ref_from_extraconfig(session, uuid) or
                    _get_vm_ref_from_uuid(session, uuid) or
                    _get_vm_ref_from_name(session, instance['name']))
      if vm_ref is None:
          raise exception.InstanceNotFound(instance_id=uuid)
      return vm_ref

  The "get_vm_ref" method is decorated by "vm_ref_cache_from_instance".
  "vm_ref_cache_from_instance" will firstly check cache variable _VM_REFS_CACHE. But _VM_REFS_CACHE contains a outdated vm_ref keyed by our instance_uuid, because the virtual machine's name is changed.

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


Follow ups

References