Reviewed:  https://review.opendev.org/c/openstack/nova/+/861738
Committed: 
https://opendev.org/openstack/nova/commit/ec40d5aee34e9428e2a19231fc3df4d23d75b779
Submitter: "Zuul (22348)"
Branch:    master

commit ec40d5aee34e9428e2a19231fc3df4d23d75b779
Author: Rajesh Tailor <[email protected]>
Date:   Tue Oct 11 18:01:17 2022 +0530

    Handle InstanceInvalidState exception
    
    When instance task state is 'deleting' or 'migrating', then
    get_vnc_console throws 500 error, as InstanceInvalidState
    exception is not handled there.
    
    This change handles InstanceInvalidState in api layer in
    get_vnc_console call.
    
    Closes-Bug: #1968618
    Change-Id: Ia738a0972b050f549f446c85171d3f33e60ada4f


** Changed in: nova
       Status: In Progress => Fix Released

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

Title:
  get-vnc-console returns 500 if instance in invalid task_state

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  Description
  ===========
  Nova returns 500 when you create console for instance which is in transition 
state like deleting or migrating.

  
  Steps to reproduce
  ==================
  1. Instance in task_state deleting or migrating

  mysql> select task_state from instances where 
uuid='35a5c36e-5464-4747-97a8-c160da093101';
  +------------+
  | task_state |
  +------------+
  | migrating  |
  +------------+

  2. Try to get console

  # openstack console url show --novnc 35a5c36e-5464-4747-97a8-c160da093101
  Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ 
and attach the Nova API log if possible.
  <class 'nova.exception.InstanceInvalidState'> (HTTP 500) (Request-ID: 
req-8dd68e78-1956-4e0c-90ee-d2a5e1be54bf)

  Same error with "nova get-vnc-console"

  
  Expected result
  ===============
  Nova usually returns HTTP 409 when catches InstanceInvalidState.

  
  Environment
  ===========
  Currently seeing in Stein. But it seems nova doesn't catch this exception in 
other versions.

  
  Logs & Configs
  ==============
  2022-04-11 18:59:24,404.404 11 ERROR nova.api.openstack.wsgi 
[req-f057dae1-9a9a-4db5-8faf-db655b904a0e b6ba9c75146a49829a7427a3e8cc3c10 
192796e61c174f718d6147b129f3f2ff] Unexpected exception in API method: 
nova.exception.InstanceInvalidState: Instance 
35a5c36e-5464-4747-97a8-c160da093101 in task_state migrating. Cannot 
get_vnc_console while the instance is in this state.
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi Traceback (most 
recent call last):
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi   File 
"/var/lib/openstack/lib/python3.6/site-packages/nova/api/openstack/wsgi.py", 
line 671, in wrapped
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi     return 
f(*args, **kwargs)
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi   File 
"/var/lib/openstack/lib/python3.6/site-packages/nova/api/validation/__init__.py",
 line 110, in wrapper
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi     return 
func(*args, **kwargs)
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi   File 
"/var/lib/openstack/lib/python3.6/site-packages/nova/api/validation/__init__.py",
 line 110, in wrapper
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi     return 
func(*args, **kwargs)
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi   File 
"/var/lib/openstack/lib/python3.6/site-packages/nova/api/openstack/compute/remote_consoles.py",
 line 168, in create
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi     output = 
handler(context, instance, console_type)
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi   File 
"/var/lib/openstack/lib/python3.6/site-packages/nova/compute/api.py", line 199, 
in wrapped
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi     return 
function(self, context, instance, *args, **kwargs)
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi   File 
"/var/lib/openstack/lib/python3.6/site-packages/nova/compute/api.py", line 187, 
in inner
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi     
attr='task_state', state=instance.task_state)
  2022-04-11 18:59:24,404.404 11 TRACE nova.api.openstack.wsgi 
nova.exception.InstanceInvalidState: Instance 
35a5c36e-5464-4747-97a8-c160da093101 in task_state migrating. Cannot 
get_vnc_console while the instance is in this state.

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


-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to