Failure in NetworkTestCase for range_allocation and

Bug #608772 reported by Jay Pipes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Jay Pipes

Bug Description

On trunk, these have been appearing consistently:

===============================================================================
[FAIL]: nova.tests.network_unittest.NetworkTestCase.test_allocate_deallocate_ip

Traceback (most recent call last):
  File "/home/jpipes/repos/nova/working/nova/tests/network_unittest.py", line 79, in test_allocate_deallocate_ip
    self.assertEqual(False, is_in_project(address, "project0"))
twisted.trial.unittest.FailTest: not equal:
a = False
b = True

===============================================================================
[FAIL]: nova.tests.network_unittest.NetworkTestCase.test_range_allocation

Traceback (most recent call last):
  File "/home/jpipes/repos/nova/working/nova/tests/network_unittest.py", line 103, in test_range_allocation
    self.assertEqual(False, is_in_project(address, "project0"))
twisted.trial.unittest.FailTest: not equal:
a = False
b = True

-------------------------------------------------------------------------------
Ran 80 tests in 24.274s

FAILED (failures=2, successes=78)

Assigning to myself...I'll try and track down the fix...

Tags: tests
Revision history for this message
Jay Pipes (jaypipes) wrote :

Hmm, something to do with gflags is broken it seems:

jpipes@serialcoder:~/repos/nova/bug608772$ python run_tests.py nova.tests.network_unittest.NetworkTestCase.test_allocate_deallocate_ip
INFO:root:Flushing redis datastore
nova.tests.network_unittest
  NetworkTestCase
    test_allocate_deallocate_ip ... [FAIL]

===============================================================================
[FAIL]: nova.tests.network_unittest.NetworkTestCase.test_allocate_deallocate_ip

Traceback (most recent call last):
  File "/home/jpipes/repos/nova/bug608772/nova/tests/network_unittest.py", line 79, in test_allocate_deallocate_ip
    self.assertEqual(False, is_in_project(address, "project0"))
twisted.trial.unittest.FailTest: not equal:
a = False
b = True

-------------------------------------------------------------------------------
Ran 1 tests in 0.756s

FAILED (failures=1)

$> cat run_tests.err.log

DEBUG:root:Allocating IP 10.0.0.3 to project0
DEBUG:root:FAKE NET: ifconfig vlan100
DEBUG:root:FAKE NET: ifconfig br100
DEBUG:root:Starting dnsmasq server for network with vlan 100
DEBUG:root:FAKE NET: sudo dnsmasq --strict-order --bind-interfaces --conf-file= --pid-file=/home/jpipes/repos/nova/bug608772/networks/nova-100.pid --listen-address=10.0.0.1 --except-interface=lo --dhcp-range=10.0.0.3,static,600s --dhcp-hostsfile=/home/jpipes/repos/nova/bug608772/networks/nova-100.conf --dhcp-script=/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge --leasefile-ro
DEBUG:root:FAKE NET: sudo iptables --delete FORWARD -d 10.0.0.2 -p udp --dport 1194 -j ACCEPT
DEBUG:root:FAKE NET: sudo iptables -I FORWARD -d 10.0.0.2 -p udp --dport 1194 -j ACCEPT
DEBUG:root:FAKE NET: sudo iptables --delete PREROUTING -t nat -d 127.0.0.1 -p udp --dport 1149 -j DNAT --to 10.0.0.2:1194
DEBUG:root:FAKE NET: sudo iptables -I PREROUTING -t nat -d 127.0.0.1 -p udp --dport 1149 -j DNAT --to 10.0.0.2:1194
DEBUG:root:Was allocated 10.0.0.3
DEBUG:root:Result was 1
DEBUG:root:ISSUE_IP: warning: no vendor libraries included
, Traceback (most recent call last):
  File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 94, in <module>
    sys.exit(main())
  File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 71, in main
    flagfile = os.environ.get('FLAGFILE', FLAGS.dhcpbridge_flagfile)
  File "/usr/lib/python2.6/dist-packages/gflags.py", line 810, in __getattr__
    raise AttributeError(name)
AttributeError: dhcpbridge_flagfile

DEBUG:root:Get Network By Address: 10.0.0.3
DEBUG:root:Found 10.0.0.3 in project0
DEBUG:root:Result was 1
DEBUG:root:RELEASE_IP: warning: no vendor libraries included
, Traceback (most recent call last):
  File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 94, in <module>
    sys.exit(main())
  File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 71, in main
    flagfile = os.environ.get('FLAGFILE', FLAGS.dhcpbridge_flagfile)
  File "/usr/lib/python2.6/dist-packages/gflags.py", line 810, in __getattr__
    raise AttributeError(name)
AttributeError: dhcpbridge_flagfile

I've tried renaming the flagfile variable, moving it to different locations, etc. No luck...

Revision history for this message
Vish Ishaya (vishvananda) wrote : Re: [Bug 608772] Re: Failure in NetworkTestCase for range_allocation and
Download full text (3.2 KiB)

strange. This is working in my clean author branch on Mac. Did I fix it by
accident? Looks like the flag is defined somewhere wrong?

On Jul 22, 2010 11:10 AM, "Jay Pipes" <email address hidden> wrote:

Hmm, something to do with gflags is broken it seems:

jpipes@serialcoder:~/repos/nova/bug608772$ python run_tests.py
nova.tests.network_unittest.NetworkTestCase.test_allocate_deallocate_ip
INFO:root:Flushing redis datastore

nova.tests.network_unittest
NetworkTestCase
   test_allocate_deallocate_ip ...
 [FAIL]

===============================================================================
[FAIL]: nova.tests....
 File "/home/jpipes/repos/nova/bug608772/nova/tests/network_unittest.py",
line 79, in test_allocate_deallocate_ip

self.assertEqual(False, is_in_project(address, "project0"))
twisted.trial.unittest.FailTest: not...
-------------------------------------------------------------------------------
Ran 1 tests in 0.756s

FAILED (failures=1)

$> cat run_tests.err.log

DEBUG:root:Allocating IP 10.0.0.3 to project0
DEBUG:root:FAKE NET: ifconfig vlan100
DEBUG:root:FAKE NET: ifconfig br100
DEBUG:root:Starting dnsmasq server for network with vlan 100
DEBUG:root:FAKE NET: sudo dnsmasq --strict-order --bind-interfaces
--conf-file=
--pid-file=/home/jpipes/repos/nova/bug608772/networks/nova-100.pid
--listen-address=10.0.0.1 --except-interface=lo
--dhcp-range=10.0.0.3,static,600s
--dhcp-hostsfile=/home/jpipes/repos/nova/bug608772/networks/nova-100.conf
--dhcp-script=/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge
--leasefile-ro
DEBUG:root:FAKE NET: sudo iptables --delete FORWARD -d 10.0.0.2 -p udp
--dport 1194 -j ACCEPT
DEBUG:root:FAKE NET: sudo iptables -I FORWARD -d 10.0.0.2 -p udp --dport
1194 -j ACCEPT
DEBUG:root:FAKE NET: sudo iptables --delete PREROUTING -t nat -d 127.0.0.1
-p udp --dport 1149 -j DNAT --to 10.0.0.2:1194
DEBUG:root:FAKE NET: sudo iptables -I PREROUTING -t nat -d 127.0.0.1 -p udp
--dport 1149 -j DNAT --to 10.0.0.2:1194
DEBUG:root:Was allocated 10.0.0.3
DEBUG:root:Result was 1
DEBUG:root:ISSUE_IP: warning: no vendor libraries included
, Traceback (most recent call last):
 File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 94, in
<module>
   sys.exit(main())
 File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 71, in
main
   flagfile = os.environ.get('FLAGFILE', FLAGS.dhcpbridge_flagfile)
 File "/usr/lib/python2.6/dist-packages/gflags.py", line 810, in __getattr__
   raise AttributeError(name)
AttributeError: dhcpbridge_flagfile

DEBUG:root:Get Network By Address: 10.0.0.3
DEBUG:root:Found 10.0.0.3 in project0
DEBUG:root:Result was 1
DEBUG:root:RELEASE_IP: warning: no vendor libraries included
, Traceback (most recent call last):
 File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 94, in
<module>
   sys.exit(main())
 File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 71, in
main
   flagfile = os.environ.get('FLAGFILE', FLAGS.dhcpbridge_flagfile)
 File "/usr/lib/python2.6/dist-packages/gflags.py", line 810, in __getattr__
   raise AttributeError(name)
AttributeError: dhcpbridge_flagfile

I've tried renaming the flagfile variable, moving it to different
locati...

Read more...

Revision history for this message
Jay Pipes (jaypipes) wrote :

If I call default_flagfile() with no params (use defaults), I still get some weird name resolution errors:

DEBUG:root:ISSUE_IP: warning: no vendor libraries included
, DEBUG:root:Called add for mac 02:16:3e:0e:4e:f0 with ip 10.0.0.3 and hostname test-host on interface br100
Traceback (most recent call last):
  File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 94, in <module>
    sys.exit(main())
  File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 88, in main
    globals()[action+'_lease'](mac, ip, hostname, interface)
  File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 47, in add_lease
    network.lease_ip(ip)
AttributeError: 'module' object has no attribute 'lease_ip'

Revision history for this message
Vish Ishaya (vishvananda) wrote :

Default flagfile with no params won't work. It needs the flagfile specified

On Jul 22, 2010 11:31 AM, "Jay Pipes" <email address hidden> wrote:

If I call default_flagfile() with no params (use defaults), I still get
some weird name resolution errors:

DEBUG:root:ISSUE_IP: warning: no vendor libraries included
, DEBUG:root:Called add for mac 02:16:3e:0e:4e:f0 with ip 10.0.0.3 and
hostname test-host on interface br100

Traceback (most recent call last):

File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 94, in
<module>
sys.exit(ma...
 File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 88, in
main
   globals()[action+'_lease'](mac, ip, hostname, interface)
 File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 47, in
add_lease
   network.lease_ip(ip)
AttributeError: 'module' object has no attribute 'lease_ip'

--
Failure in NetworkTestCase for range_allocation and
https://bugs.launchpad.net/bugs/608772
Yo...

Revision history for this message
Jay Pipes (jaypipes) wrote :

Sure it will.

from /nova/utils.py:

def default_flagfile(filename='nova.conf'):
    for arg in sys.argv:
        if arg.find('flagfile') != -1:
            break
    else:
        if not os.path.isabs(filename):
            # turn relative filename into an absolute path
            script_dir = os.path.dirname(inspect.stack()[-1][1])
            filename = os.path.abspath(os.path.join(script_dir, filename))
        if os.path.exists(filename):
            sys.argv = sys.argv[:1] + ['--flagfile=%s' % filename] + sys.argv[1:]

Anyway, I think it may have to do with Python sys.path, because when I print network, it shows I have the darn module loaded, but doesn't think there is a network.lease_ip attributes (which of course there is):

jpipes@serialcoder:~/repos/nova/bug608772$ TESTING=1 ./bin/nova-dhcpbridge add fake 127.0.0.1 serialcoder
warning: no vendor libraries included
DEBUG:root:Called add for mac fake with ip 127.0.0.1 and hostname serialcoder on interface br0
<module 'nova.compute.network' from '/usr/lib/pymodules/python2.6/nova/compute/network.py'>
Traceback (most recent call last):
  File "./bin/nova-dhcpbridge", line 89, in <module>
    globals()[action+'_lease'](mac, ip, hostname, interface)
  File "./bin/nova-dhcpbridge", line 48, in add_lease
    network.lease_ip(ip)
AttributeError: 'module' object has no attribute 'lease_ip'

Revision history for this message
Joshua McKenty (joshua-mckenty) wrote :

Vish, didn't you move the flag definition? And didn't I recently see a patch
that removed an "unused" import from dhcpleasor? That import was probably to
provide access to the flag.

Joshua

On Thu, Jul 22, 2010 at 8:43 AM, vishvananda <email address hidden> wrote:

> Default flagfile with no params won't work. It needs the flagfile
> specified
>
> On Jul 22, 2010 11:31 AM, "Jay Pipes" <email address hidden> wrote:
>
> If I call default_flagfile() with no params (use defaults), I still get
> some weird name resolution errors:
>
>
> DEBUG:root:ISSUE_IP: warning: no vendor libraries included
> , DEBUG:root:Called add for mac 02:16:3e:0e:4e:f0 with ip 10.0.0.3 and
> hostname test-host on interface br100
>
> Traceback (most recent call last):
>
> File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 94, in
> <module>
> sys.exit(ma...
> File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 88, in
> main
> globals()[action+'_lease'](mac, ip, hostname, interface)
> File "/home/jpipes/repos/nova/bug608772/bin/nova-dhcpbridge", line 47, in
> add_lease
> network.lease_ip(ip)
> AttributeError: 'module' object has no attribute 'lease_ip'
>
>
> --
> Failure in NetworkTestCase for range_allocation and
> https://bugs.launchpad.net/bugs/608772
> Yo...
>
> --
> Failure in NetworkTestCase for range_allocation and
> https://bugs.launchpad.net/bugs/608772
> You received this bug notification because you are a member of Nova
> Bugs, which is subscribed to OpenStack Compute (nova).
>
> Status in OpenStack Compute (Nova): New
>
> Bug description:
> On trunk, these have been appearing consistently:
>
>
> ===============================================================================
> [FAIL]:
> nova.tests.network_unittest.NetworkTestCase.test_allocate_deallocate_ip
>
> Traceback (most recent call last):
> File "/home/jpipes/repos/nova/working/nova/tests/network_unittest.py",
> line 79, in test_allocate_deallocate_ip
> self.assertEqual(False, is_in_project(address, "project0"))
> twisted.trial.unittest.FailTest: not equal:
> a = False
> b = True
>
>
> ===============================================================================
> [FAIL]: nova.tests.network_unittest.NetworkTestCase.test_range_allocation
>
> Traceback (most recent call last):
> File "/home/jpipes/repos/nova/working/nova/tests/network_unittest.py",
> line 103, in test_range_allocation
> self.assertEqual(False, is_in_project(address, "project0"))
> twisted.trial.unittest.FailTest: not equal:
> a = False
> b = True
>
>
> -------------------------------------------------------------------------------
> Ran 80 tests in 24.274s
>
> FAILED (failures=2, successes=78)
>
> Assigning to myself...I'll try and track down the fix...
>
>
>

Revision history for this message
Jay Pipes (jaypipes) wrote :

Anyway, a completely unmodified bin/nova-dhcpbridge gives errors in a clean branch:

jpipes@serialcoder:~/repos/nova/bug608772$ TESTING=1 ./bin/nova-dhcpbridge add fake 127.0.0.1 serialcoder
warning: no vendor libraries included
Traceback (most recent call last):
  File "./bin/nova-dhcpbridge", line 94, in <module>
    sys.exit(main())
  File "./bin/nova-dhcpbridge", line 71, in main
    flagfile = os.environ.get('FLAGFILE', FLAGS.dhcpbridge_flagfile)
  File "/usr/lib/python2.6/dist-packages/gflags.py", line 810, in __getattr__
    raise AttributeError(name)
AttributeError: dhcpbridge_flagfile

So, something is getting messed up in this file...I can run things like bin/nova-manage network restart (which also accesses nova.compule.network) just fine:

jpipes@serialcoder:~/repos/nova/bug608772$ ./bin/nova-manage network restart
warning: no vendor libraries included

Not sure where those "no vendor libraries included" is coming from though...perhaps that is the issue?

Revision history for this message
Vish Ishaya (vishvananda) wrote :

The no vendor libraries means it is using an old version of Nova that has
vendor.py do you have two versions in your path?

On Jul 22, 2010 12:20 PM, "Joshua McKenty" <email address hidden> wrote:

Vish, didn't you move the flag definition? And didn't I recently see a patch
that removed an "unused" import from dhcpleasor? That import was probably to
provide access to the flag.

Joshua

On Thu, Jul 22, 2010 at 8:43 AM, vishvananda <email address hidden>
wrote:

> Default flagfile with no params won't work. It needs the flagfile
> specified
>
> On Jul 22, 2010...
> --

> Failure in NetworkTestCase for range_allocation and
> https://bugs.launchpad.net/bugs/608772

> You received this bug notification because you are a member of Nova
> Bugs, which is subscribed to...

> Traceback (most recent call last):

> File "/home/jpipes/repos/nova/working/nova/tests/network_unittest.py",
> line 79, in test_allocat...

> Traceback (most recent call last):

> File "/home/jpipes/repos/nova/working/nova/tests/network_unittest.py",
> line 103, in test_range_...

--
Failure in NetworkTestCase for range_allocation and
https://bugs.launchpad.net/bugs/608772

You received this bug notification because you are a member of Nova
Bugs, which is subscribed to Ope...

Traceback (most recent call last):

File "/home/jpipes/repos/nova/working/nova/tests/network_unittest.py", line
79, in test_allocate_d...

Traceback (most recent call last):

File "/home/jpipes/repos/nova/working/nova/tests/network_unittest.py", line
103, in test_range_all...

Revision history for this message
Jay Pipes (jaypipes) wrote :

Hmm, that might be it...I'm sure it's some silly paths thing I've messed up :)

Revision history for this message
Jay Pipes (jaypipes) wrote :

Marking Invalid. Got paths resolved using virtualenv...really need to write a blog entry on this...

Changed in nova:
status: New → Invalid
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.