From 05afafab71a5c99a99b3a069bcc6145dd4aeab40 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Wed, 30 Jun 2010 16:45:41 +0200 Subject: Use separate configuration files for the different daemons. --- debian/nova-api.conf | 3 +++ debian/nova-api.init | 4 ++-- debian/nova-api.install | 1 + debian/nova-compute.conf | 3 +++ debian/nova-compute.init | 4 ++-- debian/nova-compute.install | 1 + debian/nova-objectstore.conf | 5 +++++ debian/nova-objectstore.init | 4 ++-- debian/nova-objectstore.install | 1 + debian/nova-volume.conf | 5 +++++ debian/nova-volume.init | 4 ++-- debian/nova-volume.install | 1 + 12 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 debian/nova-api.conf create mode 100644 debian/nova-compute.conf create mode 100644 debian/nova-objectstore.conf create mode 100644 debian/nova-volume.conf diff --git a/debian/nova-api.conf b/debian/nova-api.conf new file mode 100644 index 000000000..62bfd016d --- /dev/null +++ b/debian/nova-api.conf @@ -0,0 +1,3 @@ +--daemonize=1 +--ca_path=/usr/share/nova/CA +--fake_users=1 diff --git a/debian/nova-api.init b/debian/nova-api.init index 925c92c5e..77d9b2442 100644 --- a/debian/nova-api.init +++ b/debian/nova-api.init @@ -13,10 +13,10 @@ set -e DAEMON=/usr/bin/nova-api -DAEMON_ARGS="--flagfile=/etc/nova.conf" +DAEMON_ARGS="--flagfile=/etc/nova-api.conf" PIDFILE=/var/run/nova-api.pid -ENABLED=false +ENABLED=true if test -f /etc/default/nova-api; then . /etc/default/nova-api diff --git a/debian/nova-api.install b/debian/nova-api.install index 757235b11..d1f5d7d5a 100644 --- a/debian/nova-api.install +++ b/debian/nova-api.install @@ -1 +1,2 @@ bin/nova-api usr/bin +debian/nova-api.conf etc diff --git a/debian/nova-compute.conf b/debian/nova-compute.conf new file mode 100644 index 000000000..62bfd016d --- /dev/null +++ b/debian/nova-compute.conf @@ -0,0 +1,3 @@ +--daemonize=1 +--ca_path=/usr/share/nova/CA +--fake_users=1 diff --git a/debian/nova-compute.init b/debian/nova-compute.init index 89d0e5fce..820cf3d36 100644 --- a/debian/nova-compute.init +++ b/debian/nova-compute.init @@ -13,10 +13,10 @@ set -e DAEMON=/usr/bin/nova-compute -DAEMON_ARGS="--flagfile=/etc/nova.conf" +DAEMON_ARGS="--flagfile=/etc/nova-compute.conf" PIDFILE=/var/run/nova-compute.pid -ENABLED=false +ENABLED=true if test -f /etc/default/nova-compute; then . /etc/default/nova-compute diff --git a/debian/nova-compute.install b/debian/nova-compute.install index 6387cef07..20db74f14 100644 --- a/debian/nova-compute.install +++ b/debian/nova-compute.install @@ -1 +1,2 @@ bin/nova-compute usr/bin +debian/nova-compute.conf etc diff --git a/debian/nova-objectstore.conf b/debian/nova-objectstore.conf new file mode 100644 index 000000000..4b74efe0e --- /dev/null +++ b/debian/nova-objectstore.conf @@ -0,0 +1,5 @@ +--daemonize=1 +--ca_path=/usr/share/nova/CA +--fake_users=1 +--images_path=/var/lib/nova/images +--buckets_path=/var/lib/nova/buckets diff --git a/debian/nova-objectstore.init b/debian/nova-objectstore.init index be7d32d8e..7f37ac8ac 100644 --- a/debian/nova-objectstore.init +++ b/debian/nova-objectstore.init @@ -13,10 +13,10 @@ set -e DAEMON=/usr/bin/nova-objectstore -DAEMON_ARGS="--flagfile=/etc/nova.conf" +DAEMON_ARGS="--flagfile=/etc/nova-objectstore.conf" PIDFILE=/var/run/nova-objectstore.pid -ENABLED=false +ENABLED=true if test -f /etc/default/nova-objectstore; then . /etc/default/nova-objectstore diff --git a/debian/nova-objectstore.install b/debian/nova-objectstore.install index ccc60fccc..14a6dd37f 100644 --- a/debian/nova-objectstore.install +++ b/debian/nova-objectstore.install @@ -1 +1,2 @@ bin/nova-objectstore usr/bin +debian/nova-objectstore.conf etc diff --git a/debian/nova-volume.conf b/debian/nova-volume.conf new file mode 100644 index 000000000..4b74efe0e --- /dev/null +++ b/debian/nova-volume.conf @@ -0,0 +1,5 @@ +--daemonize=1 +--ca_path=/usr/share/nova/CA +--fake_users=1 +--images_path=/var/lib/nova/images +--buckets_path=/var/lib/nova/buckets diff --git a/debian/nova-volume.init b/debian/nova-volume.init index 80da3f70c..069b47818 100644 --- a/debian/nova-volume.init +++ b/debian/nova-volume.init @@ -13,10 +13,10 @@ set -e DAEMON=/usr/bin/nova-volume -DAEMON_ARGS="--flagfile=/etc/nova.conf" +DAEMON_ARGS="--flagfile=/etc/nova-volume.conf" PIDFILE=/var/run/nova-volume.pid -ENABLED=false +ENABLED=true if test -f /etc/default/nova-volume; then . /etc/default/nova-volume diff --git a/debian/nova-volume.install b/debian/nova-volume.install index 37b535c03..e7e172019 100644 --- a/debian/nova-volume.install +++ b/debian/nova-volume.install @@ -1 +1,2 @@ bin/nova-volume usr/bin +debian/nova-volume.conf etc -- cgit From 4bdc2f061ca1855a56391acc994b637dc2f73bc6 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Wed, 30 Jun 2010 16:46:02 +0200 Subject: Expand somewhat on the short and long descriptions in debian/control. --- debian/control | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 101 insertions(+), 10 deletions(-) diff --git a/debian/control b/debian/control index a50e6ecf8..65af8f0cc 100644 --- a/debian/control +++ b/debian/control @@ -3,38 +3,129 @@ Section: net Priority: extra Maintainer: Jesse Andrews Build-Depends: debhelper (>= 7) -Build-Depends-Indep: python-support +Build-Depends-Indep: python-support, python-setuptools Standards-Version: 3.8.4 XS-Python-Version: 2.6 Package: nova-common Architecture: all -Depends: ${python:Depends}, aoetools, vlan, python-ipy, python-boto, python-m2crypto, python-pycurl, python-twisted (>= 10.0.0-2ubuntu2nebula1), python-daemon, python-redis, python-carrot, python-lockfile, python-gflags, python-tornado, ${misc:Depends} +Depends: ${python:Depends}, aoetools, vlan, python-ipy, python-boto, python-m2crypto, python-pycurl, python-twisted, python-daemon, python-redis, python-carrot, python-lockfile, python-gflags, python-tornado, ${misc:Depends} Provides: ${python:Provides} -Conflicts: nova -Description: Nova is a cloud +Description: Nova Cloud Computing - common files + Nova is a cloud computing fabric controller (the main part of an IaaS + system) built to match the popular AWS EC2 and S3 APIs. It is written in + Python, using the Tornado and Twisted frameworks, and relies on the + standard AMQP messaging protocol, and the Redis distributed KVS. + . + Nova is intended to be easy to extend, and adapt. For example, it + currently uses an LDAP server for users and groups, but also includes a + fake LDAP server, that stores data in Redis. It has extensive test + coverage, and uses the Sphinx toolkit (the same as Python itself) for code + and user documentation. + . + While Nova is currently in Beta use within several organizations, the + codebase is very much under active development. + . + This package contains things that are needed by all parts of Nova. Package: nova-compute Architecture: all -Depends: nova-common (= ${binary:Version}), kpartx, kvm, python-libvirt, libvirt-bin (>= 0.8.1), ${python:Depends}, ${misc:Depends} -Description: Nova compute +Depends: nova-common (= ${binary:Version}), kpartx, kvm, python-libvirt, libvirt-bin (>= 0.7.5), ${python:Depends}, ${misc:Depends} +Description: Nova Cloud Computing - compute node + Nova is a cloud computing fabric controller (the main part of an IaaS + system) built to match the popular AWS EC2 and S3 APIs. It is written in + Python, using the Tornado and Twisted frameworks, and relies on the + standard AMQP messaging protocol, and the Redis distributed KVS. + . + Nova is intended to be easy to extend, and adapt. For example, it + currently uses an LDAP server for users and groups, but also includes a + fake LDAP server, that stores data in Redis. It has extensive test + coverage, and uses the Sphinx toolkit (the same as Python itself) for code + and user documentation. + . + While Nova is currently in Beta use within several organizations, the + codebase is very much under active development. + . + This is the package you will install on the nodes that will run your + virtual machines. Package: nova-volume Architecture: all Depends: nova-common (= ${binary:Version}), vblade, vblade-persist, ${python:Depends}, ${misc:Depends} -Description: Nova volume +Description: Nova Cloud Computing - storage + Nova is a cloud computing fabric controller (the main part of an IaaS + system) built to match the popular AWS EC2 and S3 APIs. It is written in + Python, using the Tornado and Twisted frameworks, and relies on the + standard AMQP messaging protocol, and the Redis distributed KVS. + . + Nova is intended to be easy to extend, and adapt. For example, it + currently uses an LDAP server for users and groups, but also includes a + fake LDAP server, that stores data in Redis. It has extensive test + coverage, and uses the Sphinx toolkit (the same as Python itself) for code + and user documentation. + . + While Nova is currently in Beta use within several organizations, the + codebase is very much under active development. + . + This is the package you will install on your storage nodes. Package: nova-api Architecture: all Depends: nova-common (= ${binary:Version}), ${python:Depends}, ${misc:Depends} -Description: Nova api +Description: Nova Cloud Computing - API frontend + Nova is a cloud computing fabric controller (the main part of an IaaS + system) built to match the popular AWS EC2 and S3 APIs. It is written in + Python, using the Tornado and Twisted frameworks, and relies on the + standard AMQP messaging protocol, and the Redis distributed KVS. + . + Nova is intended to be easy to extend, and adapt. For example, it + currently uses an LDAP server for users and groups, but also includes a + fake LDAP server, that stores data in Redis. It has extensive test + coverage, and uses the Sphinx toolkit (the same as Python itself) for code + and user documentation. + . + While Nova is currently in Beta use within several organizations, the + codebase is very much under active development. + . + This package provides the API frontend. Package: nova-objectstore Architecture: all Depends: nova-common (= ${binary:Version}), ${python:Depends}, ${misc:Depends} -Description: Nova object store +Description: Nova Cloud Computing - object store + Nova is a cloud computing fabric controller (the main part of an IaaS + system) built to match the popular AWS EC2 and S3 APIs. It is written in + Python, using the Tornado and Twisted frameworks, and relies on the + standard AMQP messaging protocol, and the Redis distributed KVS. + . + Nova is intended to be easy to extend, and adapt. For example, it + currently uses an LDAP server for users and groups, but also includes a + fake LDAP server, that stores data in Redis. It has extensive test + coverage, and uses the Sphinx toolkit (the same as Python itself) for code + and user documentation. + . + While Nova is currently in Beta use within several organizations, the + codebase is very much under active development. + . + This is the package you will install on the nodes that will contain your + object store. Package: nova-tools Architecture: all Depends: python-boto, ${python:Depends}, ${misc:Depends} -Description: CLI tools to access nova +Description: Nova Cloud Computing - management tools + Nova is a cloud computing fabric controller (the main part of an IaaS + system) built to match the popular AWS EC2 and S3 APIs. It is written in + Python, using the Tornado and Twisted frameworks, and relies on the + standard AMQP messaging protocol, and the Redis distributed KVS. + . + Nova is intended to be easy to extend, and adapt. For example, it + currently uses an LDAP server for users and groups, but also includes a + fake LDAP server, that stores data in Redis. It has extensive test + coverage, and uses the Sphinx toolkit (the same as Python itself) for code + and user documentation. + . + While Nova is currently in Beta use within several organizations, the + codebase is very much under active development. + . + This package contains admin tools for Nova. -- cgit From 00971feed32d22ae9bc63aea716ecf4e972aee32 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Wed, 30 Jun 2010 16:46:26 +0200 Subject: Replace spaces in x509 cert subject with underscores. It ends up getting split(' ')'ed and passed to subprocess.Popen, so it needs to not have spaces in it, otherwise openssl gets very upset. --- nova/auth/users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/auth/users.py b/nova/auth/users.py index 6997596aa..12c73ca27 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -481,7 +481,7 @@ class UserManager(object): def __cert_subject(self, uid): # FIXME(ja) - this should be pulled from a global configuration - return "/C=US/ST=California/L=Mountain View/O=Anso Labs/OU=Nova Dev/CN=%s-%s" % (uid, str(datetime.datetime.utcnow().isoformat())) + return "/C=US/ST=California/L=Mountain_View/O=Anso_Labs/OU=Nova_Dev/CN=%s-%s" % (uid, str(datetime.datetime.utcnow().isoformat())) class LDAPWrapper(object): -- cgit From 7ce77bfffca575e0136807779d98140280c7fa90 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Wed, 30 Jun 2010 16:46:47 +0200 Subject: Add _s instance attribute to Instance class. It's referenced in a bunch of places, but is never set. This is unlikely to be the right fix (why have two attributes pointing to the same object?), but it seems to make ends meet. --- nova/compute/node.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nova/compute/node.py b/nova/compute/node.py index c217056f5..b39a0fe9c 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -269,6 +269,7 @@ class Instance(object): data['project_id'] = data['owner_id'] self.datamodel = data + self._s = data size = data.get('instance_type', FLAGS.default_instance_type) if size not in INSTANCE_TYPES: raise exception.Error('invalid instance type: %s' % size) -- cgit From 3b916f690ce332ac15e1ec50d5e511ec6a9895ab Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Wed, 30 Jun 2010 16:47:12 +0200 Subject: Make sure get_assigned_vlans and BaseNetwork.hosts always return a dict, even if the key is currently empty in the KVS. --- nova/compute/network.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/compute/network.py b/nova/compute/network.py index 911d0344a..94fa6c47a 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -133,7 +133,7 @@ class BaseNetwork(datastore.RedisModel): @property def hosts(self): - return datastore.Redis.instance().hgetall(self._hosts_key) + return datastore.Redis.instance().hgetall(self._hosts_key) or {} def _add_host(self, _user_id, _project_id, host, target): datastore.Redis.instance().hset(self._hosts_key, host, target) @@ -392,7 +392,7 @@ def _rem_vlan(project_id): def get_assigned_vlans(): """ Returns a dictionary, with keys of project_id and values of vlan_id """ - return datastore.Redis.instance().hgetall(VLANS_KEY) + return datastore.Redis.instance().hgetall(VLANS_KEY) or {} def get_vlan_for_project(project_id): """ -- cgit From f322f02728136e19b2a6503861a312b7548dbc68 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Thu, 1 Jul 2010 13:14:08 +0200 Subject: Add curl as a dependency of nova-compute. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 65af8f0cc..c0b08ae8e 100644 --- a/debian/control +++ b/debian/control @@ -30,7 +30,7 @@ Description: Nova Cloud Computing - common files Package: nova-compute Architecture: all -Depends: nova-common (= ${binary:Version}), kpartx, kvm, python-libvirt, libvirt-bin (>= 0.7.5), ${python:Depends}, ${misc:Depends} +Depends: nova-common (= ${binary:Version}), kpartx, kvm, python-libvirt, libvirt-bin (>= 0.7.5), curl, ${python:Depends}, ${misc:Depends} Description: Nova Cloud Computing - compute node Nova is a cloud computing fabric controller (the main part of an IaaS system) built to match the popular AWS EC2 and S3 APIs. It is written in -- cgit From f8a19693b5d4172ce3207c63acf0209ed8b3d636 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 2 Jul 2010 10:38:15 -0500 Subject: clean a few merge errors from network --- nova/compute/network.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/nova/compute/network.py b/nova/compute/network.py index 911d0344a..2de8bea4d 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -98,27 +98,23 @@ class BaseNetwork(datastore.RedisModel): @property def network(self): return IPy.IP(self['network_str']) + @property def netmask(self): return self.network.netmask() + @property def gateway(self): return self.network[1] + @property def broadcast(self): return self.network.broadcast() - @property - def gateway(self): - return self.network[1] + @property def bridge_name(self): return "br%s" % (self["vlan"]) - def range(self): - # the .2 address is always CloudPipe - for idx in range(3, len(self.network)-2): - yield self.network[idx] - @property def user(self): return users.UserManager.instance().get_user(self['user_id']) -- cgit From 95e7571a597abdafc638747e2d28c725df96bb17 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 2 Jul 2010 10:39:04 -0500 Subject: Simple Network avoids vlans --- nova/compute/network.py | 21 +++++++++++++++++++++ nova/compute/node.py | 9 +++++---- nova/endpoint/cloud.py | 24 ++++++++++++++++++------ 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/nova/compute/network.py b/nova/compute/network.py index 2de8bea4d..ce156967e 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -58,6 +58,13 @@ flags.DEFINE_integer('cnt_vpn_clients', 5, flags.DEFINE_integer('cloudpipe_start_port', 12000, 'Starting port for mapped CloudPipe external ports') +flags.DEFINE_boolean('simple_network', False, + 'Use simple networking instead of vlans') +flags.DEFINE_string('simple_network_bridge', 'br100', + 'Bridge for instances') +flags.DEFINE_list('simple_network_ips', ['192.168.1.1'], + 'Available ips for network') + logging.getLogger().setLevel(logging.DEBUG) # CLEANUP: @@ -418,6 +425,20 @@ def get_network_by_address(address): return net raise exception.AddressNotAllocated() +def allocate_simple_ip(): + redis = datastore.Redis.instance() + if not redis.exists('ips') and not len(redis.keys('instances:*')): + for address in FLAGS.simple_network_ips: + redis.sadd('ips', address) + address = redis.spop('ips') + if not address: + raise exception.NoMoreAddresses() + return address + +def deallocate_simple_ip(address): + datastore.Redis.instance().sadd('ips', address) + + def allocate_vpn_ip(user_id, project_id, mac): return get_project_network(project_id).allocate_vpn_ip(mac) diff --git a/nova/compute/node.py b/nova/compute/node.py index 65eb4bf3e..1b4714d67 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -57,7 +57,7 @@ from nova.objectstore import image # for image_path flag FLAGS = flags.FLAGS flags.DEFINE_string('libvirt_xml_template', utils.abspath('compute/libvirt.xml.template'), - 'Network XML Template') + 'Libvirt XML Template') flags.DEFINE_bool('use_s3', True, 'whether to get images from s3 or use local copy') flags.DEFINE_string('instances_path', utils.abspath('../instances'), @@ -151,9 +151,10 @@ class Node(object, service.Service): """ launch a new instance with specified options """ logging.debug("Starting instance %s..." % (instance_id)) inst = self.instdir.get(instance_id) - # TODO: Get the real security group of launch in here - security_group = "default" - net = network.BridgedNetwork.get_network_for_project(inst['user_id'], + if not FLAGS.simple_network: + # TODO: Get the real security group of launch in here + security_group = "default" + net = network.BridgedNetwork.get_network_for_project(inst['user_id'], inst['project_id'], security_group).express() inst['node_name'] = FLAGS.node_name diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 931c6c6e1..50c087f2d 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -516,7 +516,12 @@ class CloudController(object): key_data = key_pair.public_key # TODO: Get the real security group of launch in here security_group = "default" - bridge_name = network.BridgedNetwork.get_network_for_project(context.user.id, context.project.id, security_group)['bridge_name'] + if FLAGS.simple_network: + bridge_name = FLAGS.simple_network_bridge + else: + net = network.BridgedNetwork.get_network_for_project( + context.user.id, context.project.id, security_group) + bridge_name = net['bridge_name'] for num in range(int(kwargs['max_count'])): inst = self.instdir.new() # TODO(ja): add ari, aki @@ -532,12 +537,19 @@ class CloudController(object): inst['mac_address'] = utils.generate_mac() inst['ami_launch_index'] = num inst['bridge_name'] = bridge_name - if inst['image_id'] == FLAGS.vpn_image_id: - address = network.allocate_vpn_ip( - inst['user_id'], inst['project_id'], mac=inst['mac_address']) + if FLAGS.simple_network: + network.allocate_simple_ip(mac=inst['mac_address']) else: - address = network.allocate_ip( - inst['user_id'], inst['project_id'], mac=inst['mac_address']) + if inst['image_id'] == FLAGS.vpn_image_id: + address = network.allocate_vpn_ip( + inst['user_id'], + inst['project_id'], + mac=inst['mac_address']) + else: + address = network.allocate_ip( + inst['user_id'], + inst['project_id'], + mac=inst['mac_address']) inst['private_dns_name'] = str(address) # TODO: allocate expresses on the router node inst.save() -- cgit From 04b7b42bde70c53e251f795a1d71cd7cd341b5dc Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 2 Jul 2010 10:39:04 -0500 Subject: Simple network injection --- nova/compute/disk.py | 23 +++++++++++++++++------ nova/compute/network.py | 19 ++++++++++++++++--- nova/compute/node.py | 23 +++++++++++++++++------ 3 files changed, 50 insertions(+), 15 deletions(-) diff --git a/nova/compute/disk.py b/nova/compute/disk.py index bd6a010ee..3f528de61 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -87,12 +87,14 @@ def partition(infile, outfile, local_bytes=0, local_type='ext2', execute=None): % (infile, outfile, sector_size, primary_first)) @defer.inlineCallbacks -def inject_key(key, image, partition=None, execute=None): - """Injects a ssh key into a disk image. - It adds the specified key to /root/.ssh/authorized_keys +def inject_data(image, key=None, net=None, partition=None, execute=None): + """Injects a ssh key and optionally net data into a disk image. + it will mount the image as a fully partitioned disk and attempt to inject into the specified partition number. + If partition is not specified it mounts the image as a single partition. + """ out, err = yield execute('sudo losetup -f --show %s' % image) if err: @@ -119,8 +121,11 @@ def inject_key(key, image, partition=None, execute=None): raise exception.Error('Failed to mount filesystem: %s' % err) try: - # inject key file - yield _inject_into_fs(key, tmpdir, execute=execute) + if key: + # inject key file + yield _inject_key_into_fs(key, tmpdir, execute=execute) + if net: + yield _inject_net_into_fs(net, tmpdir) finally: # unmount device yield execute('sudo umount %s' % mapped_device) @@ -136,7 +141,7 @@ def inject_key(key, image, partition=None, execute=None): yield execute('sudo losetup -d %s' % device) @defer.inlineCallbacks -def _inject_into_fs(key, fs, execute=None): +def _inject_key_into_fs(key, fs, execute=None): sshdir = os.path.join(os.path.join(fs, 'root'), '.ssh') yield execute('sudo mkdir -p %s' % sshdir) # existing dir doesn't matter yield execute('sudo chown root %s' % sshdir) @@ -144,3 +149,9 @@ def _inject_into_fs(key, fs, execute=None): keyfile = os.path.join(sshdir, 'authorized_keys') yield execute('sudo tee -a %s' % keyfile, '\n' + key.strip() + '\n') +@defer.inlineCallbacks +def _inject_net_into_fs(net, fs, execute=None): + netfile = os.path.join(os.path.join(os.path.join( + fs, 'etc'), 'network'), 'interfaces') + yield execute('sudo tee %s' % netfile, net) + diff --git a/nova/compute/network.py b/nova/compute/network.py index ce156967e..5223e59da 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -61,9 +61,22 @@ flags.DEFINE_integer('cloudpipe_start_port', 12000, flags.DEFINE_boolean('simple_network', False, 'Use simple networking instead of vlans') flags.DEFINE_string('simple_network_bridge', 'br100', - 'Bridge for instances') -flags.DEFINE_list('simple_network_ips', ['192.168.1.1'], - 'Available ips for network') + 'Bridge for simple network instances') +flags.DEFINE_list('simple_network_ips', ['192.168.0.2'], + 'Available ips for simple network') +flags.DEFINE_string('simple_network_template', + utils.abspath('compute/interfaces.template'), + 'Template file for simple network') +flags.DEFINE_string('simple_network_netmask', '255.255.255.0', + 'Netmask for simple network') +flags.DEFINE_string('simple_network_network', '192.168.0.0', + 'Network for simple network') +flags.DEFINE_string('simple_network_gateway', '192.168.0.1', + 'Broadcast for simple network') +flags.DEFINE_string('simple_network_broadcast', '192.168.0.255', + 'Broadcast for simple network') +flags.DEFINE_string('simple_network_dns', '8.8.8.8', + 'Dns for simple network') logging.getLogger().setLevel(logging.DEBUG) diff --git a/nova/compute/node.py b/nova/compute/node.py index 1b4714d67..e1503683e 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -483,12 +483,23 @@ class Instance(object): if not os.path.exists(basepath('ramdisk')): yield _fetch_file(data['ramdisk_id'], basepath('ramdisk')) - execute = lambda cmd, input=None: self._pool.simpleExecute(cmd=cmd, input=input, error_ok=1) - - if data['key_data']: - logging.info('Injecting key data into image %s', data['image_id']) - yield disk.inject_key( - data['key_data'], basepath('disk-raw'), execute=execute) + execute = lambda cmd, input=None: self._pool.simpleExecute(cmd=cmd, + input=input, + error_ok=1) + + key = data['key_data'] + net = None + if FLAGS.simple_network: + with open(FLAGS.simple_network_template) as f: + net = f.read() % {'address': data['private_dns_name'], + 'network': FLAGS.simple_network_network, + 'netmask': FLAGS.simple_network_netmask, + 'gateway': FLAGS.simple_network_gateway, + 'broadcast': FLAGS.simple_network_broadcast, + 'dns': FLAGS.simple_network_dns} + if key or net: + logging.info('Injecting data into image %s', data['image_id']) + yield disk.inject_data(basepath('disk-raw'), key, net, execute=execute) if os.path.exists(basepath('disk')): yield self._pool.simpleExecute('rm -f %s' % basepath('disk')) -- cgit From 45c192aee681eb684599ac2cacd9c38996ca2bb5 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 2 Jul 2010 10:39:04 -0500 Subject: Fixes and add interface template --- nova/compute/disk.py | 2 +- nova/compute/interfaces.template | 18 ++++++++++++++++++ nova/compute/network.py | 2 +- nova/endpoint/cloud.py | 13 ++++++++----- 4 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 nova/compute/interfaces.template diff --git a/nova/compute/disk.py b/nova/compute/disk.py index 3f528de61..3cf06e0eb 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -125,7 +125,7 @@ def inject_data(image, key=None, net=None, partition=None, execute=None): # inject key file yield _inject_key_into_fs(key, tmpdir, execute=execute) if net: - yield _inject_net_into_fs(net, tmpdir) + yield _inject_net_into_fs(net, tmpdir, execute=execute) finally: # unmount device yield execute('sudo umount %s' % mapped_device) diff --git a/nova/compute/interfaces.template b/nova/compute/interfaces.template new file mode 100644 index 000000000..11df301f6 --- /dev/null +++ b/nova/compute/interfaces.template @@ -0,0 +1,18 @@ +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +# The loopback network interface +auto lo +iface lo inet loopback + +# The primary network interface +auto eth0 +iface eth0 inet static + address %(address)s + netmask %(netmask)s + network %(network)s + broadcast %(broadcast)s + gateway %(gateway)s + dns-nameservers %(dns)s + + diff --git a/nova/compute/network.py b/nova/compute/network.py index 5223e59da..1cb202ea9 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -75,7 +75,7 @@ flags.DEFINE_string('simple_network_gateway', '192.168.0.1', 'Broadcast for simple network') flags.DEFINE_string('simple_network_broadcast', '192.168.0.255', 'Broadcast for simple network') -flags.DEFINE_string('simple_network_dns', '8.8.8.8', +flags.DEFINE_string('simple_network_dns', '8.8.4.4', 'Dns for simple network') logging.getLogger().setLevel(logging.DEBUG) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 50c087f2d..960c1e9af 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -538,7 +538,7 @@ class CloudController(object): inst['ami_launch_index'] = num inst['bridge_name'] = bridge_name if FLAGS.simple_network: - network.allocate_simple_ip(mac=inst['mac_address']) + address = network.allocate_simple_ip() else: if inst['image_id'] == FLAGS.vpn_image_id: address = network.allocate_vpn_ip( @@ -579,10 +579,13 @@ class CloudController(object): pass if instance.get('private_dns_name', None): logging.debug("Deallocating address %s" % instance.get('private_dns_name', None)) - try: - self.network.deallocate_ip(instance.get('private_dns_name', None)) - except Exception, _err: - pass + if FLAGS.simple_network: + network.deallocate_simple_ip(instance.get('private_dns_name', None)) + else: + try: + self.network.deallocate_ip(instance.get('private_dns_name', None)) + except Exception, _err: + pass if instance.get('node_name', 'unassigned') != 'unassigned': #It's also internal default rpc.cast('%s.%s' % (FLAGS.compute_topic, instance['node_name']), {"method": "terminate_instance", -- cgit From ecae60acde6853b1c49f0fbaca6ca7e8c1412b29 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 5 Jul 2010 12:45:35 +0200 Subject: Set better defaults in flagfiles. --- debian/nova-api.conf | 4 +++- debian/nova-compute.conf | 4 +++- debian/nova-objectstore.conf | 4 +++- debian/nova-volume.conf | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/debian/nova-api.conf b/debian/nova-api.conf index 62bfd016d..4bf25fc75 100644 --- a/debian/nova-api.conf +++ b/debian/nova-api.conf @@ -1,3 +1,5 @@ --daemonize=1 ---ca_path=/usr/share/nova/CA +--ca_path=/var/lib/nova/CA +--keys_path=/var/lib/nova/keys --fake_users=1 +--keeper_path=/var/lib/nova/keeper diff --git a/debian/nova-compute.conf b/debian/nova-compute.conf index 62bfd016d..61ab4ceb0 100644 --- a/debian/nova-compute.conf +++ b/debian/nova-compute.conf @@ -1,3 +1,5 @@ --daemonize=1 ---ca_path=/usr/share/nova/CA +--ca_path=/var/lib/nova/CA +--keys_path=/var/lib/nova/keys +--keeper_path=/var/lib/nova/keeper --fake_users=1 diff --git a/debian/nova-objectstore.conf b/debian/nova-objectstore.conf index 4b74efe0e..7c3b633b1 100644 --- a/debian/nova-objectstore.conf +++ b/debian/nova-objectstore.conf @@ -1,5 +1,7 @@ --daemonize=1 ---ca_path=/usr/share/nova/CA +--ca_path=/var/lib/nova/CA +--keys_path=/var/lib/nova/keys +--keeper_path=/var/lib/nova/keeper --fake_users=1 --images_path=/var/lib/nova/images --buckets_path=/var/lib/nova/buckets diff --git a/debian/nova-volume.conf b/debian/nova-volume.conf index 4b74efe0e..7c3b633b1 100644 --- a/debian/nova-volume.conf +++ b/debian/nova-volume.conf @@ -1,5 +1,7 @@ --daemonize=1 ---ca_path=/usr/share/nova/CA +--ca_path=/var/lib/nova/CA +--keys_path=/var/lib/nova/keys +--keeper_path=/var/lib/nova/keeper --fake_users=1 --images_path=/var/lib/nova/images --buckets_path=/var/lib/nova/buckets -- cgit From baea119aefe8e939eb5796b17fab29f5ae283449 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 5 Jul 2010 12:46:26 +0200 Subject: Use rmdir instead of rm -rf to remove a tempdir. --- nova/compute/disk.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nova/compute/disk.py b/nova/compute/disk.py index e7090dad3..f4d75a781 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -126,8 +126,7 @@ def inject_key(key, image, partition=None, execute=None): yield execute('sudo umount %s' % mapped_device) finally: # remove temporary directory - # TODO(termie): scary, is there any thing we can check here? - yield execute('rm -rf %s' % tmpdir) + yield execute('rmdir %s' % tmpdir) if not partition is None: # remove partitions yield execute('sudo kpartx -d %s' % device) -- cgit From 6f92a690a8728ed690c5220b6a745919ff4605ec Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 5 Jul 2010 13:19:34 +0200 Subject: releasing version 0.3.0+really0.2.2-0ubuntu0ppa1 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 789dad36d..d13bb231f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nova (0.3.0+really0.2.2-0ubuntu0ppa1) lucid; urgency=low + + * Upload to PPA. + + -- Soren Hansen Mon, 05 Jul 2010 12:47:43 +0200 + nova (0.2.2-6) UNRELEASED; urgency=low * Fix to make Key Injection work again -- cgit From fe2da208c24ec2cec0f1209729ce42a6cab315c2 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 5 Jul 2010 13:20:13 +0200 Subject: Added --network_path setting to nova-compute's flagfile. --- debian/changelog | 6 ++++++ debian/nova-compute.conf | 1 + 2 files changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index d13bb231f..90fe64a8c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nova (0.3.0+really0.2.2-0ubuntu0ppa1ubuntu1) UNRELEASED; urgency=low + + * Added --network_path setting to nova-compute's flagfile. + + -- Soren Hansen Mon, 05 Jul 2010 13:20:11 +0200 + nova (0.3.0+really0.2.2-0ubuntu0ppa1) lucid; urgency=low * Upload to PPA. diff --git a/debian/nova-compute.conf b/debian/nova-compute.conf index 61ab4ceb0..2c118114d 100644 --- a/debian/nova-compute.conf +++ b/debian/nova-compute.conf @@ -2,4 +2,5 @@ --ca_path=/var/lib/nova/CA --keys_path=/var/lib/nova/keys --keeper_path=/var/lib/nova/keeper +--networks_path=/var/lib/nova/networks --fake_users=1 -- cgit From 249910ed23062463ea8346956848bcc54a4d740d Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 5 Jul 2010 13:34:44 +0200 Subject: Move templates from python directories to /usr/share/nova. --- debian/changelog | 1 + debian/nova-common.install | 6 +++--- debian/nova-compute.conf | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 90fe64a8c..c5756920f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ nova (0.3.0+really0.2.2-0ubuntu0ppa1ubuntu1) UNRELEASED; urgency=low * Added --network_path setting to nova-compute's flagfile. + * Move templates from python directories to /usr/share/nova. -- Soren Hansen Mon, 05 Jul 2010 13:20:11 +0200 diff --git a/debian/nova-common.install b/debian/nova-common.install index ab7455314..acb1741e7 100644 --- a/debian/nova-common.install +++ b/debian/nova-common.install @@ -1,5 +1,5 @@ bin/nova-manage usr/bin -nova/auth/novarc.template usr/lib/pymodules/python2.6/nova/auth -nova/cloudpipe/client.ovpn.template usr/lib/pymodules/python2.6/nova/cloudpipe -nova/compute/libvirt.xml.template usr/lib/pymodules/python2.6/nova/compute +nova/auth/novarc.template usr/share/nova +nova/cloudpipe/client.ovpn.template usr/share/nova +nova/compute/libvirt.xml.template usr/share/nova usr/lib/python*/*-packages/nova/* diff --git a/debian/nova-compute.conf b/debian/nova-compute.conf index 2c118114d..eaa48e2e1 100644 --- a/debian/nova-compute.conf +++ b/debian/nova-compute.conf @@ -3,4 +3,7 @@ --keys_path=/var/lib/nova/keys --keeper_path=/var/lib/nova/keeper --networks_path=/var/lib/nova/networks +--libvirt_xml_template=/usr/share/nova/libvirt.xml.template +--vpn_client_template=/usr/share/nova/client.ovpn.template +--credentials_template=/usr/share/nova/novarc.template --fake_users=1 -- cgit From 3675c47d0874c9da4d0318e1dd158708af597255 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 5 Jul 2010 13:35:16 +0200 Subject: Fixed package version. --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index c5756920f..6ef85196b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -nova (0.3.0+really0.2.2-0ubuntu0ppa1ubuntu1) UNRELEASED; urgency=low +nova (0.3.0+really0.2.2-0ubuntu0ppa2) UNRELEASED; urgency=low * Added --network_path setting to nova-compute's flagfile. * Move templates from python directories to /usr/share/nova. -- cgit From b989170b398fbb73512a9be376196495cf4a086b Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 5 Jul 2010 15:37:52 +0200 Subject: keeper_path is really caled datastore_path. --- debian/nova-api.conf | 2 +- debian/nova-compute.conf | 2 +- debian/nova-objectstore.conf | 2 +- debian/nova-volume.conf | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/nova-api.conf b/debian/nova-api.conf index 4bf25fc75..9cd4051b1 100644 --- a/debian/nova-api.conf +++ b/debian/nova-api.conf @@ -2,4 +2,4 @@ --ca_path=/var/lib/nova/CA --keys_path=/var/lib/nova/keys --fake_users=1 ---keeper_path=/var/lib/nova/keeper +--datastore_path=/var/lib/nova/keeper diff --git a/debian/nova-compute.conf b/debian/nova-compute.conf index eaa48e2e1..6eb0bc121 100644 --- a/debian/nova-compute.conf +++ b/debian/nova-compute.conf @@ -1,7 +1,7 @@ --daemonize=1 --ca_path=/var/lib/nova/CA --keys_path=/var/lib/nova/keys ---keeper_path=/var/lib/nova/keeper +--datastore_path=/var/lib/nova/keeper --networks_path=/var/lib/nova/networks --libvirt_xml_template=/usr/share/nova/libvirt.xml.template --vpn_client_template=/usr/share/nova/client.ovpn.template diff --git a/debian/nova-objectstore.conf b/debian/nova-objectstore.conf index 7c3b633b1..af3271d3b 100644 --- a/debian/nova-objectstore.conf +++ b/debian/nova-objectstore.conf @@ -1,7 +1,7 @@ --daemonize=1 --ca_path=/var/lib/nova/CA --keys_path=/var/lib/nova/keys ---keeper_path=/var/lib/nova/keeper +--datastore_path=/var/lib/nova/keeper --fake_users=1 --images_path=/var/lib/nova/images --buckets_path=/var/lib/nova/buckets diff --git a/debian/nova-volume.conf b/debian/nova-volume.conf index 7c3b633b1..af3271d3b 100644 --- a/debian/nova-volume.conf +++ b/debian/nova-volume.conf @@ -1,7 +1,7 @@ --daemonize=1 --ca_path=/var/lib/nova/CA --keys_path=/var/lib/nova/keys ---keeper_path=/var/lib/nova/keeper +--datastore_path=/var/lib/nova/keeper --fake_users=1 --images_path=/var/lib/nova/images --buckets_path=/var/lib/nova/buckets -- cgit From f49dfd507a48a1617822ba8543408fa8ad18a21e Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 5 Jul 2010 21:49:39 +0200 Subject: Add debian/nova-common.dirs to create var/lib/nova/{buckets,CA,images,instances,keys,networks} --- debian/changelog | 2 ++ debian/nova-common.dirs | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 debian/nova-common.dirs diff --git a/debian/changelog b/debian/changelog index 6ef85196b..e86d654df 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ nova (0.3.0+really0.2.2-0ubuntu0ppa2) UNRELEASED; urgency=low * Added --network_path setting to nova-compute's flagfile. * Move templates from python directories to /usr/share/nova. + * Add debian/nova-common.dirs to create + var/lib/nova/{buckets,CA,images,instances,keys,networks} -- Soren Hansen Mon, 05 Jul 2010 13:20:11 +0200 diff --git a/debian/nova-common.dirs b/debian/nova-common.dirs new file mode 100644 index 000000000..3c645d891 --- /dev/null +++ b/debian/nova-common.dirs @@ -0,0 +1,6 @@ +var/lib/nova/buckets +var/lib/nova/CA +var/lib/nova/images +var/lib/nova/instances +var/lib/nova/keys +var/lib/nova/networks -- cgit From 497e8dcde780d668f311e18817f11a0d15b735d2 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 5 Jul 2010 22:03:13 +0200 Subject: Don't pass --daemonize=1 to nova-compute. It's already daemonising by default. --- debian/changelog | 2 ++ debian/nova-compute.conf | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e86d654df..129630990 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ nova (0.3.0+really0.2.2-0ubuntu0ppa2) UNRELEASED; urgency=low * Move templates from python directories to /usr/share/nova. * Add debian/nova-common.dirs to create var/lib/nova/{buckets,CA,images,instances,keys,networks} + * Don't pass --daemonize=1 to nova-compute. It's already daemonising + by default. -- Soren Hansen Mon, 05 Jul 2010 13:20:11 +0200 diff --git a/debian/nova-compute.conf b/debian/nova-compute.conf index 6eb0bc121..7fcac74b5 100644 --- a/debian/nova-compute.conf +++ b/debian/nova-compute.conf @@ -1,4 +1,3 @@ ---daemonize=1 --ca_path=/var/lib/nova/CA --keys_path=/var/lib/nova/keys --datastore_path=/var/lib/nova/keeper -- cgit From ee8ed818c182e4a34864aa4a9339c6f7a046063e Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 5 Jul 2010 22:07:41 +0200 Subject: releasing version 0.3.0+really0.2.2-0ubuntu0ppa2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 129630990..9518cc23c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -nova (0.3.0+really0.2.2-0ubuntu0ppa2) UNRELEASED; urgency=low +nova (0.3.0+really0.2.2-0ubuntu0ppa2) lucid; urgency=low * Added --network_path setting to nova-compute's flagfile. * Move templates from python directories to /usr/share/nova. @@ -7,7 +7,7 @@ nova (0.3.0+really0.2.2-0ubuntu0ppa2) UNRELEASED; urgency=low * Don't pass --daemonize=1 to nova-compute. It's already daemonising by default. - -- Soren Hansen Mon, 05 Jul 2010 13:20:11 +0200 + -- Soren Hansen Mon, 05 Jul 2010 22:06:54 +0200 nova (0.3.0+really0.2.2-0ubuntu0ppa1) lucid; urgency=low -- cgit From b9522da2bd64fb15c86e46c47ac37f345fa2c73d Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 6 Jul 2010 13:34:08 +0200 Subject: Add a dependency on nginx from nova-objectsstore and install a suitable configuration file. --- debian/changelog | 7 +++++++ debian/control | 2 +- debian/nova-objectstore.install | 1 + debian/nova-objectstore.links | 1 + debian/nova-objectstore.nginx.conf | 17 +++++++++++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 debian/nova-objectstore.links create mode 100644 debian/nova-objectstore.nginx.conf diff --git a/debian/changelog b/debian/changelog index 9518cc23c..8c7f68d16 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nova (0.3.0+really0.2.2-0ubuntu0ppa3) UNRELEASED; urgency=low + + * Add a dependency on nginx from nova-objectsstore and install a + suitable configuration file. + + -- Soren Hansen Tue, 06 Jul 2010 13:33:44 +0200 + nova (0.3.0+really0.2.2-0ubuntu0ppa2) lucid; urgency=low * Added --network_path setting to nova-compute's flagfile. diff --git a/debian/control b/debian/control index c0b08ae8e..3bfceaa2a 100644 --- a/debian/control +++ b/debian/control @@ -91,7 +91,7 @@ Description: Nova Cloud Computing - API frontend Package: nova-objectstore Architecture: all -Depends: nova-common (= ${binary:Version}), ${python:Depends}, ${misc:Depends} +Depends: nova-common (= ${binary:Version}), nginx, ${python:Depends}, ${misc:Depends} Description: Nova Cloud Computing - object store Nova is a cloud computing fabric controller (the main part of an IaaS system) built to match the popular AWS EC2 and S3 APIs. It is written in diff --git a/debian/nova-objectstore.install b/debian/nova-objectstore.install index 14a6dd37f..590fcc01b 100644 --- a/debian/nova-objectstore.install +++ b/debian/nova-objectstore.install @@ -1,2 +1,3 @@ bin/nova-objectstore usr/bin debian/nova-objectstore.conf etc +debian/nova-objectstore.nginx.conf etc/nginx/sites-available diff --git a/debian/nova-objectstore.links b/debian/nova-objectstore.links new file mode 100644 index 000000000..38e33948e --- /dev/null +++ b/debian/nova-objectstore.links @@ -0,0 +1 @@ +/etc/nginx/sites-available/nova-objectstore.nginx.conf /etc/nginx/sites-enabled/nova-objectstore.nginx.conf diff --git a/debian/nova-objectstore.nginx.conf b/debian/nova-objectstore.nginx.conf new file mode 100644 index 000000000..b63424150 --- /dev/null +++ b/debian/nova-objectstore.nginx.conf @@ -0,0 +1,17 @@ +server { + listen 3333 default; + server_name localhost; + client_max_body_size 10m; + + access_log /var/log/nginx/localhost.access.log; + + location ~ /_images/.+ { + root /var/lib/nova/images; + rewrite ^/_images/(.*)$ /$1 break; + } + + location / { + proxy_pass http://localhost:3334/; + } +} + -- cgit From fa529458f64a3a97a26b49cf7f9dab1fad8acf0b Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 6 Jul 2010 14:06:55 +0200 Subject: Ship the CA directory in nova-common. --- debian/changelog | 1 + debian/nova-common.dirs | 4 ++++ debian/nova-common.install | 3 +++ 3 files changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index 8c7f68d16..d90a15ac7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ nova (0.3.0+really0.2.2-0ubuntu0ppa3) UNRELEASED; urgency=low * Add a dependency on nginx from nova-objectsstore and install a suitable configuration file. + * Ship the CA directory in nova-common. -- Soren Hansen Tue, 06 Jul 2010 13:33:44 +0200 diff --git a/debian/nova-common.dirs b/debian/nova-common.dirs index 3c645d891..01443c4fd 100644 --- a/debian/nova-common.dirs +++ b/debian/nova-common.dirs @@ -1,5 +1,9 @@ var/lib/nova/buckets var/lib/nova/CA +var/lib/nova/CA/INTER +var/lib/nova/CA/newcerts +var/lib/nova/CA/private +var/lib/nova/CA/reqs var/lib/nova/images var/lib/nova/instances var/lib/nova/keys diff --git a/debian/nova-common.install b/debian/nova-common.install index acb1741e7..da0ac65ab 100644 --- a/debian/nova-common.install +++ b/debian/nova-common.install @@ -3,3 +3,6 @@ nova/auth/novarc.template usr/share/nova nova/cloudpipe/client.ovpn.template usr/share/nova nova/compute/libvirt.xml.template usr/share/nova usr/lib/python*/*-packages/nova/* +CA/openssl.cnf.tmpl var/lib/nova/CA +CA/geninter.sh var/lib/nova/CA +CA/genrootca.sh var/lib/nova/CA -- cgit From ccd01c6975070ad67e895e805c1a2048440b5f70 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 6 Jul 2010 17:34:43 +0200 Subject: Add a default flag file for nova-manage to help it find the CA. --- bin/nova-manage | 2 +- debian/changelog | 1 + debian/nova-common.install | 1 + debian/nova-manage.conf | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 debian/nova-manage.conf diff --git a/bin/nova-manage b/bin/nova-manage index f418e162b..cb987f330 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -218,7 +218,7 @@ def methods_of(obj): if __name__ == '__main__': - utils.default_flagfile() + utils.default_flagfile('/etc/nova-manage.conf') argv = FLAGS(sys.argv) script_name = argv.pop(0) if len(argv) < 1: diff --git a/debian/changelog b/debian/changelog index d90a15ac7..6b2500167 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ nova (0.3.0+really0.2.2-0ubuntu0ppa3) UNRELEASED; urgency=low * Add a dependency on nginx from nova-objectsstore and install a suitable configuration file. * Ship the CA directory in nova-common. + * Add a default flag file for nova-manage to help it find the CA. -- Soren Hansen Tue, 06 Jul 2010 13:33:44 +0200 diff --git a/debian/nova-common.install b/debian/nova-common.install index da0ac65ab..f3d554041 100644 --- a/debian/nova-common.install +++ b/debian/nova-common.install @@ -1,4 +1,5 @@ bin/nova-manage usr/bin +debian/nova-manage.conf etc nova/auth/novarc.template usr/share/nova nova/cloudpipe/client.ovpn.template usr/share/nova nova/compute/libvirt.xml.template usr/share/nova diff --git a/debian/nova-manage.conf b/debian/nova-manage.conf new file mode 100644 index 000000000..5ccda7ecf --- /dev/null +++ b/debian/nova-manage.conf @@ -0,0 +1,4 @@ +--ca_path=/var/lib/nova/CA +--credentials_template=/usr/share/nova/novarc.template +--keys_path=/var/lib/nova/keys +--vpn_client_template=/usr/share/nova/client.ovpn.template -- cgit From 6e77201cbab22d0c4b383b245d5957946a229e4c Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 6 Jul 2010 17:35:33 +0200 Subject: If set, pass KernelId and RamdiskId from RunInstances call to the target compute node. --- debian/changelog | 2 ++ nova/endpoint/cloud.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 6b2500167..5fb7c878e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ nova (0.3.0+really0.2.2-0ubuntu0ppa3) UNRELEASED; urgency=low suitable configuration file. * Ship the CA directory in nova-common. * Add a default flag file for nova-manage to help it find the CA. + * If set, pass KernelId and RamdiskId from RunInstances call to the + target compute node. -- Soren Hansen Tue, 06 Jul 2010 13:33:44 +0200 diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 39b3fd628..7b2d23e37 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -498,6 +498,10 @@ class CloudController(object): inst = self.instdir.new() # TODO(ja): add ari, aki inst['image_id'] = kwargs['image_id'] + if 'kernel_id' in kwargs: + inst['kernel_id'] = kwargs['kernel_id'] + if 'ramdisk_id' in kwargs: + inst['ramdisk_id'] = kwargs['ramdisk_id'] inst['user_data'] = kwargs.get('user_data', '') inst['instance_type'] = kwargs.get('instance_type', 'm1.small') inst['reservation_id'] = reservation_id -- cgit From 0ed127010775afce3ccd6b97d13ee7cad09722dc Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 6 Jul 2010 17:49:05 +0200 Subject: releasing version 0.3.0+really0.2.2-0ubuntu0ppa3 --- debian/changelog | 4 ++-- debian/nova-compute.conf | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5fb7c878e..3d14ca7c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -nova (0.3.0+really0.2.2-0ubuntu0ppa3) UNRELEASED; urgency=low +nova (0.3.0+really0.2.2-0ubuntu0ppa3) lucid; urgency=low * Add a dependency on nginx from nova-objectsstore and install a suitable configuration file. @@ -7,7 +7,7 @@ nova (0.3.0+really0.2.2-0ubuntu0ppa3) UNRELEASED; urgency=low * If set, pass KernelId and RamdiskId from RunInstances call to the target compute node. - -- Soren Hansen Tue, 06 Jul 2010 13:33:44 +0200 + -- Soren Hansen Tue, 06 Jul 2010 17:47:38 +0200 nova (0.3.0+really0.2.2-0ubuntu0ppa2) lucid; urgency=low diff --git a/debian/nova-compute.conf b/debian/nova-compute.conf index 7fcac74b5..5cd3f31ff 100644 --- a/debian/nova-compute.conf +++ b/debian/nova-compute.conf @@ -1,6 +1,7 @@ --ca_path=/var/lib/nova/CA --keys_path=/var/lib/nova/keys --datastore_path=/var/lib/nova/keeper +--instances_path=/var/lib/nova/instances --networks_path=/var/lib/nova/networks --libvirt_xml_template=/usr/share/nova/libvirt.xml.template --vpn_client_template=/usr/share/nova/client.ovpn.template -- cgit From 0a252e2009fb770fb34d90322665bc41326a8caa Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 6 Jul 2010 22:28:55 +0200 Subject: Relax the Twisted dependency to python-twisted-core (rather than the full stack). --- debian/changelog | 7 +++++++ debian/control | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 3d14ca7c1..f78e8c13c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nova (0.3.0+really0.2.2-0ubuntu0ppa4) UNRELEASED; urgency=low + + * Relax the Twisted dependency to python-twisted-core (rather than the + full stack). + + -- Soren Hansen Tue, 06 Jul 2010 22:28:28 +0200 + nova (0.3.0+really0.2.2-0ubuntu0ppa3) lucid; urgency=low * Add a dependency on nginx from nova-objectsstore and install a diff --git a/debian/control b/debian/control index 3bfceaa2a..61f8cade7 100644 --- a/debian/control +++ b/debian/control @@ -9,7 +9,7 @@ XS-Python-Version: 2.6 Package: nova-common Architecture: all -Depends: ${python:Depends}, aoetools, vlan, python-ipy, python-boto, python-m2crypto, python-pycurl, python-twisted, python-daemon, python-redis, python-carrot, python-lockfile, python-gflags, python-tornado, ${misc:Depends} +Depends: ${python:Depends}, aoetools, vlan, python-ipy, python-boto, python-m2crypto, python-pycurl, python-twisted-core, python-daemon, python-redis, python-carrot, python-lockfile, python-gflags, python-tornado, ${misc:Depends} Provides: ${python:Provides} Description: Nova Cloud Computing - common files Nova is a cloud computing fabric controller (the main part of an IaaS -- cgit From b7ea2f70581f6acd927ea7b65adaffeeb4b8d2ba Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 7 Jul 2010 12:06:34 -0700 Subject: Capture signals from dnsmasq and use them to update network state. --- bin/dhcpleasor.py | 68 ++++++++++++++++++++++++++++++++++++++++++ nova/compute/linux_net.py | 9 +++++- nova/compute/network.py | 14 +++++++-- nova/tests/fake_flags.py | 2 +- nova/tests/network_unittest.py | 34 +++++++++++++++++++++ nova/utils.py | 10 +++++-- 6 files changed, 129 insertions(+), 8 deletions(-) create mode 100755 bin/dhcpleasor.py diff --git a/bin/dhcpleasor.py b/bin/dhcpleasor.py new file mode 100755 index 000000000..07e63884f --- /dev/null +++ b/bin/dhcpleasor.py @@ -0,0 +1,68 @@ +#!/opt/local/bin/python + +# Copyright [2010] [Anso Labs, LLC] +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +dhcpleasor.py + +Handle lease database updates from DHCP servers. +""" + +import sys +import os +import logging +sys.path.append(os.path.abspath(os.path.join(__file__, "../../"))) + +logging.debug(sys.path) +import getopt +from os import environ +from nova.compute import network +from nova import flags +FLAGS = flags.FLAGS + + +def add_lease(mac, ip, hostname, interface): + pass + +def old_lease(mac, ip, hostname, interface): + pass + +def del_lease(mac, ip, hostname, interface): + # TODO - get net from interface instead + net = network.get_network_by_address(ip) + net.release_ip(ip) + +def init_leases(interface): + return "" + + +def main(argv=None): + if argv is None: + argv = sys.argv + interface = environ.get('DNSMASQ_INTERFACE', 'br0') + old_redis_db = FLAGS.redis_db + FLAGS.redis_db = int(environ.get('REDIS_DB', '0')) + action = argv[1] + if action in ['add','del','old']: + mac = argv[2] + ip = argv[3] + hostname = argv[4] + logging.debug("Called %s for mac %s with ip %s and hostname %s on interface %s" % (action, mac, ip, hostname, interface)) + globals()[action+'_lease'](mac, ip, hostname, interface) + else: + print init_leases(interface) + FLAGS.redis_db = old_redis_db + +if __name__ == "__main__": + sys.exit(main()) diff --git a/nova/compute/linux_net.py b/nova/compute/linux_net.py index 0bd5ce007..b44cf9437 100644 --- a/nova/compute/linux_net.py +++ b/nova/compute/linux_net.py @@ -62,6 +62,9 @@ def remove_rule(cmd): def bind_public_ip(ip, interface): runthis("Binding IP to interface: %s", "sudo ip addr add %s dev %s" % (ip, interface)) + +def unbind_public_ip(ip, interface): + runthis("Binding IP to interface: %s", "sudo ip addr del %s dev %s" % (ip, interface)) def vlan_create(net): """ create a vlan on on a bridge device unless vlan already exists """ @@ -98,7 +101,8 @@ def dnsmasq_cmd(net): ' --dhcp-range=%s,static,120s' % (net.dhcp_range_start), ' --dhcp-lease-max=61', ' --dhcp-hostsfile=%s' % dhcp_file(net['vlan'], 'conf'), - ' --dhcp-leasefile=%s' % dhcp_file(net['vlan'], 'leases')] + ' --dhcp-leasefile=%s' % dhcp_file(net['vlan'], 'leases'), + ' ---dhcp-script=%s' % bin_file('dhcpleasor.py')] return ''.join(cmd) def hostDHCP(network, host, mac): @@ -154,6 +158,9 @@ def dhcp_file(vlan, kind): return os.path.abspath("%s/nova-%s.%s" % (FLAGS.networks_path, vlan, kind)) +def bin_file(script): + return os.path.abspath(os.path.join(__file__, "../../../bin", script)) + def dnsmasq_pid_for(network): """ the pid for prior dnsmasq instance for a vlan, returns None if no pid file exists diff --git a/nova/compute/network.py b/nova/compute/network.py index 911d0344a..7a347aa11 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -162,12 +162,16 @@ class BaseNetwork(datastore.RedisModel): return address raise exception.NoMoreAddresses() - def deallocate_ip(self, ip_str): + def release_ip(self, ip_str): if not ip_str in self.assigned: raise exception.AddressNotAllocated() self.deexpress(address=ip_str) self._rem_host(ip_str) + def deallocate_ip(self, ip_str): + # Do nothing for now, cleanup on ip release + pass + def list_addresses(self): for address in self.hosts: yield address @@ -197,7 +201,7 @@ class BridgedNetwork(BaseNetwork): def get_network_for_project(cls, user_id, project_id, security_group): vlan = get_vlan_for_project(project_id) network_str = get_subnet_from_vlan(vlan) - logging.debug("creating network on vlan %s with network string %s" % (vlan, network_str)) + # logging.debug("creating network on vlan %s with network string %s" % (vlan, network_str)) return cls.create(user_id, project_id, security_group, vlan, network_str) def __init__(self, *args, **kwargs): @@ -221,7 +225,7 @@ class DHCPNetwork(BridgedNetwork): def __init__(self, *args, **kwargs): super(DHCPNetwork, self).__init__(*args, **kwargs) - logging.debug("Initing DHCPNetwork object...") + # logging.debug("Initing DHCPNetwork object...") self.dhcp_listen_address = self.network[1] self.dhcp_range_start = self.network[3] self.dhcp_range_end = self.network[-(1 + FLAGS.cnt_vpn_clients)] @@ -372,6 +376,7 @@ class PublicNetworkController(BaseNetwork): def deexpress(self, address=None): addr = self.get_host(address) private_ip = addr['private_ip'] + linux_net.unbind_public_ip(address, FLAGS.public_interface) linux_net.remove_rule("PREROUTING -t nat -d %s -j DNAT --to %s" % (address, private_ip)) linux_net.remove_rule("POSTROUTING -t nat -s %s -j SNAT --to %s" @@ -416,8 +421,11 @@ def get_vlan_for_project(project_id): def get_network_by_address(address): + logging.debug("Get Network By Address:") for project in users.UserManager.instance().get_projects(): + logging.debug(" looking at project %s", project.id) net = get_project_network(project.id) + logging.debug(" is %s in %s ?" % (address, str(net.assigned))) if address in net.assigned: return net raise exception.AddressNotAllocated() diff --git a/nova/tests/fake_flags.py b/nova/tests/fake_flags.py index d40172cfc..3f5d9ff54 100644 --- a/nova/tests/fake_flags.py +++ b/nova/tests/fake_flags.py @@ -28,5 +28,5 @@ FLAGS.fake_rabbit = True FLAGS.fake_network = True FLAGS.fake_users = True #FLAGS.keeper_backend = 'sqlite' -FLAGS.datastore_path = ':memory:' +# FLAGS.datastore_path = ':memory:' FLAGS.verbose = True diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index f215c0b3f..4c9f340c1 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -18,6 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. +import os import logging import unittest @@ -26,6 +27,7 @@ import IPy from nova import flags from nova import test +from nova import exception from nova.compute import network from nova.auth import users from nova import utils @@ -40,6 +42,7 @@ class NetworkTestCase(test.TrialTestCase): network_size=32) logging.getLogger().setLevel(logging.DEBUG) self.manager = users.UserManager.instance() + self.dnsmasq = FakeDNSMasq() try: self.manager.create_user('netuser', 'netuser', 'netuser') except: pass @@ -63,11 +66,23 @@ class NetworkTestCase(test.TrialTestCase): self.assertTrue(IPy.IP(address) in self.network.network) def test_allocate_deallocate_ip(self): + # Address should be allocated + # Then, simulate acquisition of the address + # Deallocate it, and wait for simulated ip release + # then confirm it's gone. address = network.allocate_ip( "netuser", "project0", utils.generate_mac()) logging.debug("Was allocated %s" % (address)) + net = network.get_project_network("project0", "default") self.assertEqual(True, address in self._get_project_addresses("project0")) + mac = utils.generate_mac() + hostname = "test-host" + self.dnsmasq.issue_ip(mac, address, hostname, net.bridge_name) rv = network.deallocate_ip(address) + # Doesn't go away until it's dhcp released + self.assertEqual(True, address in self._get_project_addresses("project0")) + + self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name) self.assertEqual(False, address in self._get_project_addresses("project0")) def test_range_allocation(self): @@ -122,3 +137,22 @@ class NetworkTestCase(test.TrialTestCase): for addr in network.get_project_network(project_id).list_addresses(): project_addresses.append(addr) return project_addresses + +def binpath(script): + return os.path.abspath(os.path.join(__file__, "../../../bin", script)) + +class FakeDNSMasq(object): + def issue_ip(self, mac, ip, hostname, interface): + cmd = "%s add %s %s %s" % (binpath('dhcpleasor.py'), mac, ip, hostname) + env = {'DNSMASQ_INTERFACE': interface, 'REDIS_DB' : '8'} + (out, err) = utils.execute(cmd, addl_env=env) + logging.debug(out) + logging.debug(err) + + def release_ip(self, mac, ip, hostname, interface): + cmd = "%s del %s %s %s" % (binpath('dhcpleasor.py'), mac, ip, hostname) + env = {'DNSMASQ_INTERFACE': interface, 'REDIS_DB' : '8'} + (out, err) = utils.execute(cmd, addl_env=env) + logging.debug(out) + logging.debug(err) + \ No newline at end of file diff --git a/nova/utils.py b/nova/utils.py index 325b062ee..cbfdd835d 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -26,6 +26,7 @@ import logging import socket import sys import os.path +from os import environ import inspect import subprocess import random @@ -46,11 +47,14 @@ def fetchfile(url, target): # fp.close() execute("curl %s -o %s" % (url, target)) - -def execute(cmd, input=None): +def execute(cmd, input=None, addl_env=None): #logging.debug("Running %s" % (cmd)) + env = os.environ.copy() + if addl_env: + env.update(addl_env) + logging.debug(env) obj = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) result = None if input != None: result = obj.communicate(input) -- cgit From dbe324f7254dd3e01de44bb908150fb8397fe118 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 7 Jul 2010 12:15:11 -0700 Subject: Got dhcpleasor working, with test ENV for testing, and rpc.cast for real world. --- bin/dhcpleasor.py | 36 +++++++++++++++++++++++++++--------- docs/conf.py | 2 +- nova/compute/linux_net.py | 7 +++---- nova/compute/network.py | 25 +++++++++++++++++++++---- nova/endpoint/cloud.py | 8 ++++++++ nova/tests/network_unittest.py | 40 +++++++++++++++++++++++++++++++--------- nova/utils.py | 2 -- 7 files changed, 91 insertions(+), 29 deletions(-) diff --git a/bin/dhcpleasor.py b/bin/dhcpleasor.py index 07e63884f..63ed52420 100755 --- a/bin/dhcpleasor.py +++ b/bin/dhcpleasor.py @@ -27,32 +27,50 @@ sys.path.append(os.path.abspath(os.path.join(__file__, "../../"))) logging.debug(sys.path) import getopt from os import environ +from nova.compute import linux_net from nova.compute import network +from nova import rpc + from nova import flags FLAGS = flags.FLAGS def add_lease(mac, ip, hostname, interface): - pass + if FLAGS.fake_rabbit: + network.lease_ip(ip) + else: + rpc.cast(FLAGS.cloud_topic, {"method": "lease_ip", + "args" : {"address": ip}}) def old_lease(mac, ip, hostname, interface): - pass + logging.debug("Adopted old lease or got a change of mac/hostname") def del_lease(mac, ip, hostname, interface): - # TODO - get net from interface instead - net = network.get_network_by_address(ip) - net.release_ip(ip) + if FLAGS.fake_rabbit: + network.release_ip(ip) + else: + rpc.cast(FLAGS.cloud_topic, {"method": "release_ip", + "args" : {"address": ip}}) def init_leases(interface): - return "" + net = network.get_network_by_interface(interface) + res = "" + for host_name in net.hosts: + res += "%s\n" % linux_net.hostDHCP(net, host_name, net.hosts[host_name]) + return res def main(argv=None): if argv is None: argv = sys.argv interface = environ.get('DNSMASQ_INTERFACE', 'br0') - old_redis_db = FLAGS.redis_db - FLAGS.redis_db = int(environ.get('REDIS_DB', '0')) + if int(environ.get('TESTING', '0')): + FLAGS.fake_rabbit = True + FLAGS.redis_db = 8 + FLAGS.network_size = 32 + FLAGS.fake_libvirt=True + FLAGS.fake_network=True + FLAGS.fake_users = True action = argv[1] if action in ['add','del','old']: mac = argv[2] @@ -62,7 +80,7 @@ def main(argv=None): globals()[action+'_lease'](mac, ip, hostname, interface) else: print init_leases(interface) - FLAGS.redis_db = old_redis_db + exit(0) if __name__ == "__main__": sys.exit(main()) diff --git a/docs/conf.py b/docs/conf.py index 9dfdfc8be..bc61f438c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,7 +16,7 @@ import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.append(os.path.abspath('.')) +sys.path.append(os.path.abspath('/Users/jmckenty/Projects/cc')) sys.path.append([os.path.abspath('../nova'),os.path.abspath('../'),os.path.abspath('../vendor')]) from nova import vendor diff --git a/nova/compute/linux_net.py b/nova/compute/linux_net.py index b44cf9437..c9e5bb1a7 100644 --- a/nova/compute/linux_net.py +++ b/nova/compute/linux_net.py @@ -98,11 +98,10 @@ def dnsmasq_cmd(net): ' --pid-file=%s' % dhcp_file(net['vlan'], 'pid'), ' --listen-address=%s' % net.dhcp_listen_address, ' --except-interface=lo', - ' --dhcp-range=%s,static,120s' % (net.dhcp_range_start), - ' --dhcp-lease-max=61', + ' --dhcp-range=%s,static,600s' % (net.dhcp_range_start), ' --dhcp-hostsfile=%s' % dhcp_file(net['vlan'], 'conf'), - ' --dhcp-leasefile=%s' % dhcp_file(net['vlan'], 'leases'), - ' ---dhcp-script=%s' % bin_file('dhcpleasor.py')] + ' --dhcp-script=%s' % bin_file('dhcpleasor.py'), + ' --leasefile-ro'] return ''.join(cmd) def hostDHCP(network, host, mac): diff --git a/nova/compute/network.py b/nova/compute/network.py index 7a347aa11..96b8e9627 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -160,7 +160,10 @@ class BaseNetwork(datastore.RedisModel): self._add_host(user_id, project_id, address, mac) self.express(address=address) return address - raise exception.NoMoreAddresses() + raise exception.NoMoreAddresses("Project %s with network %s" % (project_id, str(self.network))) + + def lease_ip(self, ip_str): + logging.debug("Leasing allocated IP %s" % (ip_str)) def release_ip(self, ip_str): if not ip_str in self.assigned: @@ -419,14 +422,22 @@ def get_vlan_for_project(project_id): return vlan raise exception.AddressNotAllocated("Out of VLANs") +def get_project_id_for_vlan(vlan): + assigned_vlans = get_assigned_vlans() + for project_id, project_vlan in assigned_vlans.iteritems(): + if vlan == project_vlan: + return project_id + +def get_network_by_interface(iface, security_group='default'): + vlan = iface.rpartition("br")[2] + return get_project_network(get_project_id_for_vlan(vlan), security_group) def get_network_by_address(address): - logging.debug("Get Network By Address:") + logging.debug("Get Network By Address: %s" % address) for project in users.UserManager.instance().get_projects(): - logging.debug(" looking at project %s", project.id) net = get_project_network(project.id) - logging.debug(" is %s in %s ?" % (address, str(net.assigned))) if address in net.assigned: + logging.debug("Found %s in %s" % (address, project.id)) return net raise exception.AddressNotAllocated() @@ -438,6 +449,12 @@ def allocate_ip(user_id, project_id, mac): def deallocate_ip(address): return get_network_by_address(address).deallocate_ip(address) + +def release_ip(address): + return get_network_by_address(address).release_ip(address) + +def lease_ip(address): + return get_network_by_address(address).lease_ip(address) def get_project_network(project_id, security_group='default'): """ get a project's private network, allocating one if needed """ diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 931c6c6e1..269fb3950 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -498,6 +498,14 @@ class CloudController(object): # TODO - Strip the IP from the instance return defer.succeed({'disassociateResponse': ["Address disassociated."]}) + def release_ip(self, context, private_ip, **kwargs): + self.network.release_ip(private_ip) + return defer.succeed({'releaseResponse': ["Address released."]}) + + def lease_ip(self, context, private_ip, **kwargs): + self.network.lease_ip(private_ip) + return defer.succeed({'leaseResponse': ["Address lease."]}) + @rbac.allow('projectmanager', 'sysadmin') def run_instances(self, context, **kwargs): # make sure user can access the image diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index 4c9f340c1..8cbc2b7cd 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -21,6 +21,7 @@ import os import logging import unittest +import time from nova import vendor import IPy @@ -86,18 +87,36 @@ class NetworkTestCase(test.TrialTestCase): self.assertEqual(False, address in self._get_project_addresses("project0")) def test_range_allocation(self): + mac = utils.generate_mac() + secondmac = utils.generate_mac() + hostname = "test-host" address = network.allocate_ip( - "netuser", "project0", utils.generate_mac()) + "netuser", "project0", mac) secondaddress = network.allocate_ip( - "netuser", "project1", utils.generate_mac()) + "netuser", "project1", secondmac) + net = network.get_project_network("project0", "default") + secondnet = network.get_project_network("project1", "default") + self.assertEqual(True, address in self._get_project_addresses("project0")) self.assertEqual(True, secondaddress in self._get_project_addresses("project1")) self.assertEqual(False, address in self._get_project_addresses("project1")) + # Addresses are allocated before they're issued + self.dnsmasq.issue_ip(mac, address, hostname, net.bridge_name) + self.dnsmasq.issue_ip(secondmac, secondaddress, + hostname, secondnet.bridge_name) + rv = network.deallocate_ip(address) + self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name) self.assertEqual(False, address in self._get_project_addresses("project0")) + # First address release shouldn't affect the second + self.assertEqual(True, + secondaddress in self._get_project_addresses("project1")) + rv = network.deallocate_ip(secondaddress) + self.dnsmasq.release_ip(secondmac, secondaddress, + hostname, secondnet.bridge_name) self.assertEqual(False, secondaddress in self._get_project_addresses("project1")) @@ -127,9 +146,14 @@ class NetworkTestCase(test.TrialTestCase): for i in range(0, 30): name = 'toomany-project%s' % i self.manager.create_project(name, 'netuser', name) + net = network.get_project_network(name, "default") + mac = utils.generate_mac() + hostname = "toomany-hosts" address = network.allocate_ip( - "netuser", name, utils.generate_mac()) + "netuser", name, mac) + self.dnsmasq.issue_ip(mac, address, hostname, net.bridge_name) rv = network.deallocate_ip(address) + self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name) self.manager.delete_project(name) def _get_project_addresses(self, project_id): @@ -144,15 +168,13 @@ def binpath(script): class FakeDNSMasq(object): def issue_ip(self, mac, ip, hostname, interface): cmd = "%s add %s %s %s" % (binpath('dhcpleasor.py'), mac, ip, hostname) - env = {'DNSMASQ_INTERFACE': interface, 'REDIS_DB' : '8'} + env = {'DNSMASQ_INTERFACE': interface, 'TESTING' : '1'} (out, err) = utils.execute(cmd, addl_env=env) - logging.debug(out) - logging.debug(err) + logging.debug("ISSUE_IP: %s, %s " % (out, err)) def release_ip(self, mac, ip, hostname, interface): cmd = "%s del %s %s %s" % (binpath('dhcpleasor.py'), mac, ip, hostname) - env = {'DNSMASQ_INTERFACE': interface, 'REDIS_DB' : '8'} + env = {'DNSMASQ_INTERFACE': interface, 'TESTING' : '1'} (out, err) = utils.execute(cmd, addl_env=env) - logging.debug(out) - logging.debug(err) + logging.debug("RELEASE_IP: %s, %s " % (out, err)) \ No newline at end of file diff --git a/nova/utils.py b/nova/utils.py index cbfdd835d..62ad00aec 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -48,11 +48,9 @@ def fetchfile(url, target): execute("curl %s -o %s" % (url, target)) def execute(cmd, input=None, addl_env=None): - #logging.debug("Running %s" % (cmd)) env = os.environ.copy() if addl_env: env.update(addl_env) - logging.debug(env) obj = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) result = None -- cgit From d831ef39e2d84aa3e39bc3861085d563575efa43 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 7 Jul 2010 12:15:11 -0700 Subject: Adding more tests, refactoring for dhcp logic. --- nova/tests/network_unittest.py | 106 ++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 44 deletions(-) diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index 8cbc2b7cd..67ae7ad2d 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -29,6 +29,7 @@ import IPy from nova import flags from nova import test from nova import exception +from nova.compute.exception import NoMoreAddresses from nova.compute import network from nova.auth import users from nova import utils @@ -67,24 +68,21 @@ class NetworkTestCase(test.TrialTestCase): self.assertTrue(IPy.IP(address) in self.network.network) def test_allocate_deallocate_ip(self): - # Address should be allocated - # Then, simulate acquisition of the address - # Deallocate it, and wait for simulated ip release - # then confirm it's gone. address = network.allocate_ip( "netuser", "project0", utils.generate_mac()) logging.debug("Was allocated %s" % (address)) net = network.get_project_network("project0", "default") - self.assertEqual(True, address in self._get_project_addresses("project0")) + self.assertEqual(True, is_in_project(address, "project0")) mac = utils.generate_mac() hostname = "test-host" self.dnsmasq.issue_ip(mac, address, hostname, net.bridge_name) rv = network.deallocate_ip(address) + # Doesn't go away until it's dhcp released - self.assertEqual(True, address in self._get_project_addresses("project0")) + self.assertEqual(True, is_in_project(address, "project0")) self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name) - self.assertEqual(False, address in self._get_project_addresses("project0")) + self.assertEqual(False, is_in_project(address, "project0")) def test_range_allocation(self): mac = utils.generate_mac() @@ -97,11 +95,10 @@ class NetworkTestCase(test.TrialTestCase): net = network.get_project_network("project0", "default") secondnet = network.get_project_network("project1", "default") - self.assertEqual(True, - address in self._get_project_addresses("project0")) - self.assertEqual(True, - secondaddress in self._get_project_addresses("project1")) - self.assertEqual(False, address in self._get_project_addresses("project1")) + self.assertEqual(True, is_in_project(address, "project0")) + self.assertEqual(True, is_in_project(secondaddress, "project1")) + self.assertEqual(False, is_in_project(address, "project1")) + # Addresses are allocated before they're issued self.dnsmasq.issue_ip(mac, address, hostname, net.bridge_name) self.dnsmasq.issue_ip(secondmac, secondaddress, @@ -109,58 +106,79 @@ class NetworkTestCase(test.TrialTestCase): rv = network.deallocate_ip(address) self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name) - self.assertEqual(False, address in self._get_project_addresses("project0")) + self.assertEqual(False, is_in_project(address, "project0")) + # First address release shouldn't affect the second - self.assertEqual(True, - secondaddress in self._get_project_addresses("project1")) + self.assertEqual(True, is_in_project(secondaddress, "project1")) rv = network.deallocate_ip(secondaddress) self.dnsmasq.release_ip(secondmac, secondaddress, hostname, secondnet.bridge_name) - self.assertEqual(False, - secondaddress in self._get_project_addresses("project1")) + self.assertEqual(False, is_in_project(secondaddress, "project1")) def test_subnet_edge(self): secondaddress = network.allocate_ip("netuser", "project0", utils.generate_mac()) + hostname = "toomany-hosts" for project in range(1,5): project_id = "project%s" % (project) + mac = utils.generate_mac() + mac2 = utils.generate_mac() + mac3 = utils.generate_mac() address = network.allocate_ip( - "netuser", project_id, utils.generate_mac()) + "netuser", project_id, mac) address2 = network.allocate_ip( - "netuser", project_id, utils.generate_mac()) + "netuser", project_id, mac2) address3 = network.allocate_ip( - "netuser", project_id, utils.generate_mac()) - self.assertEqual(False, - address in self._get_project_addresses("project0")) - self.assertEqual(False, - address2 in self._get_project_addresses("project0")) - self.assertEqual(False, - address3 in self._get_project_addresses("project0")) + "netuser", project_id, mac3) + self.assertEqual(False, is_in_project(address, "project0")) + self.assertEqual(False, is_in_project(address2, "project0")) + self.assertEqual(False, is_in_project(address3, "project0")) rv = network.deallocate_ip(address) rv = network.deallocate_ip(address2) rv = network.deallocate_ip(address3) + net = network.get_project_network(project_id, "default") + self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name) + self.dnsmasq.release_ip(mac2, address2, hostname, net.bridge_name) + self.dnsmasq.release_ip(mac3, address3, hostname, net.bridge_name) + net = network.get_project_network("project0", "default") rv = network.deallocate_ip(secondaddress) + self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name) - def test_too_many_projects(self): - for i in range(0, 30): - name = 'toomany-project%s' % i - self.manager.create_project(name, 'netuser', name) - net = network.get_project_network(name, "default") - mac = utils.generate_mac() - hostname = "toomany-hosts" - address = network.allocate_ip( - "netuser", name, mac) - self.dnsmasq.issue_ip(mac, address, hostname, net.bridge_name) - rv = network.deallocate_ip(address) - self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name) - self.manager.delete_project(name) + def test_release_before_deallocate(self): + pass + + def test_deallocate_before_issued(self): + pass + + def test_too_many_addresses(self): + """ + Network size is 32, there are 5 addresses reserved for VPN. + So we should get 24 usable addresses + """ + net = network.get_project_network("project0", "default") + hostname = "toomany-hosts" + macs = {} + addresses = {} + for i in range(0, 23): + macs[i] = utils.generate_mac() + addresses[i] = network.allocate_ip("netuser", "project0", macs[i]) + self.dnsmasq.issue_ip(macs[i], addresses[i], hostname, net.bridge_name) + + self.assertRaises(NoMoreAddresses, network.allocate_ip, "netuser", "project0", utils.generate_mac()) + + for i in range(0, 23): + rv = network.deallocate_ip(addresses[i]) + self.dnsmasq.release_ip(macs[i], addresses[i], hostname, net.bridge_name) + +def is_in_project(address, project_id): + return address in network.get_project_network(project_id).list_addresses() - def _get_project_addresses(self, project_id): - project_addresses = [] - for addr in network.get_project_network(project_id).list_addresses(): - project_addresses.append(addr) - return project_addresses +def _get_project_addresses(project_id): + project_addresses = [] + for addr in network.get_project_network(project_id).list_addresses(): + project_addresses.append(addr) + return project_addresses def binpath(script): return os.path.abspath(os.path.join(__file__, "../../../bin", script)) -- cgit From 84c69c32297a1f79e8630102497e1e7e0041a324 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 7 Jul 2010 12:24:17 -0700 Subject: Off by one error in the allocation test (can someone check my subnet math?) --- nova/tests/network_unittest.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index 67ae7ad2d..4d79758fb 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -21,7 +21,6 @@ import os import logging import unittest -import time from nova import vendor import IPy @@ -154,20 +153,20 @@ class NetworkTestCase(test.TrialTestCase): def test_too_many_addresses(self): """ Network size is 32, there are 5 addresses reserved for VPN. - So we should get 24 usable addresses + So we should get 23 usable addresses """ net = network.get_project_network("project0", "default") hostname = "toomany-hosts" macs = {} addresses = {} - for i in range(0, 23): + for i in range(0, 22): macs[i] = utils.generate_mac() addresses[i] = network.allocate_ip("netuser", "project0", macs[i]) self.dnsmasq.issue_ip(macs[i], addresses[i], hostname, net.bridge_name) self.assertRaises(NoMoreAddresses, network.allocate_ip, "netuser", "project0", utils.generate_mac()) - for i in range(0, 23): + for i in range(0, 22): rv = network.deallocate_ip(addresses[i]) self.dnsmasq.release_ip(macs[i], addresses[i], hostname, net.bridge_name) -- cgit From b9a8bd2d55f016fba305a00c985c7f6769afddd2 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 7 Jul 2010 12:24:22 -0700 Subject: Fixes as per Vish review (whitespace, import statements) --- nova/endpoint/cloud.py | 2 +- nova/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 269fb3950..a2f60b47f 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -504,7 +504,7 @@ class CloudController(object): def lease_ip(self, context, private_ip, **kwargs): self.network.lease_ip(private_ip) - return defer.succeed({'leaseResponse': ["Address lease."]}) + return defer.succeed({'leaseResponse': ["Address leased."]}) @rbac.allow('projectmanager', 'sysadmin') def run_instances(self, context, **kwargs): diff --git a/nova/utils.py b/nova/utils.py index 62ad00aec..1041733f1 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -26,7 +26,7 @@ import logging import socket import sys import os.path -from os import environ +import os.environ import inspect import subprocess import random -- cgit From 6d695e8410ad40b886cf6aff3a1e41598dcdfc66 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 7 Jul 2010 12:24:24 -0700 Subject: Fixed the os.environ patch (bogus) --- nova/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/utils.py b/nova/utils.py index 1041733f1..2f0ce33cd 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -26,7 +26,7 @@ import logging import socket import sys import os.path -import os.environ +import os import inspect import subprocess import random -- cgit From faada0612d8e8580a2a932626c8972b7c2a4ef59 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 7 Jul 2010 12:25:22 -0700 Subject: whitespace fixes and header changes --- bin/dhcpleasor.py | 42 ++++++++++++++++++++++++------------------ nova/tests/network_unittest.py | 36 ++++++++++++++++++------------------ 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/bin/dhcpleasor.py b/bin/dhcpleasor.py index 63ed52420..30f8fbdc3 100755 --- a/bin/dhcpleasor.py +++ b/bin/dhcpleasor.py @@ -1,18 +1,24 @@ -#!/opt/local/bin/python +#!/usr/bin/env python +# vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# +# Copyright 2010 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. +# +# Copyright 2010 Anso Labs, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + """ dhcpleasor.py @@ -37,21 +43,21 @@ FLAGS = flags.FLAGS def add_lease(mac, ip, hostname, interface): if FLAGS.fake_rabbit: - network.lease_ip(ip) + network.lease_ip(ip) else: rpc.cast(FLAGS.cloud_topic, {"method": "lease_ip", "args" : {"address": ip}}) def old_lease(mac, ip, hostname, interface): logging.debug("Adopted old lease or got a change of mac/hostname") - + def del_lease(mac, ip, hostname, interface): if FLAGS.fake_rabbit: - network.release_ip(ip) + network.release_ip(ip) else: rpc.cast(FLAGS.cloud_topic, {"method": "release_ip", - "args" : {"address": ip}}) - + "args" : {"address": ip}}) + def init_leases(interface): net = network.get_network_by_interface(interface) res = "" diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index 4d79758fb..bccaacfa7 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -76,10 +76,10 @@ class NetworkTestCase(test.TrialTestCase): hostname = "test-host" self.dnsmasq.issue_ip(mac, address, hostname, net.bridge_name) rv = network.deallocate_ip(address) - + # Doesn't go away until it's dhcp released self.assertEqual(True, is_in_project(address, "project0")) - + self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name) self.assertEqual(False, is_in_project(address, "project0")) @@ -93,25 +93,25 @@ class NetworkTestCase(test.TrialTestCase): "netuser", "project1", secondmac) net = network.get_project_network("project0", "default") secondnet = network.get_project_network("project1", "default") - + self.assertEqual(True, is_in_project(address, "project0")) self.assertEqual(True, is_in_project(secondaddress, "project1")) self.assertEqual(False, is_in_project(address, "project1")) - + # Addresses are allocated before they're issued self.dnsmasq.issue_ip(mac, address, hostname, net.bridge_name) - self.dnsmasq.issue_ip(secondmac, secondaddress, + self.dnsmasq.issue_ip(secondmac, secondaddress, hostname, secondnet.bridge_name) - + rv = network.deallocate_ip(address) self.dnsmasq.release_ip(mac, address, hostname, net.bridge_name) self.assertEqual(False, is_in_project(address, "project0")) - + # First address release shouldn't affect the second self.assertEqual(True, is_in_project(secondaddress, "project1")) - + rv = network.deallocate_ip(secondaddress) - self.dnsmasq.release_ip(secondmac, secondaddress, + self.dnsmasq.release_ip(secondmac, secondaddress, hostname, secondnet.bridge_name) self.assertEqual(False, is_in_project(secondaddress, "project1")) @@ -146,15 +146,15 @@ class NetworkTestCase(test.TrialTestCase): def test_release_before_deallocate(self): pass - + def test_deallocate_before_issued(self): pass - - def test_too_many_addresses(self): + + def test_too_many_addresses(self): """ Network size is 32, there are 5 addresses reserved for VPN. So we should get 23 usable addresses - """ + """ net = network.get_project_network("project0", "default") hostname = "toomany-hosts" macs = {} @@ -163,10 +163,10 @@ class NetworkTestCase(test.TrialTestCase): macs[i] = utils.generate_mac() addresses[i] = network.allocate_ip("netuser", "project0", macs[i]) self.dnsmasq.issue_ip(macs[i], addresses[i], hostname, net.bridge_name) - + self.assertRaises(NoMoreAddresses, network.allocate_ip, "netuser", "project0", utils.generate_mac()) - - for i in range(0, 22): + + for i in range(0, 22): rv = network.deallocate_ip(addresses[i]) self.dnsmasq.release_ip(macs[i], addresses[i], hostname, net.bridge_name) @@ -188,10 +188,10 @@ class FakeDNSMasq(object): env = {'DNSMASQ_INTERFACE': interface, 'TESTING' : '1'} (out, err) = utils.execute(cmd, addl_env=env) logging.debug("ISSUE_IP: %s, %s " % (out, err)) - + def release_ip(self, mac, ip, hostname, interface): cmd = "%s del %s %s %s" % (binpath('dhcpleasor.py'), mac, ip, hostname) env = {'DNSMASQ_INTERFACE': interface, 'TESTING' : '1'} (out, err) = utils.execute(cmd, addl_env=env) logging.debug("RELEASE_IP: %s, %s " % (out, err)) - \ No newline at end of file + -- cgit From 082c228f98e1d7545a9d5d7abe10bd35691d85c9 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 7 Jul 2010 18:29:19 -0700 Subject: use a flag for cert subject --- nova/auth/users.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nova/auth/users.py b/nova/auth/users.py index 1fc97345f..1a270733e 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -100,6 +100,10 @@ flags.DEFINE_string('credential_cert_file', 'cert.pem', 'Filename of certificate in credentials zip') flags.DEFINE_string('credential_rc_file', 'novarc', 'Filename of rc in credentials zip') +flags.DEFINE_string('credential_cert_subject', + '/C=US/ST=California/L=MountainView/O=AnsoLabs/' + 'OU=NovaDev/CN=%s-%s' + 'Subject for certificate for users') flags.DEFINE_string('vpn_ip', '127.0.0.1', 'Public IP for the cloudpipe VPN servers') @@ -516,7 +520,7 @@ class UserManager(object): def __cert_subject(self, uid): # FIXME(ja) - this should be pulled from a global configuration - return "/C=US/ST=California/L=MountainView/O=AnsoLabs/OU=NovaDev/CN=%s-%s" % (uid, str(datetime.datetime.utcnow().isoformat())) + return FLAGS.credential_cert_subject % (uid, utils.isotime()) class LDAPWrapper(object): -- cgit From 8b7a32c827fbef659a24a398da5eee73920c745b Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 7 Jul 2010 18:45:41 -0700 Subject: release 0.2.2-7 --- debian/changelog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debian/changelog b/debian/changelog index 789dad36d..02fb6ba11 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +nova (0.2.2-7) UNRELEASED; urgency=low + + * Missing files from twisted patch + * License upedates + * Reformatting/cleanup + * Users/ldap bugfixes + * Merge fixes + * Documentation updates + * Vpn key creation fix + * Multiple shelves for volumes + + -- Vishvananda Ishaya Wed, 07 Jul 2010 18:45:00 -0700 + nova (0.2.2-6) UNRELEASED; urgency=low * Fix to make Key Injection work again -- cgit From f5ce5b5750120012287d78ea0a40598ec0eefd47 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 8 Jul 2010 09:42:11 -0700 Subject: missed a comma --- nova/auth/users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/auth/users.py b/nova/auth/users.py index 1a270733e..671fdbdbf 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -102,7 +102,7 @@ flags.DEFINE_string('credential_rc_file', 'novarc', 'Filename of rc in credentials zip') flags.DEFINE_string('credential_cert_subject', '/C=US/ST=California/L=MountainView/O=AnsoLabs/' - 'OU=NovaDev/CN=%s-%s' + 'OU=NovaDev/CN=%s-%s', 'Subject for certificate for users') flags.DEFINE_string('vpn_ip', '127.0.0.1', 'Public IP for the cloudpipe VPN servers') -- cgit From 34e0c553d670829dbeffdbb25415bc7635899ae1 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 8 Jul 2010 10:06:25 -0700 Subject: release 0.2.2-8 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 02fb6ba11..85a630d92 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nova (0.2.2-8) UNRELEASED; urgency=low + + * Added a missing comma + + -- Vishvananda Ishaya Mon, 08 Jul 2010 10:05:00 -0700 + nova (0.2.2-7) UNRELEASED; urgency=low * Missing files from twisted patch -- cgit From 6993e9fb1aca0c238a78c3948eb19d4fbb7963eb Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 8 Jul 2010 10:53:27 -0700 Subject: added missing isotime method from utils --- nova/utils.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nova/utils.py b/nova/utils.py index 325b062ee..46b5b7c51 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -22,13 +22,14 @@ System-level utilities and helper functions. """ +import datetime +import inspect import logging -import socket -import sys import os.path -import inspect -import subprocess import random +import socket +import subprocess +import sys from nova import flags @@ -114,3 +115,8 @@ def get_my_ip(): (addr, port) = csock.getsockname() csock.close() return addr + +def isotime(at=None): + if not at: + at = datetime.utcnow() + return at.strftime("%Y-%m-%dT%H:%M:%SZ") -- cgit From a6e5d2139cbe46992370b0f2b107532a2b55b62e Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 8 Jul 2010 11:00:53 -0700 Subject: datetime import typo --- nova/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/utils.py b/nova/utils.py index 46b5b7c51..d6d958b3c 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -22,7 +22,6 @@ System-level utilities and helper functions. """ -import datetime import inspect import logging import os.path @@ -30,6 +29,7 @@ import random import socket import subprocess import sys +from datetime import datetime from nova import flags -- cgit From 0f375589c2c6c32de9530a9075eba224a041c697 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 8 Jul 2010 11:03:43 -0700 Subject: typo in exception in crypto --- nova/crypto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/crypto.py b/nova/crypto.py index 413796ccc..92a1ab76f 100644 --- a/nova/crypto.py +++ b/nova/crypto.py @@ -92,7 +92,7 @@ def ssl_pub_to_ssh_pub(ssl_public_key, name='root', suffix='nova'): + " transport | lsh-export-key --openssh" (out, err) = utils.execute(convert, ssl_public_key) if err: - raise exception.Error("Failed to generate key: %s", err) + raise exception.Error("Failed to generate key: %s" % err) return '%s %s@%s\n' %(out.strip(), name, suffix) -- cgit From b6166936d6ff5a9a1d9019b912b0027909ec3f29 Mon Sep 17 00:00:00 2001 From: Devin Carlen Date: Thu, 8 Jul 2010 14:05:45 -0700 Subject: Minor smoketest refactoring --- smoketests/flags.py | 24 ++++---------- smoketests/novatestcase.py | 10 +++--- smoketests/smoketest.py | 82 ++++++++++++++++++++++++++++------------------ 3 files changed, 62 insertions(+), 54 deletions(-) diff --git a/smoketests/flags.py b/smoketests/flags.py index 6c2131d70..6af27ddfb 100644 --- a/smoketests/flags.py +++ b/smoketests/flags.py @@ -25,21 +25,9 @@ where they're used. import socket -from nova import vendor -from gflags import * - -# This keeps pylint from barfing on the imports -FLAGS = FLAGS -DEFINE_string = DEFINE_string -DEFINE_integer = DEFINE_integer -DEFINE_bool = DEFINE_bool - -# __GLOBAL FLAGS ONLY__ -# Define any app-specific flags in their own files, docs at: -# http://code.google.com/p/python-gflags/source/browse/trunk/gflags.py#39 - -DEFINE_bool('verbose', False, 'show debug output') -DEFINE_string('admin_access_key', 'admin', 'Access key for admin user') -DEFINE_string('admin_secret_key', 'admin', 'Secret key for admin user') -DEFINE_string('clc_ip', '127.0.0.1', 'IP of cloud controller API') -DEFINE_string('vpn_image_id', 'ami-CLOUDPIPE', 'AMI for cloudpipe vpn server') +flags.DEFINE_bool('verbose', False, 'show debug output') +flags.DEFINE_string('admin_access_key', 'admin', 'Access key for admin user') +flags.DEFINE_string('admin_secret_key', 'admin', 'Secret key for admin user') +flags.DEFINE_string('clc_ip', '127.0.0.1', 'IP of cloud controller API') +flags.DEFINE_string('vpn_image_id', 'ami-CLOUDPIPE', + 'AMI for cloudpipe vpn server') diff --git a/smoketests/novatestcase.py b/smoketests/novatestcase.py index 869e31946..078306c7f 100644 --- a/smoketests/novatestcase.py +++ b/smoketests/novatestcase.py @@ -24,13 +24,15 @@ import random import sys import unittest -from nova.adminclient import NovaAdminClient -from nova.smoketests import flags - from nova import vendor import paramiko -nova_admin = NovaAdminClient(access_key=flags.admin_access_key, secret_key=flags.admin_secret_key, clc_ip=host) +from nova import adminclient +from nova import flags + +FLAGS = flags.FLAGS + +nova_admin = adminclient.NovaAdminClient(access_key=FLAGS.admin_access_key, secret_key=FLAGS.admin_secret_key, clc_ip=FLAGS.clc_ip) class NovaTestCase(unittest.TestCase): def setUp(self): diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index f7794a0ff..d95062dbf 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -27,12 +27,12 @@ import time import unittest import zipfile -from nova.smoketests import flags -from nova.smoketests.novatestcase import NovaTestCase - from nova import vendor import paramiko +from nova import flags +from nova.smoketests import novatestcase + FLAGS = flags.FLAGS flags.DEFINE_string('bundle_kernel', 'openwrt-x86-vmlinuz', 'Local kernel file to use for bundling tests') @@ -40,7 +40,7 @@ flags.DEFINE_string('bundle_image', 'openwrt-x86-ext2.image', 'Local image file to use for bundling tests') # TODO(devamcar): Use random tempfile -ZIP_FILENAME = '/tmp/euca-me-x509.zip' +ZIP_FILENAME = '/tmp/nova-me-x509.zip' data = {} @@ -50,7 +50,7 @@ test_bucket = '%s_bucket' % test_prefix test_key = '%s_key' % test_prefix # Test admin credentials and user creation -class UserTests(NovaTestCase): +class UserTests(novatestcase.NovaTestCase): def test_001_admin_can_connect(self): conn = self.connection_for('admin') self.assert_(conn) @@ -97,14 +97,15 @@ class ImageTests(NovaTestCase): data['image_id'] = image_id def test_004_admin_can_bundle_kernel(self): - self.assertTrue(self.bundle_image(flags.bundle_kernel, kernel=True)) + self.assertTrue(self.bundle_image(FLAGS.bundle_kernel, kernel=True)) def test_005_admin_can_upload_kernel(self): - self.assertTrue(self.upload_image(test_bucket, flags.bundle_kernel)) + self.assertTrue(self.upload_image(test_bucket, FLAGS.bundle_kernel)) def test_006_admin_can_register_kernel(self): - # FIXME: registration should verify that bucket/manifest exists before returning successfully! - kernel_id = self.register_image(test_bucket, flags.bundle_kernel) + # FIXME(devcamcar): registration should verify that bucket/manifest + # exists before returning successfully. + kernel_id = self.register_image(test_bucket, FLAGS.bundle_kernel) self.assert_(kernel_id is not None) data['kernel_id'] = kernel_id @@ -129,7 +130,8 @@ class ImageTests(NovaTestCase): self.assert_(kernel.type == 'kernel') def test_008_admin_can_describe_image_attribute(self): - attrs = self.admin.get_image_attribute(data['image_id'], 'launchPermission') + attrs = self.admin.get_image_attribute(data['image_id'], + 'launchPermission') self.assert_(attrs.name, 'launch_permission') def test_009_me_cannot_see_non_public_images(self): @@ -155,7 +157,8 @@ class ImageTests(NovaTestCase): pass def test_012_me_can_see_launch_permission(self): - attrs = self.admin.get_image_attribute(data['image_id'], 'launchPermission') + attrs = self.admin.get_image_attribute(data['image_id'], + 'launchPermission') self.assert(_attrs.name, 'launch_permission') self.assert(_attrs.groups[0], 'all') @@ -173,7 +176,8 @@ class ImageTests(NovaTestCase): # def test_015_user_can_terminate(self): # conn = self.connection_for(test_username) -# terminated = conn.terminate_instances(instance_ids=[data['my_instance_id']]) +# terminated = conn.terminate_instances( +# instance_ids=[data['my_instance_id']]) # self.assertEqual(len(terminated), 1) def test_016_admin_can_deregister_kernel(self): @@ -234,13 +238,15 @@ class SecurityTests(NovaTestCase): def test_005_can_ping_private_ip(self): for x in xrange(120): # ping waits for 1 second - status, output = commands.getstatusoutput("ping -c1 -w1 %s" % data['my_private_ip']) + status, output = commands.getstatusoutput( + 'ping -c1 -w1 %s' % data['my_private_ip']) if status == 0: break else: - self.assert_("could not ping instance") + self.assert_('could not ping instance') #def test_005_me_cannot_ssh_when_unauthorized(self): - # self.assertRaises(paramiko.SSHException, self.connect_ssh, data['my_private_ip'], 'mykey') + # self.assertRaises(paramiko.SSHException, self.connect_ssh, + # data['my_private_ip'], 'mykey') #def test_006_me_can_authorize_ssh(self): # conn = self.connection_for(test_username + '_me') @@ -271,12 +277,13 @@ class SecurityTests(NovaTestCase): # ) #def test_009_you_cannot_ping_my_instance(self): - # TODO: should ping my_private_ip from with an instance started by "you" + # TODO: should ping my_private_ip from with an instance started by you. #self.assertFalse(self.can_ping(data['my_private_ip'])) def test_010_you_cannot_ssh_to_my_instance(self): try: - conn = self.connect_ssh(data['my_private_ip'], test_key + 'yourkey') + conn = self.connect_ssh(data['my_private_ip'], + test_key + 'yourkey') conn.close() except paramiko.SSHException: pass @@ -323,25 +330,29 @@ class RebundlingTests(NovaTestCase): def test_001_me_can_download_credentials_within_instance(self): conn = self.connect_ssh(data['my_private_ip'], 'mykey') - stdin, stdout = conn.exec_command('python ~/smoketests/install-credentials.py') + stdin, stdout = conn.exec_command( + 'python ~/smoketests/install-credentials.py') conn.close() self.assertEqual(stdout, 'ok') def test_002_me_can_rebundle_within_instance(self): conn = self.connect_ssh(data['my_private_ip'], 'mykey') - stdin, stdout = conn.exec_command('python ~/smoketests/rebundle-instance.py') + stdin, stdout = conn.exec_command( + 'python ~/smoketests/rebundle-instance.py') conn.close() self.assertEqual(stdout, 'ok') def test_003_me_can_upload_image_within_instance(self): conn = self.connect_ssh(data['my_private_ip'], 'mykey') - stdin, stdout = conn.exec_command('python ~/smoketests/upload-bundle.py') + stdin, stdout = conn.exec_command( + 'python ~/smoketests/upload-bundle.py') conn.close() self.assertEqual(stdout, 'ok') def test_004_me_can_register_image_within_instance(self): conn = self.connect_ssh(data['my_private_ip'], 'mykey') - stdin, stdout = conn.exec_command('python ~/smoketests/register-image.py') + stdin, stdout = conn.exec_command( + 'python ~/smoketests/register-image.py') conn.close() if re.matches('ami-{\w+}', stdout): data['my_image_id'] = stdout.strip() @@ -356,9 +367,9 @@ class RebundlingTests(NovaTestCase): def test_006_me_can_make_image_public(self): conn = self.connection_for(test_username) conn.modify_image_attribute(image_id=data['my_image_id'], - operation='add', - attribute='launchPermission', - groups='all') + operation='add', + attribute='launchPermission', + groups='all') def test_007_you_can_see_my_public_image(self): conn = self.connection_for('you') @@ -430,13 +441,16 @@ class VolumeTests(NovaTestCase): conn = self.connection_for(test_username) self.create_key_pair(conn, test_key) - reservation = conn.run_instances(data['image_id'], instance_type='m1.tiny', key_name=test_key) + reservation = conn.run_instances(data['image_id'], + instance_type='m1.tiny', + key_name=test_key) data['instance_id'] = reservation.instances[0].id data['private_ip'] = reservation.instances[0].private_dns_name # wait for instance to show up for x in xrange(120): # ping waits for 1 second - status, output = commands.getstatusoutput("ping -c1 -w1 %s" % data['private_ip']) + status, output = commands.getstatusoutput( + 'ping -c1 -w1 %s' % data['private_ip']) if status == 0: break else: @@ -462,9 +476,11 @@ class VolumeTests(NovaTestCase): def test_003_me_can_mount_volume(self): conn = self.connect_ssh(data['private_ip'], test_key) - # HACK: the tiny image doesn't create the node properly - # this will make /dev/vd* if it doesn't exist - stdin, stdout, stderr = conn.exec_command('grep %s /proc/partitions | `awk \'{print "mknod /dev/"$4" b "$1" "$2}\'`' % DEVICE) + # FIXME(devcamcar): the tiny image doesn't create the node properly + # this will make /dev/vd* if it doesn't exist + stdin, stdout, stderr = conn.exec_command( + 'grep %s /proc/partitions |' + \ + '`awk \'{print "mknod /dev/"$4" b "$1" "$2}\'`' % DEVICE) commands = [] commands.append('mkdir -p /mnt/vol') commands.append('mkfs.ext2 /dev/%s' % DEVICE) @@ -478,8 +494,9 @@ class VolumeTests(NovaTestCase): def test_004_me_can_write_to_volume(self): conn = self.connect_ssh(data['private_ip'], test_key) - # FIXME: This doesn't fail if the volume hasn't been mounted - stdin, stdout, stderr = conn.exec_command('echo hello > /mnt/vol/test.txt') + # FIXME(devcamcar): This doesn't fail if the volume hasn't been mounted + stdin, stdout, stderr = conn.exec_command( + 'echo hello > /mnt/vol/test.txt') err = stderr.read() conn.close() if len(err) > 0: @@ -487,7 +504,8 @@ class VolumeTests(NovaTestCase): def test_005_volume_is_correct_size(self): conn = self.connect_ssh(data['private_ip'], test_key) - stdin, stdout, stderr = conn.exec_command("df -h | grep %s | awk {'print $2'}" % DEVICE) + stdin, stdout, stderr = conn.exec_command( + "df -h | grep %s | awk {'print $2'}" % DEVICE) out = stdout.read() conn.close() if not out.strip() == '1007.9M': -- cgit From 43a393587c5578aa3270b42b4b30e614c9fd0c09 Mon Sep 17 00:00:00 2001 From: Devin Carlen Date: Thu, 8 Jul 2010 21:48:43 +0000 Subject: Fixes to smoketest flags --- smoketests/flags.py | 33 --------------------------------- smoketests/novatestcase.py | 7 +++++++ smoketests/smoketest.py | 24 ++++++++++++++---------- 3 files changed, 21 insertions(+), 43 deletions(-) delete mode 100644 smoketests/flags.py diff --git a/smoketests/flags.py b/smoketests/flags.py deleted file mode 100644 index 6af27ddfb..000000000 --- a/smoketests/flags.py +++ /dev/null @@ -1,33 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# Copyright 2010 Anso Labs, LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -Package-level global flags are defined here, the rest are defined -where they're used. -""" - -import socket - -flags.DEFINE_bool('verbose', False, 'show debug output') -flags.DEFINE_string('admin_access_key', 'admin', 'Access key for admin user') -flags.DEFINE_string('admin_secret_key', 'admin', 'Secret key for admin user') -flags.DEFINE_string('clc_ip', '127.0.0.1', 'IP of cloud controller API') -flags.DEFINE_string('vpn_image_id', 'ami-CLOUDPIPE', - 'AMI for cloudpipe vpn server') diff --git a/smoketests/novatestcase.py b/smoketests/novatestcase.py index 078306c7f..b35d3f2e8 100644 --- a/smoketests/novatestcase.py +++ b/smoketests/novatestcase.py @@ -32,6 +32,13 @@ from nova import flags FLAGS = flags.FLAGS +flags.DEFINE_string('admin_access_key', 'admin', 'Access key for admin user') +flags.DEFINE_string('admin_secret_key', 'admin', 'Secret key for admin user') +flags.DEFINE_string('clc_ip', '127.0.0.1', 'IP of cloud controller API') +#flags.DEFINE_string('vpn_image_id', 'ami-CLOUDPIPE', +# 'AMI for cloudpipe vpn server') + + nova_admin = adminclient.NovaAdminClient(access_key=FLAGS.admin_access_key, secret_key=FLAGS.admin_secret_key, clc_ip=FLAGS.clc_ip) class NovaTestCase(unittest.TestCase): diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index d95062dbf..2746b58d7 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -31,9 +31,10 @@ from nova import vendor import paramiko from nova import flags -from nova.smoketests import novatestcase +from smoketests import novatestcase FLAGS = flags.FLAGS + flags.DEFINE_string('bundle_kernel', 'openwrt-x86-vmlinuz', 'Local kernel file to use for bundling tests') flags.DEFINE_string('bundle_image', 'openwrt-x86-ext2.image', @@ -81,7 +82,7 @@ class UserTests(novatestcase.NovaTestCase): pass # Test image bundling, registration, and launching -class ImageTests(NovaTestCase): +class ImageTests(novatestcase.NovaTestCase): def test_000_setUp(self): self.create_user(test_username) @@ -159,8 +160,8 @@ class ImageTests(NovaTestCase): def test_012_me_can_see_launch_permission(self): attrs = self.admin.get_image_attribute(data['image_id'], 'launchPermission') - self.assert(_attrs.name, 'launch_permission') - self.assert(_attrs.groups[0], 'all') + self.assert_(attrs.name, 'launch_permission') + self.assert_(attrs.groups[0], 'all') # FIXME: add tests that user can launch image @@ -195,7 +196,7 @@ class ImageTests(NovaTestCase): # Test key pairs and security groups -class SecurityTests(NovaTestCase): +class SecurityTests(novatestcase.NovaTestCase): def test_000_setUp(self): self.create_user(test_username + '_me') self.create_user(test_username + '_you') @@ -320,7 +321,7 @@ class SecurityTests(NovaTestCase): # print output # Testing rebundling -class RebundlingTests(NovaTestCase): +class RebundlingTests(novatestcase.NovaTestCase): def test_000_setUp(self): self.create_user('me') self.create_user('you') @@ -388,7 +389,7 @@ class RebundlingTests(NovaTestCase): data = {} # Test elastic IPs -class ElasticIPTests(NovaTestCase): +class ElasticIPTests(novatestcase.NovaTestCase): def test_000_setUp(self): data['image_id'] = 'ami-tiny' @@ -434,7 +435,7 @@ class ElasticIPTests(NovaTestCase): ZONE = 'nova' DEVICE = 'vdb' # Test iscsi volumes -class VolumeTests(NovaTestCase): +class VolumeTests(novatestcase.NovaTestCase): def test_000_setUp(self): self.create_user(test_username) data['image_id'] = 'ami-tiny' # A7370FE3 @@ -549,7 +550,10 @@ def build_suites(): 'volume': unittest.makeSuite(VolumeTests), } -def main(argv=None): +def main(): + argv = FLAGS(sys.argv) + #argv = sys.argv + if len(argv) == 1: unittest.main() else: @@ -564,4 +568,4 @@ def main(argv=None): unittest.TextTestRunner(verbosity=2).run(suite) if __name__ == "__main__": - sys.exit(main(sys.argv)) + sys.exit(main()) -- cgit From 4ca5488297818239589968d5ea69cd3e5a124d7f Mon Sep 17 00:00:00 2001 From: Devin Carlen Date: Fri, 9 Jul 2010 08:21:32 +0000 Subject: Refactored smoketests flags --- smoketests/flags.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++ smoketests/novatestcase.py | 27 +++++++++++--------------- smoketests/smoketest.py | 35 ++++++++++++++++------------------ 3 files changed, 74 insertions(+), 35 deletions(-) create mode 100644 smoketests/flags.py diff --git a/smoketests/flags.py b/smoketests/flags.py new file mode 100644 index 000000000..f239c5f40 --- /dev/null +++ b/smoketests/flags.py @@ -0,0 +1,47 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2010 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. +# +# Copyright 2010 Anso Labs, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +""" +Package-level global flags are defined here, the rest are defined +where they're used. +""" + +from nova import vendor +from gflags import * + +# This keeps pylint from barfing on the imports +FLAGS = FLAGS +DEFINE_string = DEFINE_string +DEFINE_integer = DEFINE_integer +DEFINE_bool = DEFINE_bool + +# __GLOBAL FLAGS ONLY__ +# Define any app-specific flags in their own files, docs at: +# http://code.google.com/p/python-gflags/source/browse/trunk/gflags.py#39 +DEFINE_string('admin_access_key', 'admin', 'Access key for admin user') +DEFINE_string('admin_secret_key', 'admin', 'Secret key for admin user') +DEFINE_string('clc_ip', '127.0.0.1', 'IP of cloud controller API') +DEFINE_string('bundle_kernel', 'openwrt-x86-vmlinuz', + 'Local kernel file to use for bundling tests') +DEFINE_string('bundle_image', 'openwrt-x86-ext2.image', + 'Local image file to use for bundling tests') +#DEFINE_string('vpn_image_id', 'ami-CLOUDPIPE', +# 'AMI for cloudpipe vpn server') + diff --git a/smoketests/novatestcase.py b/smoketests/novatestcase.py index b35d3f2e8..c19ef781b 100644 --- a/smoketests/novatestcase.py +++ b/smoketests/novatestcase.py @@ -28,22 +28,17 @@ from nova import vendor import paramiko from nova import adminclient -from nova import flags +from smoketests import flags FLAGS = flags.FLAGS -flags.DEFINE_string('admin_access_key', 'admin', 'Access key for admin user') -flags.DEFINE_string('admin_secret_key', 'admin', 'Secret key for admin user') -flags.DEFINE_string('clc_ip', '127.0.0.1', 'IP of cloud controller API') -#flags.DEFINE_string('vpn_image_id', 'ami-CLOUDPIPE', -# 'AMI for cloudpipe vpn server') - - -nova_admin = adminclient.NovaAdminClient(access_key=FLAGS.admin_access_key, secret_key=FLAGS.admin_secret_key, clc_ip=FLAGS.clc_ip) class NovaTestCase(unittest.TestCase): def setUp(self): - pass + self.nova_admin = adminclient.NovaAdminClient( + access_key=FLAGS.admin_access_key, + secret_key=FLAGS.admin_secret_key, + clc_ip=FLAGS.clc_ip) def tearDown(self): pass @@ -64,22 +59,22 @@ class NovaTestCase(unittest.TestCase): @property def admin(self): - return nova_admin.connection_for('admin') + return self.nova_admin.connection_for('admin') def connection_for(self, username): - return nova_admin.connection_for(username) + return self.nova_admin.connection_for(username) def create_user(self, username): - return nova_admin.create_user(username) + return self.nova_admin.create_user(username) def get_user(self, username): - return nova_admin.get_user(username) + return self.nova_admin.get_user(username) def delete_user(self, username): - return nova_admin.delete_user(username) + return self.nova_admin.delete_user(username) def get_signed_zip(self, username): - return nova_admin.get_zip(username) + return self.nova_admin.get_zip(username) def create_key_pair(self, conn, key_name): try: diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index 2746b58d7..b752d814a 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -30,15 +30,13 @@ import zipfile from nova import vendor import paramiko -from nova import flags +from smoketests import flags from smoketests import novatestcase -FLAGS = flags.FLAGS +SUITE_NAMES = '[user, image, security, public_network, volume]' -flags.DEFINE_string('bundle_kernel', 'openwrt-x86-vmlinuz', - 'Local kernel file to use for bundling tests') -flags.DEFINE_string('bundle_image', 'openwrt-x86-ext2.image', - 'Local image file to use for bundling tests') +FLAGS = flags.FLAGS +flags.DEFINE_string('suite', None, 'Specific test suite to run ' + SUITE_NAMES) # TODO(devamcar): Use random tempfile ZIP_FILENAME = '/tmp/nova-me-x509.zip' @@ -87,13 +85,13 @@ class ImageTests(novatestcase.NovaTestCase): self.create_user(test_username) def test_001_admin_can_bundle_image(self): - self.assertTrue(self.bundle_image(IMAGE_FILENAME)) + self.assertTrue(self.bundle_image(FLAGS.bundle_image)) def test_002_admin_can_upload_image(self): - self.assertTrue(self.upload_image(test_bucket, IMAGE_FILENAME)) + self.assertTrue(self.upload_image(test_bucket, FLAGS.bundle_image)) def test_003_admin_can_register_image(self): - image_id = self.register_image(test_bucket, IMAGE_FILENAME) + image_id = self.register_image(test_bucket, FLAGS.bundle_image) self.assert_(image_id is not None) data['image_id'] = image_id @@ -398,7 +396,7 @@ class ElasticIPTests(novatestcase.NovaTestCase): self.create_key_pair(conn, 'mykey') conn = self.connection_for('admin') - #data['image_id'] = self.setUp_test_image(IMAGE_FILENAME) + #data['image_id'] = self.setUp_test_image(FLAGS.bundle_image) def test_001_me_can_launch_image_with_keypair(self): conn = self.connection_for('me') @@ -552,20 +550,19 @@ def build_suites(): def main(): argv = FLAGS(sys.argv) - #argv = sys.argv - - if len(argv) == 1: - unittest.main() - else: - suites = build_suites() + suites = build_suites() + if FLAGS.suite: try: - suite = suites[argv[1]] + suite = suites[FLAGS.suite] except KeyError: - print >> sys.stderr, 'Available test suites: [user, image, security, public_network, volume]' - return + print >> sys.stderr, 'Available test suites:', SUITE_NAMES + return 1 unittest.TextTestRunner(verbosity=2).run(suite) + else: + for suite in suites.itervalues(): + unittest.TextTestRunner(verbosity=2).run(suite) if __name__ == "__main__": sys.exit(main()) -- cgit From ddc4a0970d9e98a45b820ed740f3ed8e696a4972 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 9 Jul 2010 16:17:45 -0700 Subject: move check for none before get mpi data --- nova/endpoint/cloud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 931c6c6e1..f11faeb56 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -115,9 +115,9 @@ class CloudController(object): def get_metadata(self, ip): i = self.get_instance_by_ip(ip) - mpi = self._get_mpi_data(i['project_id']) if i is None: return None + mpi = self._get_mpi_data(i['project_id']) if i['key_name']: keys = { '0': { -- cgit From 730faa785921f43b342e27e9a40ebe88a68a35d8 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 12 Jul 2010 10:39:01 -0500 Subject: Move nova related configuration files into /etc/nova/. --- bin/nova-manage | 2 +- debian/changelog | 1 + debian/nova-api.init | 2 +- debian/nova-api.install | 2 +- debian/nova-common.dirs | 1 + debian/nova-common.install | 2 +- debian/nova-compute.init | 2 +- debian/nova-compute.install | 2 +- debian/nova-objectstore.init | 2 +- debian/nova-objectstore.install | 2 +- debian/nova-volume.init | 2 +- debian/nova-volume.install | 2 +- 12 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index cb987f330..c79718673 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -218,7 +218,7 @@ def methods_of(obj): if __name__ == '__main__': - utils.default_flagfile('/etc/nova-manage.conf') + utils.default_flagfile('/etc/nova/nova-manage.conf') argv = FLAGS(sys.argv) script_name = argv.pop(0) if len(argv) < 1: diff --git a/debian/changelog b/debian/changelog index f78e8c13c..4dfdb1dec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ nova (0.3.0+really0.2.2-0ubuntu0ppa4) UNRELEASED; urgency=low * Relax the Twisted dependency to python-twisted-core (rather than the full stack). + * Move nova related configuration files into /etc/nova/. -- Soren Hansen Tue, 06 Jul 2010 22:28:28 +0200 diff --git a/debian/nova-api.init b/debian/nova-api.init index 77d9b2442..597fbef95 100644 --- a/debian/nova-api.init +++ b/debian/nova-api.init @@ -13,7 +13,7 @@ set -e DAEMON=/usr/bin/nova-api -DAEMON_ARGS="--flagfile=/etc/nova-api.conf" +DAEMON_ARGS="--flagfile=/etc/nova/nova-api.conf" PIDFILE=/var/run/nova-api.pid ENABLED=true diff --git a/debian/nova-api.install b/debian/nova-api.install index d1f5d7d5a..02dbda02d 100644 --- a/debian/nova-api.install +++ b/debian/nova-api.install @@ -1,2 +1,2 @@ bin/nova-api usr/bin -debian/nova-api.conf etc +debian/nova-api.conf etc/nova diff --git a/debian/nova-common.dirs b/debian/nova-common.dirs index 01443c4fd..b58fe8b7f 100644 --- a/debian/nova-common.dirs +++ b/debian/nova-common.dirs @@ -1,3 +1,4 @@ +etc/nova var/lib/nova/buckets var/lib/nova/CA var/lib/nova/CA/INTER diff --git a/debian/nova-common.install b/debian/nova-common.install index f3d554041..92b5d3d41 100644 --- a/debian/nova-common.install +++ b/debian/nova-common.install @@ -1,5 +1,5 @@ bin/nova-manage usr/bin -debian/nova-manage.conf etc +debian/nova-manage.conf etc/nova nova/auth/novarc.template usr/share/nova nova/cloudpipe/client.ovpn.template usr/share/nova nova/compute/libvirt.xml.template usr/share/nova diff --git a/debian/nova-compute.init b/debian/nova-compute.init index 820cf3d36..d0f093a7a 100644 --- a/debian/nova-compute.init +++ b/debian/nova-compute.init @@ -13,7 +13,7 @@ set -e DAEMON=/usr/bin/nova-compute -DAEMON_ARGS="--flagfile=/etc/nova-compute.conf" +DAEMON_ARGS="--flagfile=/etc/nova/nova-compute.conf" PIDFILE=/var/run/nova-compute.pid ENABLED=true diff --git a/debian/nova-compute.install b/debian/nova-compute.install index 20db74f14..5f9df46a8 100644 --- a/debian/nova-compute.install +++ b/debian/nova-compute.install @@ -1,2 +1,2 @@ bin/nova-compute usr/bin -debian/nova-compute.conf etc +debian/nova-compute.conf etc/nova diff --git a/debian/nova-objectstore.init b/debian/nova-objectstore.init index 7f37ac8ac..9676345ad 100644 --- a/debian/nova-objectstore.init +++ b/debian/nova-objectstore.init @@ -13,7 +13,7 @@ set -e DAEMON=/usr/bin/nova-objectstore -DAEMON_ARGS="--flagfile=/etc/nova-objectstore.conf" +DAEMON_ARGS="--flagfile=/etc/nova/nova-objectstore.conf" PIDFILE=/var/run/nova-objectstore.pid ENABLED=true diff --git a/debian/nova-objectstore.install b/debian/nova-objectstore.install index 590fcc01b..3ed93ff37 100644 --- a/debian/nova-objectstore.install +++ b/debian/nova-objectstore.install @@ -1,3 +1,3 @@ bin/nova-objectstore usr/bin -debian/nova-objectstore.conf etc +debian/nova-objectstore.conf etc/nova debian/nova-objectstore.nginx.conf etc/nginx/sites-available diff --git a/debian/nova-volume.init b/debian/nova-volume.init index 069b47818..d5c2dddf8 100644 --- a/debian/nova-volume.init +++ b/debian/nova-volume.init @@ -13,7 +13,7 @@ set -e DAEMON=/usr/bin/nova-volume -DAEMON_ARGS="--flagfile=/etc/nova-volume.conf" +DAEMON_ARGS="--flagfile=/etc/nova/nova-volume.conf" PIDFILE=/var/run/nova-volume.pid ENABLED=true diff --git a/debian/nova-volume.install b/debian/nova-volume.install index e7e172019..9a840c78e 100644 --- a/debian/nova-volume.install +++ b/debian/nova-volume.install @@ -1,2 +1,2 @@ bin/nova-volume usr/bin -debian/nova-volume.conf etc +debian/nova-volume.conf etc/nova -- cgit From 732707903f65fc126c147fc0a0839a3639b8d976 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Mon, 12 Jul 2010 15:11:41 -0500 Subject: fixed bug in auth group_exists it was using the name instead of the dn --- nova/auth/users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/auth/users.py b/nova/auth/users.py index 671fdbdbf..769983e83 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -710,7 +710,7 @@ class LDAPWrapper(object): def __create_group(self, group_dn, name, uid, description, member_uids = None): - if self.group_exists(name): + if self.group_exists(group_dn): raise exception.Duplicate("Group can't be created because " "group %s already exists" % name) members = [] -- cgit From 6e2bf301515da33b6709feb04b70d41bf02eeb63 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Mon, 12 Jul 2010 13:23:22 -0700 Subject: release 0.2.2-9 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 85a630d92..426c77f53 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nova (0.2.2-9) UNRELEASED; urgency=low + + * Fixed invalid dn bug in ldap for adding roles + + -- Vishvananda Ishaya Mon, 12 Jul 2010 15:20:00 -0700 + nova (0.2.2-8) UNRELEASED; urgency=low * Added a missing comma -- cgit From dfdb094956acce5f0d459203a9f95067f989d68d Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Mon, 12 Jul 2010 16:28:19 -0500 Subject: Avoid using s-expr, pkcs1-conv, and lsh-export-key. Instead we now use M2Crypto and struct.pack to construct it on our own. This removes a dependency on nettle-bin and lsh-utils (which were never specified in debian/control). --- nova/crypto.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/nova/crypto.py b/nova/crypto.py index 80b4ef9de..4f97bb824 100644 --- a/nova/crypto.py +++ b/nova/crypto.py @@ -23,10 +23,12 @@ Wrappers around standard crypto, including root and intermediate CAs, SSH keypairs and x509 certificates. """ +import base64 import hashlib import logging import os import shutil +import struct import tempfile import time import utils @@ -86,14 +88,17 @@ def generate_key_pair(bits=1024): def ssl_pub_to_ssh_pub(ssl_public_key, name='root', suffix='nova'): - """requires lsh-utils""" - convert="sed -e'1d' -e'$d' | pkcs1-conv --public-key-info --base-64 |" \ - + " sexp-conv | sed -e'1s/(rsa-pkcs1/(rsa-pkcs1-sha1/' | sexp-conv -s" \ - + " transport | lsh-export-key --openssh" - (out, err) = utils.execute(convert, ssl_public_key) - if err: - raise exception.Error("Failed to generate key: %s", err) - return '%s %s@%s\n' %(out.strip(), name, suffix) + rsa_key = M2Crypto.RSA.load_pub_key_bio(M2Crypto.BIO.MemoryBuffer(ssl_public_key)) + e, n = rsa_key.pub() + + key_type = 'ssh-rsa' + + key_data = struct.pack('>I', len(key_type)) + key_data += key_type + key_data += '%s%s' % (e,n) + + b64_blob = base64.b64encode(key_data) + return '%s %s %s@%s\n' %(key_type, b64_blob, name, suffix) def generate_x509_cert(subject="/C=US/ST=California/L=The Mission/O=CloudFed/OU=NOVA/CN=foo", bits=1024): -- cgit From c17dcd9db1afeef79263f5d8d1bd2a52de8f87a5 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Tue, 13 Jul 2010 20:52:13 -0500 Subject: fix for extra space in vblade-persist --- nova/volume/storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/volume/storage.py b/nova/volume/storage.py index a0c4b0d55..ed7857b3d 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -243,7 +243,7 @@ class Volume(datastore.RedisModel): def _exec_export(self): utils.runthis("Creating AOE export: %s", - "sudo vblade- persist setup %s %s %s /dev/%s/%s" % + "sudo vblade-persist setup %s %s %s /dev/%s/%s" % (self['shelf_id'], self['blade_id'], FLAGS.aoe_eth_dev, -- cgit From 67c05d0e4605fb7eb6ede4d0dc461e9260ec5510 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Tue, 13 Jul 2010 19:01:14 -0700 Subject: release 0.2.2-10 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 426c77f53..0f648e30c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nova (0.2.2-10) UNRELEASED; urgency=low + + * Fixed extra space in vblade-persist + + -- Vishvananda Ishaya Mon, 13 Jul 2010 19:00:00 -0700 + nova (0.2.2-9) UNRELEASED; urgency=low * Fixed invalid dn bug in ldap for adding roles -- cgit From 502e804d14059c8f9c306d02dd15b26574d0d4ec Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 15:34:46 -0700 Subject: Addin buildbot --- README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README b/README index 192711204..ffd45ea43 100644 --- a/README +++ b/README @@ -15,3 +15,6 @@ To disect it in detail: visit http://github.com/nova/cc To taunt it with its weaknesses: use http://github.com/nova/cc/issues To hack at it: read HACKING + +To watch it: http://184.106.205.70:8010 + -- cgit From 58611ce6ba790ea1a7638108b4cee05cb77dd2c4 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 15:39:24 -0700 Subject: More buildbot testing --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index ffd45ea43..bfeeebe38 100644 --- a/README +++ b/README @@ -17,4 +17,4 @@ To taunt it with its weaknesses: use http://github.com/nova/cc/issues To hack at it: read HACKING To watch it: http://184.106.205.70:8010 - +(This is buildbot) -- cgit From 615963a41c60a9d5bdd3653fd6e76203dd177c1c Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 15:41:02 -0700 Subject: More buildbot testing --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index bfeeebe38..5e710796e 100644 --- a/README +++ b/README @@ -17,4 +17,4 @@ To taunt it with its weaknesses: use http://github.com/nova/cc/issues To hack at it: read HACKING To watch it: http://184.106.205.70:8010 -(This is buildbot) +(This is buildbot again) -- cgit From a2bb34ceb02b111b10eaacea8ab326e0b1f461f8 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 15:42:32 -0700 Subject: More buildbot testing --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 5e710796e..a12c7f3dc 100644 --- a/README +++ b/README @@ -17,4 +17,4 @@ To taunt it with its weaknesses: use http://github.com/nova/cc/issues To hack at it: read HACKING To watch it: http://184.106.205.70:8010 -(This is buildbot again) + and again (This is buildbot again) -- cgit From 88eee6d5adbb62c635b4a3d65e8c4b0cae0de279 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 15:44:42 -0700 Subject: More buildbot testing --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index a12c7f3dc..29c6af0e5 100644 --- a/README +++ b/README @@ -17,4 +17,4 @@ To taunt it with its weaknesses: use http://github.com/nova/cc/issues To hack at it: read HACKING To watch it: http://184.106.205.70:8010 - and again (This is buildbot again) + and again and again (This is buildbot again) -- cgit From 7a1e7977484c89364c3cc15e53fffb207031f868 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 15:59:15 -0700 Subject: More buildbot testing --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 29c6af0e5..209106b7b 100644 --- a/README +++ b/README @@ -18,3 +18,4 @@ To hack at it: read HACKING To watch it: http://184.106.205.70:8010 and again and again (This is buildbot again) +and again -- cgit From 5a0d45ed4729bc14078c74af127d238032f43bfc Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 16:01:09 -0700 Subject: More buildbot testing --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 209106b7b..ab43d46d6 100644 --- a/README +++ b/README @@ -18,4 +18,4 @@ To hack at it: read HACKING To watch it: http://184.106.205.70:8010 and again and again (This is buildbot again) -and again +aand again nd again -- cgit From 69104d57f95b8d6609490af8ed981add3fc0a98b Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Wed, 14 Jul 2010 18:03:19 -0500 Subject: optimization to not load all instances when describe instances is called --- nova/endpoint/cloud.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index f11faeb56..19b6db91f 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -403,15 +403,17 @@ class CloudController(object): def _format_instances(self, context, reservation_id = None): reservations = {} - for instance in self.instdir.all: + if context.user.is_admin(): + instgenerator = self.instdir.all + else: + instgenerator = self.instdir.by_project(context.project.id) + for instance in instgenerator: res_id = instance.get('reservation_id', 'Unknown') if reservation_id != None and reservation_id != res_id: continue if not context.user.is_admin(): if instance['image_id'] == FLAGS.vpn_image_id: continue - if context.project.id != instance['project_id']: - continue i = {} i['instance_id'] = instance.get('instance_id', None) i['image_id'] = instance.get('image_id', None) -- cgit From c9a14a90fbcc66da08dc29b0f314c3b5eeef2e3a Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 16:32:11 -0700 Subject: Foo --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index ab43d46d6..221275300 100644 --- a/README +++ b/README @@ -18,4 +18,4 @@ To hack at it: read HACKING To watch it: http://184.106.205.70:8010 and again and again (This is buildbot again) -aand again nd again +aand again nd again and again -- cgit From 780903507333cb33a0cce31fbc4a1b62549263bf Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 16:39:56 -0700 Subject: Foo --- README | 2 -- 1 file changed, 2 deletions(-) diff --git a/README b/README index 221275300..dcfbc4bcd 100644 --- a/README +++ b/README @@ -17,5 +17,3 @@ To taunt it with its weaknesses: use http://github.com/nova/cc/issues To hack at it: read HACKING To watch it: http://184.106.205.70:8010 - and again and again (This is buildbot again) -aand again nd again and again -- cgit From a1f6127369e8cdf1dc1ad056a138060be79dcf9e Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 14 Jul 2010 18:48:05 -0500 Subject: Debian package additions for simple network template --- debian/nova-common.install | 1 + debian/nova-compute.conf | 1 + 2 files changed, 2 insertions(+) diff --git a/debian/nova-common.install b/debian/nova-common.install index 92b5d3d41..9b1bbf147 100644 --- a/debian/nova-common.install +++ b/debian/nova-common.install @@ -3,6 +3,7 @@ debian/nova-manage.conf etc/nova nova/auth/novarc.template usr/share/nova nova/cloudpipe/client.ovpn.template usr/share/nova nova/compute/libvirt.xml.template usr/share/nova +nova/compute/interfaces.template usr/share/nova usr/lib/python*/*-packages/nova/* CA/openssl.cnf.tmpl var/lib/nova/CA CA/geninter.sh var/lib/nova/CA diff --git a/debian/nova-compute.conf b/debian/nova-compute.conf index 5cd3f31ff..e4ca3fe95 100644 --- a/debian/nova-compute.conf +++ b/debian/nova-compute.conf @@ -3,6 +3,7 @@ --datastore_path=/var/lib/nova/keeper --instances_path=/var/lib/nova/instances --networks_path=/var/lib/nova/networks +--simple_network_template=/usr/share/nova/interfaces.template --libvirt_xml_template=/usr/share/nova/libvirt.xml.template --vpn_client_template=/usr/share/nova/client.ovpn.template --credentials_template=/usr/share/nova/novarc.template -- cgit From 849ddba7e459412709590ffb2269c254437960c5 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 16:51:57 -0700 Subject: Fooish --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index dcfbc4bcd..bd187c83a 100644 --- a/README +++ b/README @@ -17,3 +17,4 @@ To taunt it with its weaknesses: use http://github.com/nova/cc/issues To hack at it: read HACKING To watch it: http://184.106.205.70:8010 +And again. -- cgit From 2f808cd3bfd65b828ebf4d4e4e8aeb2f221433ce Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 17:07:37 -0700 Subject: Smiteme --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index bd187c83a..e34cf1865 100644 --- a/README +++ b/README @@ -18,3 +18,4 @@ To hack at it: read HACKING To watch it: http://184.106.205.70:8010 And again. +And yet again. -- cgit From 65f5341a425b9a818172b8c618427c0c78ff8c96 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 17:13:02 -0700 Subject: Smiteme --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index e34cf1865..c1178a18c 100644 --- a/README +++ b/README @@ -19,3 +19,4 @@ To hack at it: read HACKING To watch it: http://184.106.205.70:8010 And again. And yet again. +And again. -- cgit From a0ff8345db0d71bc1d72ae68e2fa3773cdf2cfe8 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 17:18:19 -0700 Subject: Smiteme --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index c1178a18c..46d824f2a 100644 --- a/README +++ b/README @@ -20,3 +20,4 @@ To watch it: http://184.106.205.70:8010 And again. And yet again. And again. +And again. -- cgit From 02fa700c4595344287a66ccbcca7510f0f4071af Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 18:39:48 -0700 Subject: Smiteme --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 46d824f2a..f52890a1c 100644 --- a/README +++ b/README @@ -21,3 +21,4 @@ And again. And yet again. And again. And again. +And again. -- cgit From 0bb71df533d9d5b9338ea04f34e5ef0ff2234cc7 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 18:41:45 -0700 Subject: Smiteme --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index f52890a1c..f48bb6467 100644 --- a/README +++ b/README @@ -22,3 +22,4 @@ And yet again. And again. And again. And again. +And once more. -- cgit From 30032221e6cee3c04efade0fd2aae17c58a6fa14 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 18:55:37 -0700 Subject: Smiteme --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index f48bb6467..79b601b0f 100644 --- a/README +++ b/README @@ -23,3 +23,4 @@ And again. And again. And again. And once more. +And yet yet again. -- cgit From c16d8b5a4b1f6874a83cd34872ed10957207e8d3 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 19:35:13 -0700 Subject: Fixed buildbot --- README | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README b/README index 79b601b0f..dcfbc4bcd 100644 --- a/README +++ b/README @@ -17,10 +17,3 @@ To taunt it with its weaknesses: use http://github.com/nova/cc/issues To hack at it: read HACKING To watch it: http://184.106.205.70:8010 -And again. -And yet again. -And again. -And again. -And again. -And once more. -And yet yet again. -- cgit From ebb56bcf492dc1ae132757f59f4ad82e1bf53d6e Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Wed, 14 Jul 2010 19:55:52 -0700 Subject: Updating buildbot address --- README | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README b/README index dcfbc4bcd..f7d21f400 100644 --- a/README +++ b/README @@ -16,4 +16,5 @@ To taunt it with its weaknesses: use http://github.com/nova/cc/issues To hack at it: read HACKING -To watch it: http://184.106.205.70:8010 +To watch it: http://test.novacc.org/waterfall + -- cgit