← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1209288] Re: No need to construct instance type when resize VM

 

*** This bug is a duplicate of bug 1219761 ***
    https://bugs.launchpad.net/bugs/1219761

** This bug has been marked a duplicate of bug 1219761
   The instanceType of the requestSpec is set to be the current instanceType of the instance instead of the one that is going to resize to

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

Title:
  No need to construct instance type when resize VM

Status in OpenStack Compute (Nova):
  In Progress

Bug description:
  Now, when resize a VM, the instance_type in request_spec is still old
  flavor, this might cause some problem if scheduler want to get new
  instance type from request_spec.

  def migrate_server(self, context, instance, scheduler_hint, live, rebuild,
              flavor, block_migration, disk_over_commit, reservations=None):
          if live and not rebuild and not flavor:
              destination = scheduler_hint.get("host")
              self.scheduler_rpcapi.live_migration(context, block_migration,
                      disk_over_commit, instance, destination)
          elif not live and not rebuild and flavor:
              image_ref = instance.get('image_ref')
              if image_ref:
                  image = self._get_image(context, image_ref)
              else:
                  image = {}
              request_spec = scheduler_utils.build_request_spec(  <<<<<<<<<<<
                  context, image, [instance])
              # NOTE(timello): originally, instance_type in request_spec
              # on compute.api.resize does not have 'extra_specs', so we
              # remove it for now to keep tests backward compatibility.
              request_spec['instance_type'].pop('extra_specs')


  def build_request_spec(ctxt, image, instances):
      """Build a request_spec for the scheduler.

      The request_spec assumes that all instances to be scheduled are the same
      type.
      """
      instance = instances[0]
      instance_type = flavors.extract_flavor(instance) <<<<<<<<<<<<<<<<<
      # NOTE(comstud): This is a bit ugly, but will get cleaned up when
      # we're passing an InstanceType internal object.
      extra_specs = db.flavor_extra_specs_get(ctxt,

  def extract_flavor(instance, prefix=''):
      """Create an InstanceType-like object from instance's system_metadata
      information.
      """

      instance_type = {}
      sys_meta = utils.instance_sys_meta(instance)
      for key, type_fn in system_metadata_flavor_props.items():
          type_key = '%sinstance_type_%s' % (prefix, key)
          instance_type[key] = type_fn(sys_meta[type_key])
      return instance_type << It is still the old instance type

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