← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1437111] Re: os-migrateLive fault but rest api raise a incorrect conflict message

 

** Changed in: nova
       Status: Fix Committed => Fix Released

** Changed in: nova
    Milestone: None => kilo-rc1

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

Title:
  os-migrateLive fault but rest api raise a incorrect conflict message

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  when do a live migration which the instance is in a state like this
  taget@liyong:~/devstack$ nova list
  +--------------------------------------+-------+--------+------------+-------------+----------------------+
  | ID                                   | Name  | Status | Task State | Power State | Networks             |
  +--------------------------------------+-------+--------+------------+-------------+----------------------+
  | 1d114104-9a62-49ba-b209-6a42beff4133 | test1 | ACTIVE | -          | NOSTATE     | private_net=10.0.0.9 |
  +--------------------------------------+-------+--------+------------+-------------+----------------------+

  rest api raise conflictRequest, this is correct, but the message is
  not correct.

  (0, '{"conflictingRequest": {"message": "Instance
  1d114104-9a62-49ba-b209-6a42beff4133 is in an invalid state for \'os-
  migrateLive\'", "code": 409}}', '  % Total    % Received % Xferd
  Average Speed   Time    Time     Time  Current\n
  Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0
  0     0      0      0 --:--:-- --:--:-- --:--:--     0\r100    92    0
  0  100    92      0     76  0:00:01  0:00:01 --:--:--    76\r100   233
  100   141  100    92     78     51  0:00:01  0:00:01 --:--:--
  78\r100   233  100   141  100    92     78     51  0:00:01  0:00:01
  --:--:--    78\n')

  
  in live_migrate.py, we check if instance in active state, it do the right thing.

      def _check_instance_is_active(self):
          if self.instance.power_state not in (power_state.RUNNING,
                                               power_state.PAUSED):
              raise exception.InstanceInvalidState(
                      instance_uuid = self.instance.uuid,
                      attr = 'power_state',
                      state = self.instance.power_state,
                      method = 'live migrate')

  but in this case,  power_state is an Integer zero, 
  the logic in raise_http_conflict_for_instance_invalid_state

  by checking code of raise_http_conflict_for_instance_invalid_state

  def raise_http_conflict_for_instance_invalid_state(exc, action, server_id):
      """Raises a webob.exc.HTTPConflict instance containing a message
      appropriate to return via the API based on the original
      InstanceInvalidState exception.
      """
      attr = exc.kwargs.get('attr')
      state = exc.kwargs.get('state')
      not_launched = exc.kwargs.get('not_launched')
      if attr and state: <<<<<<<<<<<<<------------ should go this condition but state is zero.
          msg = _("Cannot '%(action)s' instance %(server_id)s while it is in "
                  "%(attr)s %(state)s") % {'action': action, 'attr': attr,
                                           'state': state,
                                           'server_id': server_id}

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


References