Merge lp://qastaging/~jason-koelker/nova/lp819477 into lp://qastaging/~hudson-openstack/nova/trunk

Proposed by Jason Kölker
Status: Work in progress
Proposed branch: lp://qastaging/~jason-koelker/nova/lp819477
Merge into: lp://qastaging/~hudson-openstack/nova/trunk
Diff against target: 2911 lines (+1321/-496)
21 files modified
bin/nova-manage (+136/-33)
nova/api/ec2/cloud.py (+2/-5)
nova/api/openstack/views/addresses.py (+1/-1)
nova/auth/manager.py (+25/-4)
nova/db/api.py (+59/-13)
nova/db/sqlalchemy/api.py (+145/-68)
nova/db/sqlalchemy/custom_types.py (+46/-0)
nova/db/sqlalchemy/migrate_repo/versions/045_split_networks.py (+128/-0)
nova/db/sqlalchemy/migrate_repo/versions/046_fk_fixed_ips_subnet_id.py (+57/-0)
nova/db/sqlalchemy/migrate_repo/versions/046_sqlite_downgrade.sql (+52/-0)
nova/db/sqlalchemy/migrate_repo/versions/046_sqlite_upgrade.sql (+52/-0)
nova/db/sqlalchemy/models.py (+35/-33)
nova/exception.py (+18/-5)
nova/network/api.py (+8/-4)
nova/network/linux_net.py (+34/-31)
nova/network/manager.py (+344/-186)
nova/tests/__init__.py (+1/-1)
nova/tests/api/openstack/contrib/test_floating_ips.py (+14/-5)
nova/tests/api/openstack/test_servers.py (+1/-1)
nova/tests/test_network.py (+135/-82)
nova/tests/test_nova_manage.py (+28/-24)
To merge this branch: bzr merge lp://qastaging/~jason-koelker/nova/lp819477
Reviewer Review Type Date Requested Status
Dan Prince (community) Needs Fixing
Thierry Carrez (community) ffe Abstain
Rick Harris (community) Approve
Trey Morris (community) Approve
Devin Carlen (community) Approve
Matt Dietz (community) Approve
Review via email: mp+71930@code.qastaging.launchpad.net

Commit message

* Split subnets and bridges into 2 tables.
* Add StringIP/StringNet db types to take and return netaddr instances, but store in DB as strings
* Add subnet_create function to network_manager and update network_create to use it
* Modify network_create to continue to allow specifying subnets along with networks for legacy compat
* Add subnet sub-command to nova-manager to create/list/delete subnets outside of network definition.

Description of the change

* Split subnets and bridges into 2 tables.
* Add StringIP/StringNet db types to take and return netaddr instances, but store in DB as strings
* Add subnet_create function to network_manager and update network_create to use it
* Modify network_create to continue to allow specifying subnets along with networks for legacy compat
* Add subnet sub-command to nova-manager to create/list/delete subnets outside of network definition.

To post a comment you must log in.
Revision history for this message
Matt Dietz (cerberus) wrote :

Couldn't find anything wrong other than a couple doc typos:

1034 + # If no ipv6 subnets are define this will be None

typo -> "defined"

1573 + # None if network with already exists

You accidentally a word

Seems reasonable otherwise. Good piece of functionality

review: Needs Fixing
Revision history for this message
Jason Kölker (jason-koelker) wrote :

> Couldn't find anything wrong other than a couple doc typos:
>
> 1034 + # If no ipv6 subnets are define this will be
> None
>
> typo -> "defined"
>
> 1573 + # None if network with already exists
>
> You accidentally a word
>
> Seems reasonable otherwise. Good piece of functionality

Typos have fixed. ;)

1446. By Jason Kölker

rename migrations in prep for trunk merge

1447. By Jason Kölker

merge trunk

1448. By Jason Kölker

merge trunk

1449. By Jason Kölker

merge trunk

Revision history for this message
Thierry Carrez (ttx) wrote :

Hmm, any reason why we'd need that one in Diablo ? We need some stability, and this changes DB and adds a nova-manage command...

review: Needs Information (ffe)
Revision history for this message
Trey Morris (tr3buchet) wrote :

ttx: we need this among other reasons to be able to add multiple subnets (with separate gateways) to a network. I've got a hack in place allowing this particular functionality that we use in our branch, but it's getting unwieldy keeping it up to date with trunk.

Revision history for this message
Trey Morris (tr3buchet) wrote :

setting to needs information so this stays on my radar

review: Needs Information
Revision history for this message
Thierry Carrez (ttx) wrote :

Trey: I have no idea how common that use case is. I'm just naturally reluctant, after the last milestone, to add any "feature" that modifies the DB... I'd also like to make the pre-release documenters job a little less miserable by not adding new commands to nova-manage in the last month :)

Feel free to convince Vish of the necessity of having that fix in.

Revision history for this message
Antony Messerli (antonym) wrote :

The ability to allow for overlaid networks is pretty important especially for a service provider. The current behavior only allows for the addition of a single network block per network for Flat networks. Sometimes we'll need to add several blocks of IPs to a Flat network and with the way the code works currently, it would generate a new VIF per block added. This makes it really hard to scale a zone out. A single flat network can have many overlaid network blocks on it and this patch would allow for that to work correctly.

It also gives us the ability to add smaller blocks at a time and move them around if we need to. The case where this makes sense is if a lot of space gets freed up in a zone while another zone starts nearing IP space capacity.

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

This definitely seems like good functionality, but I'm also a bit concerned about merging it this late. Trying to get a bit of a risk assesment

Revision history for this message
Matt Dietz (cerberus) wrote :

Thanks for the fixes, Banadushi

review: Approve
1450. By Jason Kölker

merge trunk also added subnet.uuid for consistency with other network tables that got it last week

1451. By Jason Kölker

merge the trunk

1452. By Jason Kölker

merge the trunks

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

220 +def get_session():
221 + if hasattr(IMPL, 'get_session'):
222 + return IMPL.get_session()
223 +
224 +
225 +###################
226 +
227 +

Don't like exposing the session outside of the db. We need to be able to do this without using the session in nova-manage

1453. By Jason Kölker

merge trunk

1454. By Jason Kölker

rename the migrations and remove the ability to pass the session in to the db api

1455. By Jason Kölker

update the new test

1456. By Jason Kölker

remove the rest of the session additions

Revision history for this message
Jason Kölker (jason-koelker) wrote :

Rock on, I remove the leaky session ;).

Happy Hacking!

7-11

1457. By Jason Kölker

remove the rest of the session additions

1458. By Jason Kölker

run through the subnet to find the network_uuid

Revision history for this message
Devin Carlen (devcamcar) wrote :

While this is a somewhat larger than normal last minute change, I think this looks pretty safe. I'd like to see this make it in.

review: Approve
1459. By Jason Kölker

merge the trunks

1460. By Jason Kölker

fix the network tests

1461. By Jason Kölker

update linux_net to use the subnet it gets passed

Revision history for this message
Trey Morris (tr3buchet) wrote :

+1

review: Approve
Revision history for this message
Trey Morris (tr3buchet) wrote :

also, vish: thanks for working with us on this.

1462. By Jason Kölker

fix typo

1463. By Jason Kölker

fix typo

1464. By Jason Kölker

attempt to dissasociate by subnet

1465. By Jason Kölker

switch to filter, not filter_by

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

Still quite a bit broken. I got most of the way there like this:

http://paste.openstack.org/show/2350/

most of those errors are caught by pyflakes, btw. I highly recommend you get it running automatically in your editor.

Remaining issues:

There are still a bunch of references to instance['fixed_ips'] and fixed['network'] in cloud.py that will cause metadata and describe instances to fail.

The network creation is still failing in my tests because vlan and bridge aren't getting set automatically by the command:
nova-manage network create private 10.0.0.0/24 1 256

vpn_public_address and vpn_public_port really seem like they should be properties of the network, not the subnet, and i worry that anything involving them is seriously broken. Nova-manage commands, ip forwarding rules, cloudpipe launching etc.

1466. By Jason Kölker

pyflakes fixes

1467. By Jason Kölker

update_dhcp is called once per subnet, so make sure it has access to the allocated fixed ips and the network prior to calling it

Revision history for this message
Rick Harris (rconradharris) wrote :

Really nice work here Jason.

A couple of micro-nits (would be nice-to-have fixes, but not enough to hold up the patch):

> 847 + i = subnets.insert()

Would prefer non-single-letter-vars, maybe `insert_stmt`.

> 1826 + if not network:
> 1827 + raise ValueError(_('Network already exists!'))
> 1828 + else:
> 1829 + nw_data.append(network)

A bit of a double negative with the else, perhaps:

if network:
    nw_data.append(network)
else:
    raise ValueError(_('Network already exists!'))

1468. By Jason Kölker

pep8

1469. By Jason Kölker

pass the right kwarg into the exception so locals() magic has the correct key for string formatting

1470. By Jason Kölker

Not not the double negative ;)

1471. By Jason Kölker

cleanup migration

Revision history for this message
Rick Harris (rconradharris) wrote :

lgtm, thanks for the fixups.

review: Approve
1472. By Jason Kölker

remove the ec2 references to network

1473. By Jason Kölker

remove debugging statement

Revision history for this message
Jason Kölker (jason-koelker) wrote :

> Still quite a bit broken. I got most of the way there like this:
>
> http://paste.openstack.org/show/2350/
>
> most of those errors are caught by pyflakes, btw. I highly recommend you get
> it running automatically in your editor.

Yea installed that, much better.

> Remaining issues:
>
> There are still a bunch of references to instance['fixed_ips'] and
> fixed['network'] in cloud.py that will cause metadata and describe instances
> to fail.

I fixed these. The instance['fixed_ips'] is still valid. The fixed['network'] call I removed and had the vif generate the ip with its property.

> The network creation is still failing in my tests because vlan and bridge
> aren't getting set automatically by the command:
> nova-manage network create private 10.0.0.0/24 1 256

I'm still looking at this.

> vpn_public_address and vpn_public_port really seem like they should be
> properties of the network, not the subnet, and i worry that anything involving
> them is seriously broken. Nova-manage commands, ip forwarding rules,
> cloudpipe launching etc.

Well I *think* that by moving them along with the subnet that you should get one per subnet. But I don't have a setup to test them. I'll see if I can get my xenserver to play with vlan manager nicely.

1474. By Jason Kölker

merge trunk

1475. By Jason Kölker

make sure that the test for VLAN manager is prior to the L2 net creation so vlan will get filled in the DB

1476. By Jason Kölker

generate project vpn data from the first subnet of the first network (generally it doesn't make sense to have the vlan manager and multiple subnets per network, so this *should* be safe)

1477. By Jason Kölker

add some debug logging

1478. By Jason Kölker

remove accidently setting the vpn_public address

1479. By Jason Kölker

remove unused import

1480. By Jason Kölker

make special case for VpnCommands.change so that it 'works' expectedly

1481. By Jason Kölker

VPN data should only be generated on v4 networks, since none of the VPN/VLAN stuff sets v6 up for it

1482. By Jason Kölker

if a vpn_public_port is generated and cpn_public_address is not specified, default to the FLAG value

Revision history for this message
Jason Kölker (jason-koelker) wrote :

> > The network creation is still failing in my tests because vlan and bridge
> > aren't getting set automatically by the command:
> > nova-manage network create private 10.0.0.0/24 1 256
>
> I'm still looking at this.

I think this is now taken care of. Please advise if it is not.

> > vpn_public_address and vpn_public_port really seem like they should be
> > properties of the network, not the subnet, and i worry that anything
> involving
> > them is seriously broken. Nova-manage commands, ip forwarding rules,
> > cloudpipe launching etc.
>
> Well I *think* that by moving them along with the subnet that you should get
> one per subnet. But I don't have a setup to test them. I'll see if I can get
> my xenserver to play with vlan manager nicely.

I updated the `nova-manage vpn change` command to update the subnet. I couldn't find any other references to vpn_ in it please let me know if there are others I am missing.

The forwarding rules (I assume ensure_vpn_forward in linux_net) are getting the port and private address passed to them from the subnet table as they are getting called once per subnet per network. This should allow for the updating of the VPN system to handle multiple networks/subnet nicely (currently it just takes the 1st network it finds for a project).

I also updated the auth/manager's get_project_vpn_data to return the data for the 1st v4 subnet on the network. I *think* this is correct and will work, but I don't have the setup to test cloudpipe instances extensively. Please let me know if its still not working as expected.

1483. By Jason Kölker

pep8 fix

1484. By Jason Kölker

merge trunk

1485. By Jason Kölker

merge trunk

Revision history for this message
Thierry Carrez (ttx) wrote :

Essex is open !

review: Abstain (ffe)
Revision history for this message
Dan Prince (dan-prince) wrote :

Hi Jason,

I'm getting errors when using FlatDHCP w/ this branch (via Smokestack):

  InvalidRequestError: Object '<Subnet at 0x3840510>' is already attached to session

Paste stack trace available here:

  http://paste.openstack.org/show/2413/

---

Also. You have some conflicts to fix with the latest nova trunk:

Text conflict in bin/nova-manage
Text conflict in nova/db/api.py
Text conflict in nova/db/sqlalchemy/api.py
Text conflict in nova/db/sqlalchemy/models.py
Text conflict in nova/exception.py
Text conflict in nova/tests/test_network.py

review: Needs Fixing
Revision history for this message
Jason Kölker (jason-koelker) wrote :

On Mon, 2011-09-12 at 01:52 +0000, Dan Prince wrote:
> Review: Needs Fixing
>
> Hi Jason,
>
> I'm getting errors when using FlatDHCP w/ this branch (via Smokestack):
>
> InvalidRequestError: Object '<Subnet at 0x3840510>' is already attached to session
>
> Paste stack trace available here:
>
> http://paste.openstack.org/show/2413/

Do you happen to have the full stack trace so I can see where this is
happening at?

> ---
>
> Also. You have some conflicts to fix with the latest nova trunk:
>
> Text conflict in bin/nova-manage
> Text conflict in nova/db/api.py
> Text conflict in nova/db/sqlalchemy/api.py
> Text conflict in nova/db/sqlalchemy/models.py
> Text conflict in nova/exception.py
> Text conflict in nova/tests/test_network.py

Yea, I have the conflicts fixed locally, but the quantum unit tests now
fail since they mock out their own network data. Working on fixing those
before I push again.

Happy Hacking!

7-11

Revision history for this message
Dan Prince (dan-prince) wrote :

> > Paste stack trace available here:
> >
> > http://paste.openstack.org/show/2413/
>
> Do you happen to have the full stack trace so I can see where this is
> happening at?
>

This one is a bit longer:

http://paste.openstack.org/show/2443/

Sorry. I only have the last 100 lines or so of the nova-network.log file.

Unmerged revisions

1485. By Jason Kölker

merge trunk

1484. By Jason Kölker

merge trunk

1483. By Jason Kölker

pep8 fix

1482. By Jason Kölker

if a vpn_public_port is generated and cpn_public_address is not specified, default to the FLAG value

1481. By Jason Kölker

VPN data should only be generated on v4 networks, since none of the VPN/VLAN stuff sets v6 up for it

1480. By Jason Kölker

make special case for VpnCommands.change so that it 'works' expectedly

1479. By Jason Kölker

remove unused import

1478. By Jason Kölker

remove accidently setting the vpn_public address

1477. By Jason Kölker

add some debug logging

1476. By Jason Kölker

generate project vpn data from the first subnet of the first network (generally it doesn't make sense to have the vlan manager and multiple subnets per network, so this *should* be safe)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.