virtual interface create error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Low
|
Unassigned |
Bug Description
I saw instance creation failed when nova-network attempted create duplicated MAC address for vif.
In nova code, there are exception code exists but It looks doesn't catch exception Integrity error.
This is my test code.
#!/usr/bin/python
from nova import utils
from nova import flags
import nova.context
import sys
from nova import db
def main(sys):
context = nova.context.
vif = {'address': '02:16:
db.
if __name__ == '__main__':
utils.
FLAGS = flags.FLAGS(
'02:16:3e:63:c9:39' is already exists db table. So I expected exception.
@require_context
def virtual_
"""Create a new virtual interface record in teh database.
:param values: = dict containing column values
"""
try:
vif_ref = models.
except IntegrityError:
raise exception.
return vif_ref
But next error is occured when I tested.
Traceback (most recent call last):
File "./test_
main(sys)
File "./test_
db.
File "/usr/local/
return IMPL.virtual_
File "/usr/local/
return f(*args, **kwargs)
File "/usr/local/
vif_ref.save()
File "/usr/local/
session.flush()
File "/usr/local/
raise DBError(e)
nova.exception.
For this reason, When VIF's mac address is duplicated, maybe instance creation is failed.
When Instance is created, below code is executed.
nova/network/
def add_virtual_
vif = {'address': utils.generate_
# try FLAG times to create a vif record with a unique mac_address
for i in xrange(
try:
except exception.
else:
raise exception.
security vulnerability: | no → yes |
security vulnerability: | yes → no |
Changed in nova: | |
assignee: | nobody → Jay Lee (hyangii) |
status: | New → Confirmed |
Changed in nova: | |
status: | Confirmed → New |
Changed in nova: | |
assignee: | nobody → Boris Pavlovic (boris-42) |
When I modify exception.py, exception. VirtualInterfac eMacAddressExce ption() is occured.
From: arameter( )
LOG. exception( _('DB exception wrapped.'))
def wrap_db_error(f):
def _wrap(*args, **kwargs):
try:
return f(*args, **kwargs)
except UnicodeEncodeError:
raise InvalidUnicodeP
except Exception, e:
raise DBError(e)
_wrap.func_name = f.func_name
return _wrap
To: arameter( )
LOG. exception( _('DB exception wrapped.'))
def wrap_db_error(f):
def _wrap(*args, **kwargs):
try:
return f(*args, **kwargs)
except UnicodeEncodeError:
raise InvalidUnicodeP
except Exception, e:
raise e
_wrap.func_name = f.func_name
return _wrap
This is error trace when changed code. create_ vif.sh" , line 23, in <module> create_ vif.sh" , line 17, in main virtual_ interface_ create( context, vif) lib/python2. 7/dist- packages/ nova-2012. 1-py2.7. egg/nova/ db/api. py", line 448, in virtual_ interface_ create interface_ create( context, values) lib/python2. 7/dist- packages/ nova-2012. 1-py2.7. egg/nova/ db/sqlalchemy/ api.py" , line 120, in wrapper lib/python2. 7/dist- packages/ nova-2012. 1-py2.7. egg/nova/ db/sqlalchemy/ api.py" , line 1004, in virtual_ interface_ create VirtualInterfac eCreateExceptio n() VirtualInterfac eCreateExceptio n: Virtual Interface creation failed
Traceback (most recent call last):
File "./test_
main(sys)
File "./test_
db.
File "/usr/local/
return IMPL.virtual_
File "/usr/local/
return f(*args, **kwargs)
File "/usr/local/
raise exception.
nova.exception.