diff options
author | NTT PF Lab. <openstack@lab.ntt.co.jp> | 2010-12-24 20:38:49 +0900 |
---|---|---|
committer | NTT PF Lab. <openstack@lab.ntt.co.jp> | 2010-12-24 20:38:49 +0900 |
commit | c5c58cb20def79401a374f863983a343139b53f3 (patch) | |
tree | 779776e3e04787318212572a96a0dc8a0f7ffb79 /contrib | |
parent | 0a93a9298dda075b5519e71289d0bac6fb461404 (diff) | |
download | nova-c5c58cb20def79401a374f863983a343139b53f3.tar.gz nova-c5c58cb20def79401a374f863983a343139b53f3.tar.xz nova-c5c58cb20def79401a374f863983a343139b53f3.zip |
Support IPv6
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/boto_v6/__init__.py | 37 | ||||
-rw-r--r-- | contrib/boto_v6/ec2/__init__.py | 0 | ||||
-rw-r--r-- | contrib/boto_v6/ec2/connection.py | 41 | ||||
-rw-r--r-- | contrib/boto_v6/ec2/instance.py | 33 | ||||
-rwxr-xr-x | contrib/nova.sh | 6 |
5 files changed, 117 insertions, 0 deletions
diff --git a/contrib/boto_v6/__init__.py b/contrib/boto_v6/__init__.py new file mode 100644 index 000000000..9fec157f1 --- /dev/null +++ b/contrib/boto_v6/__init__.py @@ -0,0 +1,37 @@ +# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ +# Copyright (c) 2010, Eucalyptus Systems, Inc. +# All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, dis- +# tribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the fol- +# lowing conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- +# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + + +def connect_ec2(aws_access_key_id=None, aws_secret_access_key=None, **kwargs): + """ + :type aws_access_key_id: string + :param aws_access_key_id: Your AWS Access Key ID + + :type aws_secret_access_key: string + :param aws_secret_access_key: Your AWS Secret Access Key + + :rtype: :class:`boto.ec2.connection.EC2Connection` + :return: A connection to Amazon's EC2 + """ + from boto_v6.ec2.connection import EC2ConnectionV6 + return EC2ConnectionV6(aws_access_key_id, aws_secret_access_key, **kwargs) diff --git a/contrib/boto_v6/ec2/__init__.py b/contrib/boto_v6/ec2/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/contrib/boto_v6/ec2/__init__.py diff --git a/contrib/boto_v6/ec2/connection.py b/contrib/boto_v6/ec2/connection.py new file mode 100644 index 000000000..151b76a55 --- /dev/null +++ b/contrib/boto_v6/ec2/connection.py @@ -0,0 +1,41 @@ +''' +Created on 2010/12/20 + +@author: Nachi Ueno <ueno.nachi@lab.ntt.co.jp> +''' +import boto +import boto.ec2 +from boto_v6.ec2.instance import ReservationV6 + + +class EC2ConnectionV6(boto.ec2.EC2Connection): + ''' + EC2Connection for OpenStack IPV6 mode + ''' + def get_all_instances(self, instance_ids=None, filters=None): + """ + Retrieve all the instances associated with your account. + + :type instance_ids: list + :param instance_ids: A list of strings of instance IDs + + :type filters: dict + :param filters: Optional filters that can be used to limit + the results returned. Filters are provided + in the form of a dictionary consisting of + filter names as the key and filter values + as the value. The set of allowable filter + names/values is dependent on the request + being performed. Check the EC2 API guide + for details. + + :rtype: list + :return: A list of :class:`boto.ec2.instance.Reservation` + """ + params = {} + if instance_ids: + self.build_list_params(params, instance_ids, 'InstanceId') + if filters: + self.build_filter_params(params, filters) + return self.get_list('DescribeInstances', params, + [('item', ReservationV6)]) diff --git a/contrib/boto_v6/ec2/instance.py b/contrib/boto_v6/ec2/instance.py new file mode 100644 index 000000000..255114935 --- /dev/null +++ b/contrib/boto_v6/ec2/instance.py @@ -0,0 +1,33 @@ +''' +Created on 2010/12/20 + +@author: Nachi Ueno <ueno.nachi@lab.ntt.co.jp> +''' +import boto +from boto.resultset import ResultSet +from boto.ec2.instance import Reservation +from boto.ec2.instance import Group +from boto.ec2.instance import Instance + + +class ReservationV6(Reservation): + def startElement(self, name, attrs, connection): + if name == 'instancesSet': + self.instances = ResultSet([('item', InstanceV6)]) + return self.instances + elif name == 'groupSet': + self.groups = ResultSet([('item', Group)]) + return self.groups + else: + return None + + +class InstanceV6(Instance): + def __init__(self, connection=None): + Instance.__init__(self, connection) + self.public_dns_name_v6 = None + + def endElement(self, name, value, connection): + Instance.endElement(self, name, value, connection) + if name == 'dnsNameV6': + self.dns_name_v6 = value diff --git a/contrib/nova.sh b/contrib/nova.sh index 30df4edb6..bc46740ad 100755 --- a/contrib/nova.sh +++ b/contrib/nova.sh @@ -85,6 +85,10 @@ if [ "$CMD" == "install" ]; then sudo apt-get install -y python-twisted python-sqlalchemy python-mox python-greenlet python-carrot sudo apt-get install -y python-daemon python-eventlet python-gflags python-tornado python-ipy sudo apt-get install -y python-libvirt python-libxml2 python-routes +#For IPV6 + sudo apt-get install -y python-netaddr + sudo apt-get install -y radvd + if [ "$USE_MYSQL" == 1 ]; then cat <<MYSQL_PRESEED | debconf-set-selections mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS @@ -106,6 +110,8 @@ function screen_it { if [ "$CMD" == "run" ]; then killall dnsmasq + #For IPv6 + killall radvd screen -d -m -S nova -t nova sleep 1 if [ "$USE_MYSQL" == 1 ]; then |