← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1462239] Re: libvirt: thrown NotImplementedError when running "nova root-password"

 

@javeme (javaloveme):

Thanks for reporting this issue. There is a blueprint which intents 
to implement that [1]. To avoid redundant work on the same task I'll
close this issue. Feel free to offer the assignee of the blueprint your
assistance. 

[1] https://blueprints.launchpad.net/nova/+spec/libvirt-set-admin-
password

** Changed in: nova
       Status: In Progress => Invalid

** Changed in: nova
     Assignee: javeme (javaloveme) => (unassigned)

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

Title:
  libvirt: thrown NotImplementedError when running "nova root-password"

Status in OpenStack Compute (Nova):
  Invalid

Bug description:
  libvirt: thrown NotImplementedError when running "nova root-password"

  As we all know, the command “nova root-password” is used to change the root password for a server,
  but libvirt driver does not support this feature at present.

  The following is the description of the error:

  1. run "nova root-password" on controler.

  2. returning 501 error. nova-api log:

  2015-06-05 14:34:11.588 3993 INFO nova.api.openstack.wsgi [req-0dc1e6b2-e700-4dfb-a388-c3ddbc0db7e3 None] HTTP exception thrown: Unable to set password on instance
  2015-06-05 14:34:11.589 3993 DEBUG nova.api.openstack.wsgi [req-0dc1e6b2-e700-4dfb-a388-c3ddbc0db7e3 None] Returning 501 to user: Unable to set password on instance _call_ /usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py:1217
  2015-06-05 14:34:11.591 3993 INFO nova.osapi_compute.wsgi.server [req-0dc1e6b2-e700-4dfb-a388-c3ddbc0db7e3 None] 172.40.0.2 "POST /v
  2/8e3d0869585d486daf23865ebc85449b/servers/12d57f28-8d00-47d3-876c-ebdba7145ddf/action HTTP/1.1" status: 501 len: 282 time: 3.0169549

  3. thrown NotImplementedError. nova-compute log:

  2015-06-05 14:34:10.654 13446 WARNING nova.compute.manager [req-0dc1e6b2-e700-4dfb-a388-c3ddbc0db7e3 None] [instance: 12d57f28-8d00-
  47d3-876c-ebdba7145ddf] set_admin_password is not implemented by this driver or guest instance.
  2015-06-05 14:34:11.532 13446 ERROR oslo.messaging.rpc.dispatcher [req-0dc1e6b2-e700-4dfb-a388-c3ddbc0db7e3 ] Exception during messa
  ge handling: set_admin_password is not implemented by this driver or guest instance.
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher Traceback (most recent call last):
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/oslo/messaging/rpc/dispat
  cher.py", line 133, in _dispatch_and_reply
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher incoming.message))
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/oslo/messaging/rpc/dispat
  cher.py", line 176, in _dispatch
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher return self._do_dispatch(endpoint, method, ctxt, args)
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/oslo/messaging/rpc/dispat
  cher.py", line 122, in _do_dispatch
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher result = getattr(endpoint, method)(ctxt, **new_args)
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py",
  line 403, in decorated_function
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/exception.py", line
  88, in wrapped
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher payload)
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/openstack/common/exc
  utils.py", line 68, in _exit_
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/exception.py", line
  71, in wrapped
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher return f(self, context, *args, **kw)
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py",
  line 284, in decorated_function
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/openstack/common/exc
  utils.py", line 68, in _exit_
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py",
  line 270, in decorated_function
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py",
  line 337, in decorated_function
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py",
  line 313, in decorated_function
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/openstack/common/exc
  utils.py", line 68, in _exit_
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py",
  line 300, in decorated_function
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py",
  line 2919, in set_admin_password
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher NotImplementedError: set_admin_password is not implemented by this
  driver or guest instance.
  2015-06-05 14:34:11.532 13446 TRACE oslo.messaging.rpc.dispatcher
  2015-06-05 14:34:11.579 13446 ERROR oslo.messaging._drivers.common [req-0dc1e6b2-e700-4dfb-a388-c3ddbc0db7e3 ] Returning exception s
  et_admin_password is not implemented by this driver or guest instance. to caller
  2015-06-05 14:34:11.579 13446 ERROR oslo.messaging._drivers.common [req-0dc1e6b2-e700-4dfb-a388-c3ddbc0db7e3 ] ['Traceback (most rec
  ent call last):\n', ' File "/usr/lib/python2.6/site-packages/oslo/messaging/rpc/dispatcher.py", line 133, in _dispatch_and_reply\n
  incoming.message))\n', ' File "/usr/lib/python2.6/site-packages/oslo/messaging/rpc/dispatcher.py", line 176, in _dispatch\n r
  eturn self._do_dispatch(endpoint, method, ctxt, args)\n', ' File "/usr/lib/python2.6/site-packages/oslo/messaging/rpc/dispatcher.py
  ", line 122, in _do_dispatch\n result = getattr(endpoint, method)(ctxt, **new_args)\n', ' File "/usr/lib/python2.6/site-packages
  /nova/compute/manager.py", line 403, in decorated_function\n', ' File "/usr/lib/python2.6/site-packages/nova/exception.py", line 88
  , in wrapped\n payload)\n', ' File "/usr/lib/python2.6/site-packages/nova/openstack/common/excutils.py", line 68, in _exit_\n
  six.reraise(self.type_, self.value, self.tb)\n', ' File "/usr/lib/python2.6/site-packages/nova/exception.py", line 71, in wrappe
  d\n return f(self, context, *args, **kw)\n', ' File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 284, in dec
  orated_function\n', ' File "/usr/lib/python2.6/site-packages/nova/openstack/common/excutils.py", line 68, in _exit_\n six.rera
  ise(self.type_, self.value, self.tb)\n', ' File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 270, in decorated_
  function\n', ' File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 337, in decorated_function\n', ' File "/usr/l
  ib/python2.6/site-packages/nova/compute/manager.py", line 313, in decorated_function\n', ' File "/usr/lib/python2.6/site-packages/n
  ova/openstack/common/excutils.py", line 68, in _exit\n six.reraise(self.type, self.value, self.tb)\n', ' File "/usr/lib/pyth
  on2.6/site-packages/nova/compute/manager.py", line 300, in decorated_function\n', ' File "/usr/lib/python2.6/site-packages/nova/com
  pute/manager.py", line 2919, in set_admin_password\n', 'NotImplementedError: set_admin_password is not implemented by this driver or
  guest instance.\n']

  4.Here is the code.
     nova/compute/manager.py   ComputeManager.set_admin_password()

      def set_admin_password(self, context, instance, new_pass):
          """Set the root/admin password for an instance on this host.

          This is generally only called by API password resets after an
          image has been built.

          @param context: Nova auth context.
          @param instance: Nova instance object.
          @param new_pass: The admin password for the instance.
          """

          context = context.elevated()
          if new_pass is None:
              # Generate a random password
              new_pass = utils.generate_password()

          current_power_state = self._get_power_state(context, instance)
          expected_state = power_state.RUNNING

          if current_power_state != expected_state:
              instance.task_state = None
              instance.save(expected_task_state=task_states.UPDATING_PASSWORD)
              _msg = _('instance %s is not running') % instance.uuid
              raise exception.InstancePasswordSetFailed(
                  instance=instance.uuid, reason=_msg)

          try:
              self.driver.set_admin_password(instance, new_pass)
              LOG.info(_LI("Root password set"), instance=instance)
              instance.task_state = None
              instance.save(
                  expected_task_state=task_states.UPDATING_PASSWORD)
          except NotImplementedError:
              LOG.warning(_LW('set_admin_password is not implemented '
                              'by this driver or guest instance.'),
                          instance=instance)
              instance.task_state = None
              instance.save(
                  expected_task_state=task_states.UPDATING_PASSWORD)
              raise NotImplementedError(_('set_admin_password is not '
                                          'implemented by this driver or guest '
                                          'instance.'))
          except exception.UnexpectedTaskStateError:
              # interrupted by another (most likely delete) task
              # do not retry
              raise
          except Exception:
              # Catch all here because this could be anything.
              LOG.exception(_LE('set_admin_password failed'),
                            instance=instance)
              self._set_instance_obj_error_state(context, instance)
              # We create a new exception here so that we won't
              # potentially reveal password information to the
              # API caller.  The real exception is logged above
              _msg = _('error setting admin password')
              raise exception.InstancePasswordSetFailed(
                  instance=instance.uuid, reason=_msg)

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


References