← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1290807] Re: Resize on vCenter failed becausee of _VM_REFS_CACHE

 

** Also affects: nova/icehouse
   Importance: High
     Assignee: Feng Xi Yan (yanfengxi)
       Status: In Progress

-- 
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):
  In Progress
Status in OpenStack Compute (nova) icehouse series:
  In Progress
Status in The OpenStack VMwareAPI subTeam:
  In Progress

Bug description:
  This bug is for nova/master branch.

  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(The original one) 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


References