Ask Your Question
0

Error in network tests when running dhcpbridge with fake option

asked 2011-03-01 10:54:59 -0500

salvatore-orlando gravatar image

6 out of 10 tests in nova.tests.test_network are failing on my dev machine. I tried with fresh code from trunk, so I guess there must be a problem with the setup on my machine.

NetworkTestCase test_allocate_deallocate_fixed_ip ERROR test_available_ips OK test_ips_are_reused ERROR test_private_ipv6 OK test_public_network_association ERROR test_side_effects ERROR test_subnet_edge ERROR test_too_many_addresses ERROR test_too_many_networks OK test_vpn_ip_and_port_looks_valid OK

Both with and without venv it looks like the problem lies with nova-dhcpbridge, as it is trying to connect with mysql (I use it as a db for my development). I think the db connection should be faked in tests, so I don't understand why it is trying to connect to mysql.

With venv I get the following:

Traceback (most recent call last): File "/home/salvatore/workspace/Openstack-xenapi-netinject/nova/tests/test_network.py", line 306, in test_too_many_addresses lease_ip(address) File "/home/salvatore/workspace/Openstack-xenapi-netinject/nova/tests/test_network.py", line 352, in lease_ip (out, err) = utils.execute(cmd, addl_env=env) File "/home/salvatore/workspace/Openstack-xenapi-netinject/nova/utils.py", line 151, in execute cmd=cmd) ProcessExecutionError: Unexpected error while running command. Command: /home/salvatore/workspace/Openstack-xenapi-netinject/bin/nova-dhcpbridge add 02:16:3e:25:f5:81 10.0.0.3 fake Exit code: 1 Stdout: '' Stderr: '2011-03-01 10:39:13,776 DEBUG nova.dhcpbridge [-] TESTING!!!! from (pid=8546) main /home/salvatore/workspace/Openstack-xenapi-netinject/bin/nova-dhcpbridge:108\n2011-03-01 10:39:13,789 DEBUG nova.dhcpbridge [-] Called add for mac 02:16:3e:25:f5:81 with ip 10.0.0.3 and hostname fake on interface br100 from (pid=8546) main /home/salvatore/workspace/Openstack-xenapi-netinject/bin/nova-dhcpbridge:117\n2011-03-01 10:39:13,789 DEBUG nova.dhcpbridge [-] leasing ip from (pid=8546) add_lease /home/salvatore/workspace/Openstack-xenapi-netinject/bin/nova-dhcpbridge:58\n2011-03-01 10:39:13,789 DEBUG nova.network.manager [Y4GPUYKIP11X8UT--FSI None None] Leasing IP 10.0.0.3 from (pid=8546) lease_fixed_ip /home/salvatore/workspace/Openstack-xenapi-netinject/nova/network/manager.py:223\n2011-03-01 10:39:13,910 DEBUG nova.utils [-] backend <module \'nova.db.sqlalchemy.api\'="" from="" \'="" home="" salvatore="" workspace="" openstack-xenapi-netinject="" nova="" db="" sqlalchemy="" api.pyc\'=""> from (pid=8546) __get_backend /home/salvatore/workspace/Openstack-xenapi-netinject/nova/utils.py:376\n2011-03-01 10:39:13,924 CRITICAL nova [-] No module named MySQLdb\n(nova): TRACE: Traceback (most recent call last):\n(nova): TRACE: File "/home/salvatore/workspace/Openstack-xenapi-netinject/bin/nova-dhcpbridge", line 123, in <module>\n(nova): TRACE: main()\n(nova): TRACE: File "/home/salvatore/workspace/Openstack-xenapi-netinject/bin/nova-dhcpbridge", line 118, in main\n(nova): TRACE: globals()action + \'_lease\'\n(nova): TRACE: File "/home/salvatore/workspace/Openstack-xenapi-netinject/bin/nova-dhcpbridge", line 62, in add_lease\n(nova): TRACE: ip_address)\n(nova): TRACE: File "/home/salvatore/workspace/Openstack-xenapi-netinject/nova/network/manager.py", line 224, in lease_fixed_ip\n(nova): TRACE: fixed_ip_ref = self.db.fixed_ip_get_by_address(context, address)\n(nova): TRACE: File "/home/salvatore/workspace/Openstack-xenapi-netinject/nova/db/api.py", line 298, in fixed_ip_get_by_address\n(nova): TRACE: return IMPL.fixed_ip_get_by_address(context, address)\n(nova): TRACE: File "/home/salvatore/workspace/Openstack-xenapi-netinject/nova/db/sqlalchemy/api.py", line 108, in wrapper\n(nova): TRACE: return f(args, kwargs)\n(nova): TRACE ... (more)

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2011-03-01 17:51:38 -0500

salvatore-orlando gravatar image

Thanks, Vish.

I'll file a bug and attach a patch for this.

Salvatore

edit flag offensive delete link more
0

answered 2011-03-01 11:15:55 -0500

salvatore-orlando gravatar image

I fixed it by removing by the --mysql_connection flag in /etc/nova/nova-dhcpbridge.conf However, another possible way of sorting this out (in my opinion) is to prevent nova-dhcpbridge from reading the flagfile when it is being ran for tests. Something like the following will do:

def main(): """Parse environment and arguments and call the approproate action.""" interface = os.environ.get('DNSMASQ_INTERFACE', 'br0') argv = FLAGS(sys.argv) if int(os.environ.get('TESTING', '0')): LOG.debug("TESTING!!!!") from nova.tests import fake_flags else: flagfile = os.environ.get('FLAGFILE', FLAGS.dhcpbridge_flagfile) utils.default_flagfile(flagfile) logging.setup() action = argv[1] if action in ['add', 'del', 'old']: mac = argv[2] ip = argv[3] hostname = argv[4] msg = _("Called %(action)s for mac %(mac)s with ip %(ip)s and" " hostname %(hostname)s on interface %(interface)s") % locals() LOG.debug(msg) globals()action + '_lease' else: print init_leases(interface)

edit flag offensive delete link more
0

answered 2011-03-01 16:57:18 -0500

vishvananda gravatar image

This makes sense to me. The dhcpbridge flagfile shouldn't need to be read during tests.

Vish

On Mar 1, 2011, at 3:15 AM, Salvatore Orlando wrote:

Question #147352 on OpenStack Compute (nova) changed: https://answers.launchpad.net/nova/+q...

Salvatore Orlando posted a new comment: I fixed it by removing by the --mysql_connection flag in /etc/nova/nova-dhcpbridge.conf However, another possible way of sorting this out (in my opinion) is to prevent nova-dhcpbridge from reading the flagfile when it is being ran for tests. Something like the following will do:

def main(): """Parse environment and arguments and call the approproate action.""" interface = os.environ.get('DNSMASQ_INTERFACE', 'br0') argv = FLAGS(sys.argv) if int(os.environ.get('TESTING', '0')): LOG.debug("TESTING!!!!") from nova.tests import fake_flags else: flagfile = os.environ.get('FLAGFILE', FLAGS.dhcpbridge_flagfile) utils.default_flagfile(flagfile) logging.setup() action = argv[1] if action in ['add', 'del', 'old']: mac = argv[2] ip = argv[3] hostname = argv[4] msg = _("Called %(action)s for mac %(mac)s with ip %(ip)s and" " hostname %(hostname)s on interface %(interface)s") % locals() LOG.debug(msg) globals()action + '_lease' else: print init_leases(interface)


You received this question notification because you are a member of Nova Core, which is an answer contact for OpenStack Compute (nova).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2011-03-01 10:54:59 -0500

Seen: 52 times

Last updated: Mar 01 '11