should handle exception of createing nova server

Bug #1649804 reported by RUIJIE YUAN
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
senlin
Fix Released
High
RUIJIE YUAN

Bug Description

Here is the code:
https://review.openstack.org/gitweb?p=openstack/senlin.git;a=blob;f=senlin/profiles/os/nova/server.py;h=0d832f86812747e941894b9640620ea7eb8cfd7a;hb=1fa30998a9a6185bc5df2bed0ab380cdb5796038#l521

The scenario is:
There is no resource in my local dev-environment, then the creation of nova server failed ...

If there is an exception raised when creating nova server, the parameter 'server' would be
not referenced.

2016-12-14 16:31:19.001 ERROR senlin.engine.actions.base [req-15f18778-99e9-4741-8a79-5ba1d82d2d40 None None] Unexpected exception occurred during action NODE_CREATE (5c15d984-8003-4291-8f89-bb5b0177d490) execution: local variable 'server' referenced before assignment
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base Traceback (most recent call last):
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base File "/opt/stack/senlin/senlin/engine/actions/base.py", line 506, in ActionProc
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base result, reason = action.execute()
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base File "/opt/stack/senlin/senlin/engine/actions/node_action.py", line 241, in execute
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base res, reason = self._execute()
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base File "/opt/stack/senlin/senlin/engine/actions/node_action.py", line 207, in _execute
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base return method()
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base File "/usr/local/lib/python2.7/dist-packages/osprofiler/profiler.py", line 154, in wrapper
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base return f(*args, **kwargs)
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base File "/opt/stack/senlin/senlin/engine/actions/node_action.py", line 67, in do_create
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base res = self.entity.do_create(self.context)
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base File "/opt/stack/senlin/senlin/engine/node.py", line 246, in do_create
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base physical_id = pb.Profile.create_object(context, self)
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base File "/usr/local/lib/python2.7/dist-packages/osprofiler/profiler.py", line 154, in wrapper
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base return f(*args, **kwargs)
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base File "/opt/stack/senlin/senlin/profiles/base.py", line 232, in create_object
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base return profile.do_create(obj)
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base File "/opt/stack/senlin/senlin/profiles/os/nova/server.py", line 521, in do_create
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base if server and server.id:
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base UnboundLocalError: local variable 'server' referenced before assignment
2016-12-14 16:31:19.001 TRACE senlin.engine.actions.base
2016-12-14 16:31:19.029 ERROR senlin.engine.event [req-15f18778-99e9-4741-8a79-5ba1d82d2d40 None None] node-57b32fbf-001 [64a4a0c4] NODE_CREATE - error: local variable 'server' referenced before assignment
2016-12-14 16:31:19.036 ERROR senlin.engine.event [req-15f18778-99e9-4741-8a79-5ba1d82d2d40 None None] node-57b32fbf-003 [09fafc34] NODE_CREATE - error: local variable 'server' referenced before assignment

RUIJIE YUAN (cnjie0616)
description: updated
Changed in senlin:
assignee: nobody → RUIJIE YUAN (cnjie0616)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to senlin (master)

Fix proposed to branch: master
Review: https://review.openstack.org/410644

Changed in senlin:
status: New → In Progress
Revision history for this message
Qiming Teng (tengqim) wrote :

Yes this is possible because the server creation may fail at any time. When the creation has failed, we are not so sure that a Server resource has been created. Adding a test condition is necessary.

Changed in senlin:
status: In Progress → Triaged
importance: Undecided → High
milestone: none → ocata-2
Changed in senlin:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to senlin (master)

Reviewed: https://review.openstack.org/410644
Committed: https://git.openstack.org/cgit/openstack/senlin/commit/?id=5918e4b62143fa4740e5f80959b4f7141c86866a
Submitter: Jenkins
Branch: master

commit 5918e4b62143fa4740e5f80959b4f7141c86866a
Author: RUIJIE YUAN <email address hidden>
Date: Wed Dec 14 17:35:38 2016 +0800

    handle exception when creating nova server.

    this patch revise exception handler in do_create(...) method
    of creating nova server.

    Change-Id: I358cce91454cbaffb95717ac746fd7c73ef449d9
    Closes-Bug:#1649804

Changed in senlin:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/senlin 3.0.0.0b2

This issue was fixed in the openstack/senlin 3.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.