← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1413119] Re: Pre-migration memory check- Invalid error message if memory value is 0

 

Agreed that the instance  might have gone to ERROR state. Or it seemed to be toggling between ERROR and ACTIVE state (see log below)
But in any case, if this code method is being hit in case memory_mb being zero, then I reckon a minor change should be implemented to handle it.

Please move the bug back to working state.

Log: 
2014-10-06 17:19:07.936 3882 WARNING NV-43FB562 Failed to compute_task_migrate_server: NV-78D5611 Migration pre-check error: NV-37B7976 Unable to migrate 352122ae-1ca1-43b3-8ba6-709d93fd580c to 9117MMB_100DBCP: Lack of memory(host:65536 <= instance:0)
2014-10-06 17:19:07.938 3882 WARNING NV-EAF7DD6 Setting instance to ACTIVE state.


** Changed in: nova
       Status: Invalid => New

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

Title:
  Pre-migration memory check-  Invalid error message if memory value is
  0

Status in OpenStack Compute (Nova):
  New

Bug description:
  There is possible correction in the logic and error handling in the pre-migration memory check in case when the memory value is zero '0'.
  This check is present in the source code class: nova/conductor/tasks/live_migrate.py

  
  Below is the current code snippet:
          if not mem_inst or avail <= mem_inst:
              instance_uuid = self.instance.uuid
              dest = self.destination
              reason = _("Unable to migrate %(instance_uuid)s to %(dest)s: "
                         "Lack of memory(host:%(avail)s <= "
                         "instance:%(mem_inst)s)")
              raise exception.MigrationPreCheckError(reason=reason % dict(
                      instance_uuid=instance_uuid, dest=dest, avail=avail,
                      mem_inst=mem_inst))
  					
  It can be seen that when mem_inst value is 0, the if condition is met and control enters the block resulting in 'lack of memory' error with a message 'avail memory < 0'. This is absurd.

  Sample error message when memory is zero: 
  2014-10-13 19:52:09.441 3907 INFO nova.api.openstack.wsgi [req-8430dd30-4f17-4094-bbec-ec9cf3593c79 502 eec6e74886804b79b78ac4fceed5b685] NV-4EB7C79 HTTP exception thrown: 
  NV-78D5611 Migration pre-check error: NV-37B7976 Unable to migrate 352122ae-1ca1-43b3-8ba6-709d93fd580c to 9117MMB_100DBCP: Lack of memory(host:65536 <= instance:0)

  The trailing end part of the error doesn't make much sense (host:65536
  <= instance:0).

  Possible correction:
  The check should handle the special case of zero memory value in a different way. If memory equals zero, then a different error of exception should be raised about invalid memory.

  Sample fix:
  if mem_inst <= 0:
     reason = _("Unable to migrate %(instance_uuid)s to %(dest)s: "
                "Invalid value for existing instance memory: %(mem_inst)s.")
     raise exception.MigrationPreCheckError(reason=reason % dict(
                 instance_uuid=instance_uuid, dest=dest, mem_inst=mem_inst))
  elif avail <= mem_inst: 
     reason = _("Unable to migrate %(instance_uuid)s to %(dest)s: "
                "Lack of memory available at destination.  (host:%(avail)s <= "
                "instance:%(mem_inst)s.")
     raise exception.MigrationPreCheckError(reason=reason % dict(
                 instance_uuid=instance_uuid, dest=dest, avail=avail, mem_inst=mem_inst))

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


References