Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 948938

Summary: 'nova network-create' command fails.
Product: Red Hat OpenStack Reporter: Jakub Ruzicka <jruzicka>
Component: openstack-novaAssignee: Nikola Dipanov <ndipanov>
Status: CLOSED ERRATA QA Contact: Ofer Blaut <oblaut>
Severity: high Docs Contact:
Priority: high    
Version: 2.1CC: beagles, cpelland, eglynn, jhenner, ndipanov, ykaul
Target Milestone: async   
Target Release: 2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-nova-2012.2.4-1.el6ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-09 13:54:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 923918, 950133    

Description Jakub Ruzicka 2013-04-05 14:36:29 UTC
Description of problem:
Sending network-create command added to novaclient by bug #923918 results in failure.

$ nova network-create --fixed-range-v4 10.0.0.0/8 test_network

ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-e2349f75-0c26-4ee0-af54-0833d5ff3f03)

2013-03-26 14:50:38 25165 ERROR nova.openstack.common.rpc.common [-] Returning exception Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/qpid/messaging/driver.py", line 511, in dispatch
    self.engine.dispatch()
  File "/usr/lib/python2.6/site-packages/qpid/messaging/driver.py", line 815, in dispatch
    self.process(ssn)
  File "/usr/lib/python2.6/site-packages/qpid/messaging/driver.py", line 1050, in process
    self.send(snd, msg)
  File "/usr/lib/python2.6/site-packages/qpid/messaging/driver.py", line 1261, in send
    body = enc(msg.content)
  File "/usr/lib/python2.6/site-packages/qpid/messaging/message.py", line 28, in encode
    sc.write_primitive(type, x)
  File "/usr/lib/python2.6/site-packages/qpid/codec010.py", line 73, in write_primitive
    getattr(self, "write_%s" % type.NAME)(v)
  File "/usr/lib/python2.6/site-packages/qpid/codec010.py", line 257, in write_map
    sc.write(string.joinfields(map(self._write_map_elem, m.keys(), m.values()), ""))
  File "/usr/lib/python2.6/site-packages/qpid/codec010.py", line 250, in _write_map_elem
    sc.write_primitive(type, v)
  File "/usr/lib/python2.6/site-packages/qpid/codec010.py", line 73, in write_primitive
    getattr(self, "write_%s" % type.NAME)(v)
  File "/usr/lib/python2.6/site-packages/qpid/codec010.py", line 300, in write_list
    type = self.encoding(o)
  File "/usr/lib/python2.6/site-packages/qpid/codec010.py", line 59, in encoding
    raise CodecException("no encoding for %r" % obj)
CodecException: no encoding for <nova.db.sqlalchemy.models.Network object at 0x3590450>
 to caller

What is worse, something seems to be inserted into the DB as on subsequent identical call, 500 is returned with different error:

  File "/usr/lib/python2.6/site-packages/nova/network/manager.py", line 1570, in _do_create_networks
    raise ValueError(_('cidr already in use'))
ValueError: cidr already in use


Version-Release number of selected component (if applicable):
2012.2.3-7.el6ost

How reproducible:
You need python-novaclient with https://code.engineering.redhat.com/gerrit/4819

I've tested on RHEL 6.4 installing with packstack from latest openstack puddle.

Steps to Reproduce:
1. nova network-create --fixed-range-v4 10.0.0.0/8 test_network
2. nova network-create --fixed-range-v4 10.0.0.0/8 test_network
  
Actual results:
 * 1. will produce CodeError as described above
 * same subsequent calls (2.) will produce ValueError as described above

Expected results:
 * Create the specified network.
 * On failure, don't leave anything in database.

Comment 1 Nikola Dipanov 2013-04-05 15:52:07 UTC
Fix proposed to the upstream stable branch: https://review.openstack.org/#/c/26225/

Comment 5 Ofer Blaut 2013-04-28 13:59:31 UTC
Tested 

root@puma34 ~(keystone_admin)]$ nova network-create net1 --fixed-range-v4 22.22.22.0/24

[root@puma34 ~(keystone_admin)]$ nova network-list
+--------------------------------------+-------------+-----------------+
| ID                                   | Label       | Cidr            |
+--------------------------------------+-------------+-----------------+
| ba220cbf-b6c1-41f2-9cc2-14ac28713a25 | net1        | 22.22.22.0/24   |
| f2310fb2-c590-4ffb-a702-5b8b32edd87e | novanetwork | 192.168.32.0/22 |
+--------------------------------------+-------------+-----------------+

openstack-nova-network-2012.2.4-2.el6ost.noarch

Comment 6 errata-xmlrpc 2013-05-09 13:54:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0798.html