Merge lp:~jk0/nova/xs-ipv6 into lp:~hudson-openstack/nova/trunk

Proposed by Josh Kearney
Status: Merged
Approved by: Matt Dietz
Approved revision: 754
Merged at revision: 753
Proposed branch: lp:~jk0/nova/xs-ipv6
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 151 lines (+113/-8)
3 files modified
nova/db/sqlalchemy/migrate_repo/versions/007_add_ipv6_to_fixed_ips.py (+90/-0)
nova/db/sqlalchemy/models.py (+3/-0)
nova/virt/xenapi/vmops.py (+20/-8)
To merge this branch: bzr merge lp:~jk0/nova/xs-ipv6
Reviewer Review Type Date Requested Status
Matt Dietz (community) Approve
Trey Morris (community) Approve
Sandy Walsh (community) Approve
Sandy Walsh Pending
Review via email: mp+51976@code.launchpad.net

Description of the change

Enable IPv6 injection for XenServer instances. Added addressV6, netmaskV6 and gatewayV6 columns to the fixed_ips table via migration #007 as per NTT FlatManager IPv6 spec.

To post a comment you must log in.
Revision history for this message
Sandy Walsh (sandy-walsh) wrote :

Nothing to complain about here.

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

looks just fine to me. I didn't pay much attention to the migration but i'm guessing it isn't why you requested my review.

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

lgtm.

review: Approve
Revision history for this message
Tushar Patil (tpatil) wrote :

There is a slight change in the flatmanager design for IPV6 and I want to bring to your notice the changes we are planning from the initial design.

Database Changes:
1) Renaming ra_server column to gateway_v6 from networks db table. When we (NTT) implemented IPv6 support for VlanManager and FlatDHCPManager in Bexar, we added new ra_server column in the networks database table. However now we think that ra_server name is not suitable naming.Because with all of 3 network models, there are some routers as gateway which forwards the packets between inside and outside of the cloud. And only with VlanManager or FlatDHCPManager, those routers advertises RA messages. Then in generally, those routers should be called as not "RA server" but just "gateway".
So we are planning to rename ra_server column to gateway_v6.
2) Adding netmask_v6 column to the networks db table.
3) We are not adding new addressV6 column to the fixed_ips. Please take a note of this.
  Reason: IPv6 address will be calculated from MAC address a we are doing it in case of all of Vlan, FlatDHCP.

This is the first time, we have come across such dependency and I know you will have to do lot of rework. Sorry for that. Please let us know if you want to know more about our design changes.
Please check-out our branch at https://code.launchpad.net/~ntt-pf-lab/nova/flatmanager-ipv6 for more information. The development is still in progress.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'nova/db/sqlalchemy/migrate_repo/versions/007_add_ipv6_to_fixed_ips.py'
2--- nova/db/sqlalchemy/migrate_repo/versions/007_add_ipv6_to_fixed_ips.py 1970-01-01 00:00:00 +0000
3+++ nova/db/sqlalchemy/migrate_repo/versions/007_add_ipv6_to_fixed_ips.py 2011-03-02 22:52:14 +0000
4@@ -0,0 +1,90 @@
5+# Copyright 2011 OpenStack LLC
6+# All Rights Reserved.
7+#
8+# Licensed under the Apache License, Version 2.0 (the "License"); you may
9+# not use this file except in compliance with the License. You may obtain
10+# a copy of the License at
11+#
12+# http://www.apache.org/licenses/LICENSE-2.0
13+#
14+# Unless required by applicable law or agreed to in writing, software
15+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17+# License for the specific language governing permissions and limitations
18+# under the License.
19+
20+from sqlalchemy import *
21+from migrate import *
22+
23+from nova import log as logging
24+
25+
26+meta = MetaData()
27+
28+
29+# Table stub-definitions
30+# Just for the ForeignKey and column creation to succeed, these are not the
31+# actual definitions of instances or services.
32+#
33+fixed_ips = Table(
34+ "fixed_ips",
35+ meta,
36+ Column(
37+ "id",
38+ Integer(),
39+ primary_key=True,
40+ nullable=False))
41+
42+#
43+# New Tables
44+#
45+# None
46+
47+#
48+# Tables to alter
49+#
50+# None
51+
52+#
53+# Columns to add to existing tables
54+#
55+
56+fixed_ips_addressV6 = Column(
57+ "addressV6",
58+ String(
59+ length=255,
60+ convert_unicode=False,
61+ assert_unicode=None,
62+ unicode_error=None,
63+ _warn_on_bytestring=False))
64+
65+
66+fixed_ips_netmaskV6 = Column(
67+ "netmaskV6",
68+ String(
69+ length=3,
70+ convert_unicode=False,
71+ assert_unicode=None,
72+ unicode_error=None,
73+ _warn_on_bytestring=False))
74+
75+
76+fixed_ips_gatewayV6 = Column(
77+ "gatewayV6",
78+ String(
79+ length=255,
80+ convert_unicode=False,
81+ assert_unicode=None,
82+ unicode_error=None,
83+ _warn_on_bytestring=False))
84+
85+
86+def upgrade(migrate_engine):
87+ # Upgrade operations go here. Don't create your own engine;
88+ # bind migrate_engine to your metadata
89+ meta.bind = migrate_engine
90+
91+ # Add columns to existing tables
92+ fixed_ips.create_column(fixed_ips_addressV6)
93+ fixed_ips.create_column(fixed_ips_netmaskV6)
94+ fixed_ips.create_column(fixed_ips_gatewayV6)
95
96=== modified file 'nova/db/sqlalchemy/models.py'
97--- nova/db/sqlalchemy/models.py 2011-02-24 05:47:29 +0000
98+++ nova/db/sqlalchemy/models.py 2011-03-02 22:52:14 +0000
99@@ -437,6 +437,9 @@
100 allocated = Column(Boolean, default=False)
101 leased = Column(Boolean, default=False)
102 reserved = Column(Boolean, default=False)
103+ addressV6 = Column(String(255))
104+ netmaskV6 = Column(String(3))
105+ gatewayV6 = Column(String(255))
106
107
108 class User(BASE, NovaBase):
109
110=== modified file 'nova/virt/xenapi/vmops.py'
111--- nova/virt/xenapi/vmops.py 2011-02-25 16:47:08 +0000
112+++ nova/virt/xenapi/vmops.py 2011-03-02 22:52:14 +0000
113@@ -514,18 +514,30 @@
114 network_IPs = [ip for ip in IPs if ip.network_id == network.id]
115
116 def ip_dict(ip):
117- return {'netmask': network['netmask'],
118- 'enabled': '1',
119- 'ip': ip.address}
120+ return {
121+ "ip": ip.address,
122+ "netmask": network["netmask"],
123+ "enabled": "1"}
124+
125+ def ip6_dict(ip6):
126+ return {
127+ "ip": ip6.addressV6,
128+ "netmask": ip6.netmaskV6,
129+ "gateway": ip6.gatewayV6,
130+ "enabled": "1"}
131
132 mac_id = instance.mac_address.replace(':', '')
133 location = 'vm-data/networking/%s' % mac_id
134- mapping = {'label': network['label'],
135- 'gateway': network['gateway'],
136- 'mac': instance.mac_address,
137- 'dns': [network['dns']],
138- 'ips': [ip_dict(ip) for ip in network_IPs]}
139+ mapping = {
140+ 'label': network['label'],
141+ 'gateway': network['gateway'],
142+ 'mac': instance.mac_address,
143+ 'dns': [network['dns']],
144+ 'ips': [ip_dict(ip) for ip in network_IPs],
145+ 'ip6s': [ip6_dict(ip) for ip in network_IPs]}
146+
147 self.write_to_param_xenstore(vm_opaque_ref, {location: mapping})
148+
149 try:
150 self.write_to_xenstore(vm_opaque_ref, location,
151 mapping['location'])