From 93395272def228fd9721a770fc585e414827f129 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Thu, 10 Jun 2010 17:43:44 -0400 Subject: Add a README, because GitHub loves them. Update the getting started docs. --- README | 17 ++++++++++++ docs/getting.started.rst | 71 ++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 76 insertions(+), 12 deletions(-) create mode 100644 README diff --git a/README b/README new file mode 100644 index 000000000..f1bb2d542 --- /dev/null +++ b/README @@ -0,0 +1,17 @@ +The Choose Your Own Adventure README for Nova: + + You have come across a cloud computing fabric controller. It has identified + itself as "Nova." It is apparent that it maintains compatability with + the popular Amazon EC2 and S3 APIs. + +To monitor it from a distance: follow @opennova + +To tame it for use in your own cloud: read http://docs.novacc.org/getting.started.html + +To study its anatomy: read http://docs.novacc.org/architecture.html + +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 diff --git a/docs/getting.started.rst b/docs/getting.started.rst index 777cd32e9..e9a2f4b2e 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -19,20 +19,34 @@ Getting Started with Nova GOTTA HAVE A nova.pth file added or it WONT WORK (will write setup.py file soon) +Create a file named nova.pth in your python libraries directory +(usually /usr/local/lib/python2.6/dist-packages) with a single line that points +to the directory where you checked out the source (that contains the nova/ +directory). + DEPENDENCIES ------------ +Related servers we rely on + * RabbitMQ: messaging queue, used for all communication between components * OpenLDAP: users, groups (maybe cut) +* ReDIS: Remote Dictionary Store (for fast, shared state data) + +Python libraries we don't vendor + +* M2Crypto: python library interface for openssl + +Vendored python libaries (don't require any installation) + * Tornado: scalable non blocking web server for api requests * Twisted: just for the twisted.internet.defer package * boto: python api for aws api -* M2Crypto: python library interface for openssl * IPy: library for managing ip addresses -* ReDIS: Remote Dictionary Store (for fast, shared state data) Recommended ----------------- + * euca2ools: python implementation of aws ec2-tools and ami tools * build tornado to use C module for evented section @@ -41,16 +55,17 @@ Installation -------------- :: - # ON ALL SYSTEMS - apt-get install -y python-libvirt libvirt-bin python-setuptools python-dev python-pycurl python-m2crypto python-twisted - apt-get install -y aoetools vlan + # system libraries and tools + apt-get install -y libvirt-bin aoetools vlan modprobe aoe + # python libraries + apt-get install -y python-libvirt python-setuptools python-dev python-pycurl python-m2crypto + + # ON THE CLOUD CONTROLLER apt-get install -y rabbitmq-server dnsmasq - # fix ec2 metadata/userdata uri - where $IP is the IP of the cloud - iptables -t nat -A PREROUTING -s 0.0.0.0/0 -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination $IP:8773 - iptables --table nat --append POSTROUTING --out-interface $PUBLICIFACE -j MASQUERADE + # build redis from 2.0.0-rc1 source # setup ldap (slap.sh as root will remove ldap and reinstall it) auth/slap.sh /etc/init.d/rabbitmq-server start @@ -64,7 +79,39 @@ Installation # optional packages apt-get install -y euca2ools - # Set up flagfiles with the appropriate hostnames, etc. - # start api_worker, s3_worker, node_worker, storage_worker - # Add yourself to the libvirtd group, log out, and log back in - # Make sure the user who will launch the workers has sudo privileges w/o pass (will fix later) +Configuration +--------------- + +ON CLOUD CONTROLLER + +* Add yourself to the libvirtd group, log out, and log back in +* fix hardcoded ec2 metadata/userdata uri ($IP is the IP of the cloud), and masqurade all traffic from launched instances +:: + + iptables -t nat -A PREROUTING -s 0.0.0.0/0 -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination $IP:8773 + iptables --table nat --append POSTROUTING --out-interface $PUBLICIFACE -j MASQUERADE + +ON VOLUME NODE + +* create a filesystem (you can use an actual disk if you have one spare, default is /dev/sdb) + +:: + + # This creates a 1GB file to create volumes out of + dd if=/dev/zero of=MY_FILE_PATH bs=100M count=10 + losetup --show -f MY_FILE_PATH + echo "--storage_dev=/dev/loop0" >> NOVA_PATH/bin/nova.conf + +Launch servers + +* rabbitmq +* redis +* slapd + +Launch nova components + +* api_worker +* s3_worker +* node_worker +* storage_worker + -- cgit From 0da7b9b0e50f049980ca1eef637d0a056f55fdb1 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Thu, 10 Jun 2010 20:41:41 -0400 Subject: More doc updates: nginx & pycurl. --- docs/getting.started.rst | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/getting.started.rst b/docs/getting.started.rst index e9a2f4b2e..df6ecbb01 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -32,10 +32,12 @@ Related servers we rely on * RabbitMQ: messaging queue, used for all communication between components * OpenLDAP: users, groups (maybe cut) * ReDIS: Remote Dictionary Store (for fast, shared state data) +* nginx: HTTP server to handle serving large files (because Tornado can't) Python libraries we don't vendor * M2Crypto: python library interface for openssl +* curl Vendored python libaries (don't require any installation) @@ -62,12 +64,11 @@ Installation # python libraries apt-get install -y python-libvirt python-setuptools python-dev python-pycurl python-m2crypto - # ON THE CLOUD CONTROLLER - apt-get install -y rabbitmq-server dnsmasq + apt-get install -y rabbitmq-server dnsmasq nginx # build redis from 2.0.0-rc1 source # setup ldap (slap.sh as root will remove ldap and reinstall it) - auth/slap.sh + NOVA_PATH/nova/auth/slap.sh /etc/init.d/rabbitmq-server start # ON VOLUME NODE: @@ -91,6 +92,25 @@ ON CLOUD CONTROLLER iptables -t nat -A PREROUTING -s 0.0.0.0/0 -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination $IP:8773 iptables --table nat --append POSTROUTING --out-interface $PUBLICIFACE -j MASQUERADE + +* Configure NginX proxy (/etc/nginx/sites-enabled/default):: + server { + listen 3333 default; + server-name localhost; + client_max_body_size 10m; + + access_log /var/log/nginx/localhost.access.log; + + location ~ /_images/.+ { + root NOVA_PATH/images; + rewrite ^/_images/(.*)\$ /\$1 break; + } + + location / { + proxy_pass http://localhost:3334/; + } + } + ON VOLUME NODE * create a filesystem (you can use an actual disk if you have one spare, default is /dev/sdb) @@ -107,6 +127,7 @@ Launch servers * rabbitmq * redis * slapd +* nginx Launch nova components -- cgit From 701f7fd6e1eac0c18c87d794dc762f39eaa74a09 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Thu, 10 Jun 2010 22:12:51 -0400 Subject: Make nginx config be in a code block. --- docs/getting.started.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/getting.started.rst b/docs/getting.started.rst index df6ecbb01..3b28b4363 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -93,7 +93,10 @@ ON CLOUD CONTROLLER iptables --table nat --append POSTROUTING --out-interface $PUBLICIFACE -j MASQUERADE -* Configure NginX proxy (/etc/nginx/sites-enabled/default):: +* Configure NginX proxy (/etc/nginx/sites-enabled/default) + +:: + server { listen 3333 default; server-name localhost; -- cgit From 1c61272d29f30a73f701c219a7b669c67f4cb447 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Thu, 10 Jun 2010 22:14:23 -0400 Subject: make a "Running" topic instead of having it flow under "Configuration". --- docs/getting.started.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/getting.started.rst b/docs/getting.started.rst index 3b28b4363..9d7808a27 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -125,6 +125,9 @@ ON VOLUME NODE losetup --show -f MY_FILE_PATH echo "--storage_dev=/dev/loop0" >> NOVA_PATH/bin/nova.conf +Running +--------- + Launch servers * rabbitmq -- cgit From 8f06d9b2eddb3cffc627b874de2c9e0f1348f30b Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 11 Jun 2010 10:45:12 -0700 Subject: Various cloud fixes --- nova/endpoint/cloud.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 768a6b3e0..f493d348c 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -382,7 +382,7 @@ class CloudController(object): return instance_response def describe_addresses(self, context, **kwargs): - return self.format_addresses(context.user) + return self.format_addresses(context) def format_addresses(self, context): addresses = [] @@ -456,7 +456,7 @@ class CloudController(object): address = network.allocate_ip( inst['user_id'], inst['project_id'], mac=inst['mac_address']) inst['private_dns_name'] = str(address) - inst['bridge_name'] = network.BridgedNetwork.get_network_for_project(inst['user_id'], inst['project_id'])['bridge_name'] + inst['bridge_name'] = network.BridgedNetwork.get_network_for_project(inst['user_id'], inst['project_id'], 'default')['bridge_name'] # TODO: allocate expresses on the router node inst.save() rpc.cast(FLAGS.compute_topic, @@ -466,7 +466,7 @@ class CloudController(object): (context.user.name, inst['private_dns_name'])) # TODO: Make the NetworkComputeNode figure out the network name from ip. return defer.succeed(self._format_instances( - context.user, reservation_id)) + context, reservation_id)) def terminate_instances(self, context, instance_id, **kwargs): logging.debug("Going to start terminating instances") @@ -542,7 +542,7 @@ class CloudController(object): raise exception.ApiError('only group "all" is supported') if not operation_type in ['add', 'delete']: raise exception.ApiError('operation_type must be add or delete') - result = images.modify(context.user, image_id, operation_type) + result = images.modify(context, image_id, operation_type) return defer.succeed(result) def update_state(self, topic, value): -- cgit From 835c985b448954dfde4492acf5900e83c1f32923 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 11 Jun 2010 10:45:31 -0700 Subject: fix cloud instances method --- nova/endpoint/cloud.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index f493d348c..e8f2fa347 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -66,8 +66,7 @@ class CloudController(object): @property def instances(self): """ All instances in the system, as dicts """ - for instance in self.instdir.all: - yield {instance['instance_id']: instance} + return self.instdir.all @property def volumes(self): @@ -337,11 +336,8 @@ class CloudController(object): return defer.succeed(self._format_instances(context)) def _format_instances(self, context, reservation_id = None): - if self.instances == {}: - return {'reservationSet': []} reservations = {} - for inst in self.instances: - instance = inst.values()[0] + for instance in self.instances: res_id = instance.get('reservation_id', 'Unknown') if ((context.user.is_admin() or context.project.id == instance['project_id']) and (reservation_id == None or reservation_id == res_id)): -- cgit From 146e8c99cd2214c2d59534e6e7ecfc4e0679863a Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 11 Jun 2010 10:46:41 -0700 Subject: gateway undefined --- nova/compute/network.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nova/compute/network.py b/nova/compute/network.py index 4d5f4bf5f..618e7bffb 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -88,6 +88,9 @@ class BaseNetwork(datastore.RedisModel): def netmask(self): return self.network.netmask() @property + def gateway(self): + return self.network[1] + @property def broadcast(self): return self.network.broadcast() @property -- cgit From 9c6e1d664843b4f9d8cf2c942d7cf1db21ad3bbc Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 11 Jun 2010 10:48:16 -0700 Subject: get rid of anyjson in rpc and fix bad reference to rpc.Connection --- nova/rpc.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/nova/rpc.py b/nova/rpc.py index 62c6afff3..16027a73e 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -1,12 +1,12 @@ # 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 -# +# # 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. @@ -18,12 +18,12 @@ AMQP-based RPC. Queues have consumers and publishers. No fan-out support yet. """ +import json import logging import sys import uuid from nova import vendor -import anyjson from carrot import connection from carrot import messaging from twisted.internet import defer @@ -82,7 +82,7 @@ class Publisher(messaging.Publisher): class TopicConsumer(Consumer): - exchange_type = "topic" + exchange_type = "topic" def __init__(self, connection=None, topic="broadcast"): self.queue = topic self.routing_key = topic @@ -95,7 +95,7 @@ class AdapterConsumer(TopicConsumer): _log.debug('Initing the Adapter Consumer for %s' % (topic)) self.proxy = proxy super(AdapterConsumer, self).__init__(connection=connection, topic=topic) - + def receive(self, message_data, message): _log.debug('received %s' % (message_data)) msg_id = message_data.pop('_msg_id', None) @@ -105,7 +105,7 @@ class AdapterConsumer(TopicConsumer): if not method: return - node_func = getattr(self.proxy, str(method)) + node_func = getattr(self.proxy, str(method)) node_args = dict((str(k), v) for k, v in args.iteritems()) d = defer.maybeDeferred(node_func, **node_args) if msg_id: @@ -116,15 +116,15 @@ class AdapterConsumer(TopicConsumer): class TopicPublisher(Publisher): - exchange_type = "topic" + exchange_type = "topic" def __init__(self, connection=None, topic="broadcast"): self.routing_key = topic self.exchange = FLAGS.control_exchange super(TopicPublisher, self).__init__(connection=connection) - + class DirectConsumer(Consumer): - exchange_type = "direct" + exchange_type = "direct" def __init__(self, connection=None, msg_id=None): self.queue = msg_id self.routing_key = msg_id @@ -145,12 +145,12 @@ class DirectPublisher(Publisher): def msg_reply(msg_id, reply): conn = Connection.instance() publisher = DirectPublisher(connection=conn, msg_id=msg_id) - + try: publisher.send({'result': reply}) except TypeError: publisher.send( - {'result': dict((k, repr(v)) + {'result': dict((k, repr(v)) for k, v in reply.__dict__.iteritems()) }) publisher.close() @@ -161,7 +161,7 @@ def call(topic, msg): msg_id = uuid.uuid4().hex msg.update({'_msg_id': msg_id}) _log.debug("MSG_ID is %s" % (msg_id)) - + conn = Connection.instance() d = defer.Deferred() consumer = DirectConsumer(connection=conn, msg_id=msg_id) @@ -198,7 +198,7 @@ def send_message(topic, message, wait=True): _log.debug('message %s', message) if wait: - consumer = messaging.Consumer(connection=rpc.Connection.instance(), + consumer = messaging.Consumer(connection=Connection.instance(), queue=msg_id, exchange=msg_id, auto_delete=True, @@ -206,7 +206,7 @@ def send_message(topic, message, wait=True): routing_key=msg_id) consumer.register_callback(generic_response) - publisher = messaging.Publisher(connection=rpc.Connection.instance(), + publisher = messaging.Publisher(connection=Connection.instance(), exchange="nova", exchange_type="topic", routing_key=topic) @@ -215,8 +215,8 @@ def send_message(topic, message, wait=True): if wait: consumer.wait() - -# TODO: Replace with a docstring test + +# TODO: Replace with a docstring test if __name__ == "__main__": - send_message(sys.argv[1], anyjson.deserialize(sys.argv[2])) + send_message(sys.argv[1], json.loads(sys.argv[2])) -- cgit From a690001006d852b19f7ba32367b1113046a3eb96 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 11 Jun 2010 11:07:52 -0700 Subject: Fix for LoopingCall failing Added in exception logging around amqp calls Creating deferred in receive before ack() message was causing IOError (interrupted system calls), probably because the same message was getting processed twice in some situations, causing the system calls to be doubled. Moving the ack() earlier fixed the problem. The code works now with an interval of 0 but that causes heavy processor usage. An interval of 0.01 keeps the cpu usage within reasonable limits --- nova/rpc.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/nova/rpc.py b/nova/rpc.py index 16027a73e..ca622daef 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -30,6 +30,7 @@ from twisted.internet import defer from twisted.internet import reactor from twisted.internet import task +from nova import exception from nova import fakerabbit from nova import flags @@ -73,9 +74,13 @@ class Consumer(messaging.Consumer): attachToTornado = attach_to_tornado + @exception.wrap_exception + def fetch(self, *args, **kwargs): + super(Consumer, self).fetch(*args, **kwargs) + def attach_to_twisted(self): loop = task.LoopingCall(self.fetch, enable_callbacks=True) - loop.start(interval=0.001) + loop.start(interval=0.01) class Publisher(messaging.Publisher): pass @@ -96,13 +101,20 @@ class AdapterConsumer(TopicConsumer): self.proxy = proxy super(AdapterConsumer, self).__init__(connection=connection, topic=topic) + @exception.wrap_exception def receive(self, message_data, message): _log.debug('received %s' % (message_data)) msg_id = message_data.pop('_msg_id', None) method = message_data.get('method') args = message_data.get('args', {}) + message.ack() if not method: + # vish: we may not want to ack here, but that means that bad messages + # stay in the queue indefinitely, so for now we just log the + # message and send an error string back to the caller + _log.warn('no method for message: %s' % (message_data)) + msg_reply(msg_id, 'No method for message: %s' % message_data) return node_func = getattr(self.proxy, str(method)) @@ -111,7 +123,6 @@ class AdapterConsumer(TopicConsumer): if msg_id: d.addCallback(lambda rval: msg_reply(msg_id, rval)) d.addErrback(lambda e: msg_reply(msg_id, str(e))) - message.ack() return -- cgit From d1312e964d7b4dfe854837e68fb03cb4aa9723a2 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 11 Jun 2010 11:09:45 -0700 Subject: patch from issue 4001 --- nova/compute/disk.py | 85 ++++++++++++++--------- nova/compute/node.py | 193 ++++++++++++++++++++++++++------------------------- 2 files changed, 150 insertions(+), 128 deletions(-) diff --git a/nova/compute/disk.py b/nova/compute/disk.py index d3eeb951f..f6a716e65 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -1,3 +1,4 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright [2010] [Anso Labs, LLC] # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,14 +22,21 @@ import logging import os import tempfile -from nova.exception import Error -from nova.utils import execute +from nova import vendor +from twisted.internet import defer -def partition(infile, outfile, local_bytes=0, local_type='ext2'): - """Takes a single partition represented by infile and writes a bootable drive image into outfile. +from nova import exception + +@defer.inlineCallbacks +def partition(infile, outfile, local_bytes=0, local_type='ext2', execute=None): + """Takes a single partition represented by infile and writes a bootable + drive image into outfile. + The first 63 sectors (0-62) of the resulting image is a master boot record. Infile becomes the first primary partition. - If local bytes is specified, a second primary partition is created and formatted as ext2. + If local bytes is specified, a second primary partition is created and + formatted as ext2. + In the diagram below, dashes represent drive sectors. 0 a b c d e +-----+------. . .-------+------. . .------+ @@ -38,10 +46,12 @@ def partition(infile, outfile, local_bytes=0, local_type='ext2'): sector_size = 512 file_size = os.path.getsize(infile) if file_size % sector_size != 0: - logging.warn("Input partition size not evenly divisible by sector size: %d / %d" (file_size, sector_size)) + logging.warn("Input partition size not evenly divisible by" + " sector size: %d / %d", file_size, sector_size) primary_sectors = file_size / sector_size if local_bytes % sector_size != 0: - logging.warn("Bytes for local storage not evenly divisible by sector size: %d / %d" (local_bytes, sector_size)) + logging.warn("Bytes for local storage not evenly divisible" + " by sector size: %d / %d", local_bytes, sector_size) local_sectors = local_bytes / sector_size mbr_last = 62 # a @@ -52,71 +62,80 @@ def partition(infile, outfile, local_bytes=0, local_type='ext2'): last_sector = local_last # e # create an empty file - execute('dd if=/dev/zero of=%s count=1 seek=%d bs=%d' % (outfile, last_sector, sector_size)) + execute('dd if=/dev/zero of=%s count=1 seek=%d bs=%d' + % (outfile, last_sector, sector_size)) # make mbr partition - execute('parted --script %s mklabel msdos' % outfile) + yield execute('parted --script %s mklabel msdos' % outfile) # make primary partition - execute('parted --script %s mkpart primary %ds %ds' % (outfile, primary_first, primary_last)) + yield execute('parted --script %s mkpart primary %ds %ds' + % (outfile, primary_first, primary_last)) # make local partition if local_bytes > 0: - execute('parted --script %s mkpartfs primary %s %ds %ds' % (outfile, local_type, local_first, local_last)) + yield execute('parted --script %s mkpartfs primary %s %ds %ds' + % (outfile, local_type, local_first, local_last)) # copy file into partition - execute('dd if=%s of=%s bs=%d seek=%d conv=notrunc,fsync' % (infile, outfile, sector_size, primary_first)) - + yield execute('dd if=%s of=%s bs=%d seek=%d conv=notrunc,fsync' + % (infile, outfile, sector_size, primary_first)) -def inject_key(key, image, partition=None): +@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 - it will mount the image as a fully partitioned disk and attempt to inject into the specified partition number. + 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 = execute('sudo losetup -f --show %s' % image) + out, err = yield execute('sudo losetup -f --show %s' % image) if err: - raise Error('Could not attach image to loopback: %s' % err) + raise exception.Error('Could not attach image to loopback: %s' % err) device = out.strip() try: if not partition is None: # create partition - out, err = execute('sudo kpartx -a %s' % device) + out, err = yield execute('sudo kpartx -a %s' % device) if err: - raise Error('Failed to load partition: %s' % err) - mapped_device = '/dev/mapper/%sp%s' % ( device.split('/')[-1] , partition ) + raise exception.Error('Failed to load partition: %s' % err) + mapped_device = '/dev/mapper/%sp%s' % (device.split('/')[-1], + partition) else: mapped_device = device - out, err = execute('sudo tune2fs -c 0 -i 0 %s' % mapped_device) + out, err = yield execute('sudo tune2fs -c 0 -i 0 %s' % mapped_device) tmpdir = tempfile.mkdtemp() try: # mount loopback to dir - out, err = execute('sudo mount %s %s' % (mapped_device, tmpdir)) + out, err = yield execute( + 'sudo mount %s %s' % (mapped_device, tmpdir)) if err: - raise Error('Failed to mount filesystem: %s' % err) + raise exception.Error('Failed to mount filesystem: %s' % err) try: # inject key file - _inject_into_fs(key, tmpdir) + yield _inject_into_fs(key, tmpdir, execute=execute) finally: # unmount device - execute('sudo umount %s' % mapped_device) + yield execute('sudo umount %s' % mapped_device) finally: # remove temporary directory - os.rmdir(tmpdir) + # TODO(termie): scary, is there any thing we can check here? + yield execute('rm -rf %s' % tmpdir) if not partition is None: # remove partitions - execute('sudo kpartx -d %s' % device) + yield execute('sudo kpartx -d %s' % device) finally: # remove loopback - execute('sudo losetup -d %s' % device) + yield execute('sudo losetup -d %s' % device) -def _inject_into_fs(key, fs): +@defer.inlineCallbacks +def _inject_into_fs(key, fs, execute=None): sshdir = os.path.join(os.path.join(fs, 'root'), '.ssh') - execute('sudo mkdir %s' % sshdir) #error on existing dir doesn't matter - execute('sudo chown root %s' % sshdir) - execute('sudo chmod 700 %s' % sshdir) + yield execute('sudo mkdir -p %s' % sshdir) # existing dir doesn't matter + yield execute('sudo chown root %s' % sshdir) + yield execute('sudo chmod 700 %s' % sshdir) keyfile = os.path.join(sshdir, 'authorized_keys') - execute('sudo bash -c "cat >> %s"' % keyfile, '\n' + key + '\n') + yield execute('sudo bash -c "cat >> %s"' % keyfile, '\n' + key + '\n') diff --git a/nova/compute/node.py b/nova/compute/node.py index 7c1636f34..72c2f2b70 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -26,7 +26,6 @@ import json import logging import os import random -import shutil import sys from nova import vendor @@ -66,10 +65,14 @@ INSTANCE_TYPES['m1.large'] = {'memory_mb': 4096, 'vcpus': 4, 'local_gb': 10} INSTANCE_TYPES['m1.xlarge'] = {'memory_mb': 8192, 'vcpus': 4, 'local_gb': 10} INSTANCE_TYPES['c1.medium'] = {'memory_mb': 2048, 'vcpus': 4, 'local_gb': 10} -# The number of processes to start in our process pool -# TODO(termie): this should probably be a flag and the pool should probably -# be a singleton -PROCESS_POOL_SIZE = 4 + +def _image_path(path=''): + return os.path.join(FLAGS.images_path, path) + + +def _image_url(path): + return "%s:%s/_images/%s" % (FLAGS.s3_host, FLAGS.s3_port, path) + class Node(object, service.Service): """ @@ -80,7 +83,7 @@ class Node(object, service.Service): super(Node, self).__init__() self._instances = {} self._conn = self._get_connection() - self._pool = process.Pool(PROCESS_POOL_SIZE) + self._pool = process.ProcessPool() self.instdir = model.InstanceDirectory() # TODO(joshua): This needs to ensure system state, specifically: modprobe aoe @@ -231,63 +234,6 @@ class ProductCode(object): self.product_code = product_code -def _create_image(data, libvirt_xml): - """ create libvirt.xml and copy files into instance path """ - def basepath(path=''): - return os.path.abspath(os.path.join(data['basepath'], path)) - - def imagepath(path=''): - return os.path.join(FLAGS.images_path, path) - - def image_url(path): - return "%s:%s/_images/%s" % (FLAGS.s3_host, FLAGS.s3_port, path) - logging.info(basepath('disk')) - try: - os.makedirs(data['basepath']) - os.chmod(data['basepath'], 0777) - except OSError: - # TODO: there is already an instance with this name, do something - pass - try: - logging.info('Creating image for: %s', data['instance_id']) - f = open(basepath('libvirt.xml'), 'w') - f.write(libvirt_xml) - f.close() - if not FLAGS.fake_libvirt: - if FLAGS.use_s3: - if not os.path.exists(basepath('disk')): - utils.fetchfile(image_url("%s/image" % data['image_id']), - basepath('disk-raw')) - if not os.path.exists(basepath('kernel')): - utils.fetchfile(image_url("%s/image" % data['kernel_id']), - basepath('kernel')) - if not os.path.exists(basepath('ramdisk')): - utils.fetchfile(image_url("%s/image" % data['ramdisk_id']), - basepath('ramdisk')) - else: - if not os.path.exists(basepath('disk')): - shutil.copyfile(imagepath("%s/image" % data['image_id']), - basepath('disk-raw')) - if not os.path.exists(basepath('kernel')): - shutil.copyfile(imagepath("%s/image" % data['kernel_id']), - basepath('kernel')) - if not os.path.exists(basepath('ramdisk')): - shutil.copyfile(imagepath("%s/image" % - data['ramdisk_id']), - basepath('ramdisk')) - if data['key_data']: - logging.info('Injecting key data into image %s' % - data['image_id']) - disk.inject_key(data['key_data'], basepath('disk-raw')) - if os.path.exists(basepath('disk')): - os.remove(basepath('disk')) - bytes = INSTANCE_TYPES[data['instance_type']]['local_gb'] * 1024 * 1024 * 1024 - disk.partition(basepath('disk-raw'), basepath('disk'), bytes) - logging.info('Done create image for: %s', data['instance_id']) - except Exception as ex: - return {'exception': ex} - - class Instance(object): NOSTATE = 0x00 @@ -298,16 +244,6 @@ class Instance(object): SHUTOFF = 0x05 CRASHED = 0x06 - def is_pending(self): - return (self.state == Instance.NOSTATE or self.state == 'pending') - - def is_destroyed(self): - return self.state == Instance.SHUTOFF - - def is_running(self): - logging.debug("Instance state is: %s" % self.state) - return (self.state == Instance.RUNNING or self.state == 'running') - def __init__(self, conn, pool, name, data): """ spawn an instance with a given name """ # TODO(termie): pool should probably be a singleton instead of being passed @@ -401,6 +337,16 @@ class Instance(object): def name(self): return self._s['name'] + def is_pending(self): + return (self.state == Instance.NOSTATE or self.state == 'pending') + + def is_destroyed(self): + return self.state == Instance.SHUTOFF + + def is_running(self): + logging.debug("Instance state is: %s" % self.state) + return (self.state == Instance.RUNNING or self.state == 'running') + def describe(self): return self._s @@ -414,6 +360,9 @@ class Instance(object): 'num_cpu': num_cpu, 'cpu_time': cpu_time} + def basepath(self, path=''): + return os.path.abspath(os.path.join(self._s['basepath'], path)) + def update_state(self): info = self.info() self.datamodel['state'] = info['state'] @@ -479,35 +428,89 @@ class Instance(object): logging.debug('rebooted instance %s' % self.name) defer.returnValue(None) - # @exception.wrap_exception + def _fetch_s3_image(self, image, path): + url = _image_url('%s/image' % image) + d = self._pool.simpleExecute('curl --silent %s -o %s' % (url, path)) + return d + + def _fetch_local_image(self, image, path): + source = _image_path('%s/image' % image) + d = self._pool.simpleExecute('cp %s %s' % (source, path)) + return d + + @defer.inlineCallbacks + def _create_image(self, libvirt_xml): + # syntactic nicety + data = self._s + basepath = self.basepath + + # ensure directories exist and are writable + yield self._pool.simpleExecute('mkdir -p %s' % basepath()) + yield self._pool.simpleExecute('chmod 0777 %s' % basepath()) + + + # TODO(termie): these are blocking calls, it would be great + # if they weren't. + logging.info('Creating image for: %s', data['instance_id']) + f = open(basepath('libvirt.xml'), 'w') + f.write(libvirt_xml) + f.close() + + if FLAGS.fake_libvirt: + logging.info('fake_libvirt, nothing to do for create_image') + raise defer.returnValue(None); + + if FLAGS.use_s3: + _fetch_file = self._fetch_s3_image + else: + _fetch_file = self._fetch_local_image + + if not os.path.exists(basepath('disk')): + yield _fetch_file(data['image_id'], basepath('disk-raw')) + if not os.path.exists(basepath('kernel')): + yield _fetch_file(data['kernel_id'], basepath('kernel')) + if not os.path.exists(basepath('ramdisk')): + yield _fetch_file(data['ramdisk_id'], basepath('ramdisk')) + + execute = lambda x: self._pool.simpleExecute(x, 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) + + if os.path.exists(basepath('disk')): + yield self._pool.simpleExecute('rm -f %s' % basepath('disk')) + + bytes = (INSTANCE_TYPES[data['instance_type']]['local_gb'] + * 1024 * 1024 * 1024) + yield disk.partition( + basepath('disk-raw'), basepath('disk'), bytes, execute=execute) + + @defer.inlineCallbacks + @exception.wrap_exception def spawn(self): self.datamodel['state'] = "spawning" self.datamodel.save() logging.debug("Starting spawn in Instance") + xml = self.toXml() - def _launch(retvals): + logging.info('self %s', self) + try: + yield self._create_image(xml) self.datamodel['state'] = 'launching' self.datamodel.save() - try: - logging.debug("Arrived in _launch") - if retvals and 'exception' in retvals: - raise retvals['exception'] - self._conn.createXML(self.toXml(), 0) - # TODO(termie): this should actually register - # a callback to check for successful boot - self._s['state'] = Instance.RUNNING - self.datamodel['state'] = 'running' - self.datamodel.save() - logging.debug("Instance is running") - except Exception as ex: - logging.debug(ex) - self.datamodel['state'] = 'shutdown' - self.datamodel.save() - #return self - - d = self._pool.apply(_create_image, self._s, xml) - d.addCallback(_launch) - return d + self._conn.createXML(xml, 0) + # TODO(termie): this should actually register + # a callback to check for successful boot + self._s['state'] = Instance.RUNNING + self.datamodel['state'] = 'running' + self.datamodel.save() + logging.debug("Instance is running") + except Exception: + #logging.exception('while spawning instance: %s', self.name) + self.datamodel['state'] = 'shutdown' + self.datamodel.save() + raise @exception.wrap_exception def console_output(self): -- cgit From 1a712d9c44aa8124524245ce4744a9c39cee03a6 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 11 Jun 2010 11:13:23 -0700 Subject: fix for reactor.spawnProcess sending deprecation warning --- nova/process.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/nova/process.py b/nova/process.py index b114146ce..8e7efd4ee 100644 --- a/nova/process.py +++ b/nova/process.py @@ -1,12 +1,12 @@ # 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 -# +# # 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. @@ -118,7 +118,7 @@ class BackRelayWithInput(_BackRelay): def errReceivedIsGood(self, text): self.stderr.write(text) - + def connectionMade(self): if self.startedDeferred: self.startedDeferred.callback(self) @@ -151,6 +151,11 @@ def getProcessOutput(executable, args=None, env=None, path=None, reactor=None, d = defer.Deferred() p = BackRelayWithInput( d, startedDeferred=startedDeferred, error_ok=error_ok, input=input) + # VISH: commands come in as unicode, but self.executes needs + # strings or process.spawn raises a deprecation warning + executable = str(executable) + if not args is None: + args = [str(x) for x in args] reactor.spawnProcess(p, executable, (executable,)+tuple(args), env, path) return d @@ -167,7 +172,7 @@ class ProcessPool(object): def simpleExecute(self, cmd, **kw): """ Weak emulation of the old utils.execute() function. - + This only exists as a way to quickly move old execute methods to this new style of code. @@ -190,7 +195,7 @@ class ProcessPool(object): d.process = None d.started = started - + d.addCallback(lambda _: getProcessOutput(*args, **kw)) d.addBoth(self._release) return d -- cgit From 6152e3ab712fd38789ea73515f3957c9817a4dfa Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Sat, 12 Jun 2010 17:06:35 -0700 Subject: update twitter username --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index f1bb2d542..192711204 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ The Choose Your Own Adventure README for Nova: itself as "Nova." It is apparent that it maintains compatability with the popular Amazon EC2 and S3 APIs. -To monitor it from a distance: follow @opennova +To monitor it from a distance: follow @novacc on twitter To tame it for use in your own cloud: read http://docs.novacc.org/getting.started.html -- cgit From 8d06bb6a6adbbe355b3c656fcd807ecc4bbe79af Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Sun, 20 Jun 2010 15:09:17 -0700 Subject: Add a README, because GitHub loves them. Update the getting started docs. --- README | 17 ++++++++++++ docs/getting.started.rst | 70 +++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 75 insertions(+), 12 deletions(-) create mode 100644 README diff --git a/README b/README new file mode 100644 index 000000000..f1bb2d542 --- /dev/null +++ b/README @@ -0,0 +1,17 @@ +The Choose Your Own Adventure README for Nova: + + You have come across a cloud computing fabric controller. It has identified + itself as "Nova." It is apparent that it maintains compatability with + the popular Amazon EC2 and S3 APIs. + +To monitor it from a distance: follow @opennova + +To tame it for use in your own cloud: read http://docs.novacc.org/getting.started.html + +To study its anatomy: read http://docs.novacc.org/architecture.html + +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 diff --git a/docs/getting.started.rst b/docs/getting.started.rst index 777cd32e9..3541b253e 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -19,20 +19,34 @@ Getting Started with Nova GOTTA HAVE A nova.pth file added or it WONT WORK (will write setup.py file soon) +Create a file named nova.pth in your python libraries directory +(usually /usr/local/lib/python2.6/dist-packages) with a single line that points +to the directory where you checked out the source (that contains the nova/ +directory). + DEPENDENCIES ------------ +Related servers we rely on + * RabbitMQ: messaging queue, used for all communication between components * OpenLDAP: users, groups (maybe cut) +* ReDIS: Remote Dictionary Store (for fast, shared state data) + +Python libraries we don't vendor + +* M2Crypto: python library interface for openssl + +Vendored python libaries (don't require any installation) + * Tornado: scalable non blocking web server for api requests * Twisted: just for the twisted.internet.defer package * boto: python api for aws api -* M2Crypto: python library interface for openssl * IPy: library for managing ip addresses -* ReDIS: Remote Dictionary Store (for fast, shared state data) Recommended ----------------- + * euca2ools: python implementation of aws ec2-tools and ami tools * build tornado to use C module for evented section @@ -41,16 +55,17 @@ Installation -------------- :: - # ON ALL SYSTEMS - apt-get install -y python-libvirt libvirt-bin python-setuptools python-dev python-pycurl python-m2crypto python-twisted - apt-get install -y aoetools vlan + # system libraries and tools + apt-get install -y libvirt-bin aoetools vlan modprobe aoe + # python libraries + apt-get install -y python-libvirt python-setuptools python-dev python-pycurl python-m2crypto + + # ON THE CLOUD CONTROLLER apt-get install -y rabbitmq-server dnsmasq - # fix ec2 metadata/userdata uri - where $IP is the IP of the cloud - iptables -t nat -A PREROUTING -s 0.0.0.0/0 -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination $IP:8773 - iptables --table nat --append POSTROUTING --out-interface $PUBLICIFACE -j MASQUERADE + # build redis from 2.0.0-rc1 source # setup ldap (slap.sh as root will remove ldap and reinstall it) auth/slap.sh /etc/init.d/rabbitmq-server start @@ -64,7 +79,38 @@ Installation # optional packages apt-get install -y euca2ools - # Set up flagfiles with the appropriate hostnames, etc. - # start api_worker, s3_worker, node_worker, storage_worker - # Add yourself to the libvirtd group, log out, and log back in - # Make sure the user who will launch the workers has sudo privileges w/o pass (will fix later) +Configuration +--------------- + +ON CLOUD CONTROLLER + +* Add yourself to the libvirtd group, log out, and log back in +* fix hardcoded ec2 metadata/userdata uri ($IP is the IP of the cloud), and masqurade all traffic from launched instances +:: + + iptables -t nat -A PREROUTING -s 0.0.0.0/0 -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination $IP:8773 + iptables --table nat --append POSTROUTING --out-interface $PUBLICIFACE -j MASQUERADE + +ON VOLUME NODE + +* create a filesystem (you can use an actual disk if you have one spare, default is /dev/sdb) + +:: + + # This creates a 1GB file to create volumes out of + dd if=/dev/zero of=MY_FILE_PATH bs=100M count=10 + losetup --show -f MY_FILE_PATH + echo "--storage_dev=/dev/loop0" >> NOVA_PATH/bin/nova.conf + +Launch servers + +* rabbitmq +* redis +* slapd + +Launch nova components + +* api_worker +* s3_worker +* node_worker +* storage_worker -- cgit From 605b3ea799053a15006ba70a202e0d303836acee Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Sun, 20 Jun 2010 15:09:17 -0700 Subject: More doc updates: nginx & pycurl. --- docs/getting.started.rst | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/getting.started.rst b/docs/getting.started.rst index 3541b253e..323ebf249 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -32,10 +32,12 @@ Related servers we rely on * RabbitMQ: messaging queue, used for all communication between components * OpenLDAP: users, groups (maybe cut) * ReDIS: Remote Dictionary Store (for fast, shared state data) +* nginx: HTTP server to handle serving large files (because Tornado can't) Python libraries we don't vendor * M2Crypto: python library interface for openssl +* curl Vendored python libaries (don't require any installation) @@ -62,12 +64,11 @@ Installation # python libraries apt-get install -y python-libvirt python-setuptools python-dev python-pycurl python-m2crypto - # ON THE CLOUD CONTROLLER - apt-get install -y rabbitmq-server dnsmasq + apt-get install -y rabbitmq-server dnsmasq nginx # build redis from 2.0.0-rc1 source # setup ldap (slap.sh as root will remove ldap and reinstall it) - auth/slap.sh + NOVA_PATH/nova/auth/slap.sh /etc/init.d/rabbitmq-server start # ON VOLUME NODE: @@ -91,6 +92,25 @@ ON CLOUD CONTROLLER iptables -t nat -A PREROUTING -s 0.0.0.0/0 -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination $IP:8773 iptables --table nat --append POSTROUTING --out-interface $PUBLICIFACE -j MASQUERADE + +* Configure NginX proxy (/etc/nginx/sites-enabled/default):: + server { + listen 3333 default; + server-name localhost; + client_max_body_size 10m; + + access_log /var/log/nginx/localhost.access.log; + + location ~ /_images/.+ { + root NOVA_PATH/images; + rewrite ^/_images/(.*)\$ /\$1 break; + } + + location / { + proxy_pass http://localhost:3334/; + } + } + ON VOLUME NODE * create a filesystem (you can use an actual disk if you have one spare, default is /dev/sdb) @@ -107,6 +127,7 @@ Launch servers * rabbitmq * redis * slapd +* nginx Launch nova components -- cgit From e27df0af7b832d2daf8020e09ee26bb9ae3a2455 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Sun, 20 Jun 2010 15:09:17 -0700 Subject: Make nginx config be in a code block. --- docs/getting.started.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/getting.started.rst b/docs/getting.started.rst index 323ebf249..446e5f6b7 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -93,7 +93,10 @@ ON CLOUD CONTROLLER iptables --table nat --append POSTROUTING --out-interface $PUBLICIFACE -j MASQUERADE -* Configure NginX proxy (/etc/nginx/sites-enabled/default):: +* Configure NginX proxy (/etc/nginx/sites-enabled/default) + +:: + server { listen 3333 default; server-name localhost; -- cgit From a34f3b8d57354dad42c048de939b97a14a93f8fa Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Sun, 20 Jun 2010 15:09:17 -0700 Subject: make a "Running" topic instead of having it flow under "Configuration". --- docs/getting.started.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/getting.started.rst b/docs/getting.started.rst index 446e5f6b7..708e75e16 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -125,6 +125,9 @@ ON VOLUME NODE losetup --show -f MY_FILE_PATH echo "--storage_dev=/dev/loop0" >> NOVA_PATH/bin/nova.conf +Running +--------- + Launch servers * rabbitmq -- cgit From 13aef6666a17dbbe0c4645a30654ba023b9a434e Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Sun, 20 Jun 2010 15:09:17 -0700 Subject: update twitter username --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index f1bb2d542..192711204 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ The Choose Your Own Adventure README for Nova: itself as "Nova." It is apparent that it maintains compatability with the popular Amazon EC2 and S3 APIs. -To monitor it from a distance: follow @opennova +To monitor it from a distance: follow @novacc on twitter To tame it for use in your own cloud: read http://docs.novacc.org/getting.started.html -- cgit From 5a4e4ecb28b338715c1b69a70887b9cf740cb0f7 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Sun, 20 Jun 2010 15:09:17 -0700 Subject: implement image serving in objectstore so nginx isn't required in development reviewed by yosh --- nova/objectstore/handler.py | 26 ++++++++++++++++++++++++++ nova/objectstore/image.py | 4 ++++ 2 files changed, 30 insertions(+) diff --git a/nova/objectstore/handler.py b/nova/objectstore/handler.py index a7fff12fc..3f00bb0c4 100644 --- a/nova/objectstore/handler.py +++ b/nova/objectstore/handler.py @@ -71,6 +71,7 @@ class Application(web.Application): def __init__(self, user_manager): web.Application.__init__(self, [ (r"/", RootHandler), + (r"/_images/(.+)", ImageDownloadHandler), (r"/_images/", ImageHandler), (r"/([^/]+)/(.+)", ObjectHandler), (r"/([^/]+)/", BucketHandler), @@ -224,6 +225,31 @@ class ObjectHandler(BaseRequestHandler): self.finish() +class ImageDownloadHandler(BaseRequestHandler): + SUPPORTED_METHODS = ("GET", ) + + @catch_nova_exceptions + def get(self, image_id): + """ send the decrypted image file + + streaming content through python is slow and should only be used + in development mode. You should serve files via a web server + in production. + """ + + self.set_header("Content-Type", "application/octet-stream") + + READ_SIZE = 64*1024 + + img = image.Image(image_id) + with open(img.image_path, 'rb') as fp: + s = fp.read(READ_SIZE) + while s: + self.write(s) + s = fp.read(READ_SIZE) + + self.finish() + class ImageHandler(BaseRequestHandler): SUPPORTED_METHODS = ("POST", "PUT", "GET", "DELETE") diff --git a/nova/objectstore/image.py b/nova/objectstore/image.py index 892ada00c..b8dae4077 100644 --- a/nova/objectstore/image.py +++ b/nova/objectstore/image.py @@ -47,6 +47,10 @@ class Image(object): not os.path.isdir(self.path): raise exception.NotFound + @property + def image_path(self): + return os.path.join(self.path, 'image') + def delete(self): for fn in ['info.json', 'image']: try: -- cgit From 6ad8e8f8a6aa23b4d439db0a053f6b9c7c87fe19 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Sun, 20 Jun 2010 15:09:58 -0700 Subject: update spacing --- docs/getting.started.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/getting.started.rst b/docs/getting.started.rst index 708e75e16..d6d76031b 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -1,12 +1,12 @@ .. 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. @@ -67,19 +67,19 @@ Installation # ON THE CLOUD CONTROLLER apt-get install -y rabbitmq-server dnsmasq nginx # build redis from 2.0.0-rc1 source - # setup ldap (slap.sh as root will remove ldap and reinstall it) + # setup ldap (slap.sh as root will remove ldap and reinstall it) NOVA_PATH/nova/auth/slap.sh /etc/init.d/rabbitmq-server start # ON VOLUME NODE: - apt-get install -y vblade-persist + apt-get install -y vblade-persist # ON THE COMPUTE NODE: apt-get install -y kpartx kvm # optional packages - apt-get install -y euca2ools - + apt-get install -y euca2ools + Configuration --------------- @@ -137,7 +137,7 @@ Launch servers Launch nova components -* api_worker -* s3_worker -* node_worker -* storage_worker +* nova-api +* nova-compute +* nova-objectstore +* nova-volume -- cgit From 64f42387406b15aeeef30a6b439c24d3c36f7726 Mon Sep 17 00:00:00 2001 From: Devin Carlen Date: Tue, 22 Jun 2010 21:36:37 -0700 Subject: Create DescribeImageAttribute api method --- nova/endpoint/cloud.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index e8f2fa347..613dd8dd5 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -531,6 +531,30 @@ class CloudController(object): return defer.succeed({'imageId': image_id}) + def describe_image_attribute(self, context, image_id, attribute, **kwargs): + if attribute != 'launchPermission': + raise exception.ApiError('attribute not supported: %s' % attribute) + try: + image = images.list(context, image_id)[0] + except IndexError: + raise exception.ApiError('invalid id: %s' % image_id) + result = { 'image_id': image_id, 'launchPermission': [] } + if image['isPublic']: + result['launchPermission'].append({ 'group': 'all' }) + + return defer.succeed(result) + + def modify_image_attribute(self, context, image_id, attribute, operation_type, **kwargs): + # TODO(devcamcar): Support users and groups other than 'all'. + if attribute != 'launchPermission': + raise exception.ApiError('attribute not supported: %s' % attribute) + if len(kwargs['user_group']) != 1 and kwargs['user_group'][0] != 'all': + raise exception.ApiError('only group "all" is supported') + if not operation_type in ['add', 'remove']: + raise exception.ApiError('operation_type must be add or remove') + result = images.modify(context, image_id, operation_type) + return defer.succeed(result) + def modify_image_attribute(self, context, image_id, attribute, operation_type, **kwargs): if attribute != 'launchPermission': raise exception.ApiError('only launchPermission is supported') -- cgit From 267894aeb275d008cec1420be62a2b7ba502d271 Mon Sep 17 00:00:00 2001 From: Devin Carlen Date: Tue, 22 Jun 2010 21:42:58 -0700 Subject: Create DescribeImageAttribute api method --- nova/endpoint/cloud.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 613dd8dd5..8046d42e8 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -555,16 +555,6 @@ class CloudController(object): result = images.modify(context, image_id, operation_type) return defer.succeed(result) - def modify_image_attribute(self, context, image_id, attribute, operation_type, **kwargs): - if attribute != 'launchPermission': - raise exception.ApiError('only launchPermission is supported') - if len(kwargs['user_group']) != 1 and kwargs['user_group'][0] != 'all': - raise exception.ApiError('only group "all" is supported') - if not operation_type in ['add', 'delete']: - raise exception.ApiError('operation_type must be add or delete') - result = images.modify(context, image_id, operation_type) - return defer.succeed(result) - def update_state(self, topic, value): """ accepts status reports from the queue and consolidates them """ # TODO(jmc): if an instance has disappeared from -- cgit From ef3dc9f148b711d6b5ffe15f4761ad87e1cb6617 Mon Sep 17 00:00:00 2001 From: Devin Carlen Date: Wed, 23 Jun 2010 12:18:36 -0700 Subject: Initial commit of nodemonitor --- bin/nova-instancemonitor | 50 +++++ nova/compute/monitor.py | 511 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 561 insertions(+) create mode 100755 bin/nova-instancemonitor create mode 100644 nova/compute/monitor.py diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor new file mode 100755 index 000000000..2cfd5fc35 --- /dev/null +++ b/bin/nova-instancemonitor @@ -0,0 +1,50 @@ +#!/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 +# +# 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. +""" + Daemon for Nova RRD based instance resource monitoring. +""" + +import logging + +from nova import vendor +from twisted.internet import task +from twisted.application import service + +from nova import twistd +from nova.compute import monitor + +logging.getLogger('boto').setLevel(logging.WARN) + +def main(): + logging.warn('Starting instance monitor') + m = monitor.InstanceMonitor() + + # This is the parent service that twistd will be looking for when it + # parses this file, return it so that we can get it into globals below + application = service.Application('nova-instancemonitor') + m.setServiceParent(application) + return application + +if __name__ == '__main__': + twistd.serve(__file__) + +if __name__ == '__builtin__': + application = main() + + + + diff --git a/nova/compute/monitor.py b/nova/compute/monitor.py new file mode 100644 index 000000000..4a3b43991 --- /dev/null +++ b/nova/compute/monitor.py @@ -0,0 +1,511 @@ +# 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 +# +# 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. + +""" +Instance Monitoring: + + Optionally may be run on each compute node. Provides RRD + based statistics and graphs and makes them internally available + in the object store. +""" + +import datetime +import logging +import os +import sys +import time + +try: + import libvirt +except Exception, err: + logging.warning('no libvirt found') + +from nova import flags +from nova import vendor +import boto +import boto.s3 +import libxml2 +import rrdtool +from twisted.internet import defer +from twisted.internet import task +from twisted.application import service + +FLAGS = flags.FLAGS +flags.DEFINE_integer( + 'monitoring_instances_delay', 5, 'Sleep time between updates') +flags.DEFINE_integer( + 'monitoring_instances_step', 300, 'Interval of RRD updates') +flags.DEFINE_string( + 'monitoring_rrd_path', '/var/nova/monitor/instances', + 'Location of RRD files') + + +RRD_VALUES = { + 'cpu': [ + 'DS:cpu:GAUGE:600:0:100', + 'RRA:AVERAGE:0.5:1:800', + 'RRA:AVERAGE:0.5:6:800', + 'RRA:AVERAGE:0.5:24:800', + 'RRA:AVERAGE:0.5:288:800', + 'RRA:MAX:0.5:1:800', + 'RRA:MAX:0.5:6:800', + 'RRA:MAX:0.5:24:800', + 'RRA:MAX:0.5:288:800', + ], + 'net': [ + 'DS:rx:COUNTER:600:0:1250000', + 'DS:tx:COUNTER:600:0:1250000', + 'RRA:AVERAGE:0.5:1:800', + 'RRA:AVERAGE:0.5:6:800', + 'RRA:AVERAGE:0.5:24:800', + 'RRA:AVERAGE:0.5:288:800', + 'RRA:MAX:0.5:1:800', + 'RRA:MAX:0.5:6:800', + 'RRA:MAX:0.5:24:800', + 'RRA:MAX:0.5:288:800', + ], + 'disk': [ + 'DS:rd:COUNTER:600:U:U', + 'DS:wr:COUNTER:600:U:U', + 'RRA:AVERAGE:0.5:1:800', + 'RRA:AVERAGE:0.5:6:800', + 'RRA:AVERAGE:0.5:24:800', + 'RRA:AVERAGE:0.5:288:800', + 'RRA:MAX:0.5:1:800', + 'RRA:MAX:0.5:6:800', + 'RRA:MAX:0.5:24:800', + 'RRA:MAX:0.5:444:800', + ] +} + + +utcnow = datetime.datetime.utcnow + +def update_rrd(instance, name, data): + """ + Updates the specified RRD file. + """ + filename = os.path.join(instance.get_rrd_path(), '%s.rrd' % name) + + if not os.path.exists(filename): + init_rrd(instance, name) + + timestamp = int(time.mktime(utcnow().timetuple())) + rrdtool.update ( + filename, + '%d:%s' % (timestamp, data) + ) + +def init_rrd(instance, name): + """ + Initializes the specified RRD file. + """ + path = os.path.join(FLAGS.monitoring_rrd_path, instance.instance_id) + + if not os.path.exists(path): + os.makedirs(path) + + filename = os.path.join(path, '%s.rrd' % name) + + if not os.path.exists(filename): + rrdtool.create ( + filename, + '--step', '%d' % FLAGS.monitoring_instances_step, + '--start', '0', + *RRD_VALUES[name] + ) + +def get_disks(domain): + """ + Returns a list of all block devices for this domain. + """ + # TODO(devcamcar): Replace libxml2 with etree. + xml = domain.XMLDesc(0) + doc = None + + try: + doc = libxml2.parseDoc(xml) + except: + return [] + + ctx = doc.xpathNewContext() + disks = [] + + try: + ret = ctx.xpathEval('/domain/devices/disk') + + for node in ret: + devdst = None + + for child in node.children: + if child.name == 'target': + devdst = child.prop('dev') + + if devdst == None: + continue + + disks.append(devdst) + finally: + if ctx != None: + ctx.xpathFreeContext() + if doc != None: + doc.freeDoc() + + return disks + +def get_interfaces(domain): + """ + Returns a list of all network interfaces for this instance. + """ + # TODO(devcamcar): Replace libxml2 with etree. + xml = domain.XMLDesc(0) + doc = None + + try: + doc = libxml2.parseDoc(xml) + except: + return [] + + ctx = doc.xpathNewContext() + interfaces = [] + + try: + ret = ctx.xpathEval('/domain/devices/interface') + + for node in ret: + devdst = None + + for child in node.children: + if child.name == 'target': + devdst = child.prop('dev') + + if devdst == None: + continue + + interfaces.append(devdst) + finally: + if ctx != None: + ctx.xpathFreeContext() + if doc != None: + doc.freeDoc() + + return interfaces + + +def graph_cpu(instance, duration): + """ + Creates a graph of cpu usage for the specified instance and duration. + """ + path = instance.get_rrd_path() + filename = os.path.join(path, 'cpu-%s.png' % duration) + + rrdtool.graph ( + filename, + '--disable-rrdtool-tag', + '--imgformat', 'PNG', + '--width', '400', + '--height', '120', + '--start', 'now-%s' % duration, + '--vertical-label', '% cpu used', + '-l', '0', + '-u', '100', + 'DEF:cpu=%s:cpu:AVERAGE' % os.path.join(path, 'cpu.rrd'), + 'AREA:cpu#eacc00:% CPU', + ) + + store_graph(instance.instance_id, filename) + +def graph_net(instance, duration): + """ + Creates a graph of network usage for the specified instance and duration. + """ + path = instance.get_rrd_path() + filename = os.path.join(path, 'net-%s.png' % duration) + + rrdtool.graph ( + filename, + '--disable-rrdtool-tag', + '--imgformat', 'PNG', + '--width', '400', + '--height', '120', + '--start', 'now-%s' % duration, + '--vertical-label', 'bytes/s', + '--logarithmic', + '--units', 'si', + '--lower-limit', '1000', + '--rigid', + 'DEF:rx=%s:rx:AVERAGE' % os.path.join(path, 'net.rrd'), + 'DEF:tx=%s:tx:AVERAGE' % os.path.join(path, 'net.rrd'), + 'AREA:rx#00FF00:In traffic', + 'LINE1:tx#0000FF:Out traffic', + ) + + store_graph(instance.instance_id, filename) + +def graph_disk(instance, duration): + """ + Creates a graph of disk usage for the specified duration. + """ + path = instance.get_rrd_path() + filename = os.path.join(path, 'disk-%s.png' % duration) + + rrdtool.graph ( + filename, + '--disable-rrdtool-tag', + '--imgformat', 'PNG', + '--width', '400', + '--height', '120', + '--start', 'now-%s' % duration, + '--vertical-label', 'bytes/s', + '--logarithmic', + '--units', 'si', + '--lower-limit', '1000', + '--rigid', + 'DEF:rd=%s:rd:AVERAGE' % os.path.join(path, 'disk.rrd'), + 'DEF:wr=%s:wr:AVERAGE' % os.path.join(path, 'disk.rrd'), + 'AREA:rd#00FF00:Read', + 'LINE1:wr#0000FF:Write', + ) + + store_graph(instance.instance_id, filename) + +def store_graph(instance_id, filename): + """ + Transmits the specified graph file to internal object store on cloud + controller. + """ + # TODO(devcamcar): Need to use an asynchronous method to make this + # connection. If boto has some separate method that generates + # the request it would like to make and another method to parse + # the response we can make our own client that does the actual + # request and hands it off to the response parser. + s3 = boto.s3.connection.S3Connection( + aws_access_key_id='admin', + aws_secret_access_key='admin', + is_secure=False, + calling_format=boto.s3.connection.OrdinaryCallingFormat(), + port=FLAGS.s3_port, + host=FLAGS.s3_host + ) + bucket_name = '_%s.monitor' % instance_id + + # Object store isn't creating the bucket like it should currently + # when it is first requested, so have to catch and create manually. + try: + bucket = s3.get_bucket(bucket_name) + except Exception: + bucket = s3.create_bucket(bucket_name) + + key = boto.s3.Key(bucket) + key.key = os.path.basename(filename) + key.set_contents_from_filename(filename) + + +class Instance(object): + def __init__(self, conn, domain): + self.conn = conn + self.domain = domain + self.instance_id = domain.name() + self.last_updated = datetime.datetime.min + self.cputime = 0 + self.cputime_last_updated = None + + init_rrd(self, 'cpu') + init_rrd(self, 'net') + init_rrd(self, 'disk') + + def needs_update(self): + """ + Indicates whether this instance is due to have its statistics updated. + """ + delta = utcnow() - self.last_updated + return delta.seconds >= FLAGS.monitoring_instances_step + + def update(self): + """ + Updates the instances statistics and stores the resulting graphs + in the internal object store on the cloud controller. + """ + logging.debug('updating %s...', self.instance_id) + + try: + data = self.fetch_cpu_stats() + if data != None: + logging.debug('CPU: %s', data) + update_rrd(self, 'cpu', data) + + data = self.fetch_net_stats() + logging.debug('NET: %s', data) + update_rrd(self, 'net', data) + + data = self.fetch_disk_stats() + logging.debug('DISK: %s', data) + update_rrd(self, 'disk', data) + + # TODO(devcamcar): Turn these into pool.ProcessPool.execute() calls + # and make the methods @defer.inlineCallbacks. + graph_cpu(self, '1d') + graph_cpu(self, '1w') + graph_cpu(self, '1m') + + graph_net(self, '1d') + graph_net(self, '1w') + graph_net(self, '1m') + + graph_disk(self, '1d') + graph_disk(self, '1w') + graph_disk(self, '1m') + except Exception: + logging.exception('unexpected error during update') + + self.last_updated = utcnow() + + def get_rrd_path(self): + """ + Returns the path to where RRD files are stored. + """ + return os.path.join(FLAGS.monitoring_rrd_path, self.instance_id) + + def fetch_cpu_stats(self): + """ + Returns cpu usage statistics for this instance. + """ + info = self.domain.info() + + # Get the previous values. + cputime_last = self.cputime + cputime_last_updated = self.cputime_last_updated + + # Get the raw CPU time used in nanoseconds. + self.cputime = float(info[4]) + self.cputime_last_updated = utcnow() + + logging.debug('CPU: %d', self.cputime) + + # Skip calculation on first pass. Need delta to get a meaningful value. + if cputime_last_updated == None: + return None + + # Calculate the number of seconds between samples. + d = self.cputime_last_updated - cputime_last_updated + t = d.days * 86400 + d.seconds + + logging.debug('t = %d', t) + + # Calculate change over time in number of nanoseconds of CPU time used. + cputime_delta = self.cputime - cputime_last + + logging.debug('cputime_delta = %s', cputime_delta) + + # Get the number of virtual cpus in this domain. + vcpus = int(info[3]) + + logging.debug('vcpus = %d', vcpus) + + # Calculate CPU % used and cap at 100. + return min(cputime_delta / (t * vcpus * 1.0e9) * 100, 100) + + def fetch_disk_stats(self): + """ + Returns disk usage statistics for this instance. + """ + rd = 0 + wr = 0 + + # Get a list of block devices for this instance. + disks = get_disks(self.domain) + + # Aggregate the read and write totals. + for disk in disks: + try: + rd_req, rd_bytes, wr_req, wr_bytes, errs = \ + self.domain.blockStats(disk) + rd += rd_bytes + wr += wr_bytes + except TypeError: + logging.error('Cannot get blockstats for "%s" on "%s"', + disk, self.instance_id) + raise + + return '%d:%d' % (rd, wr) + + def fetch_net_stats(self): + """ + Returns network usage statistics for this instance. + """ + rx = 0 + tx = 0 + + # Get a list of all network interfaces for this instance. + interfaces = get_interfaces(self.domain) + + # Aggregate the in and out totals. + for interface in interfaces: + try: + stats = self.domain.interfaceStats(interface) + rx += stats[0] + tx += stats[4] + except TypeError: + logging.error('Cannot get ifstats for "%s" on "%s"', + interface, self.instance_id) + raise + + return '%d:%d' % (rx, tx) + + +class InstanceMonitor(object, service.Service): + """ + Monitors the running instances of the current machine. + """ + def __init__(self): + """ + Initialize the monitoring loop. + """ + self._instances = {} + self._loop = task.LoopingCall(self.updateInstances) + + def startService(self): + self._instances = {} + self._loop.start(interval=FLAGS.monitoring_instances_delay) + service.Service.startService(self) + + def stopService(self): + self._loop.stop() + service.Service.stopService(self) + + def updateInstances(self): + """ + Update resource usage for all running instances. + """ + try: + conn = libvirt.openReadOnly(None) + except libvirt.libvirtError: + logging.exception('unexpected libvirt error') + time.sleep(FLAGS.monitoring_instances_delay) + return + + domain_ids = conn.listDomainsID() + + for domain_id in domain_ids: + if not domain_id in self._instances: + domain = conn.lookupByID(domain_id) + instance = Instance(conn, domain) + self._instances[domain_id] = instance + logging.debug('Found instance: %s', instance.instance_id) + + for key in self._instances.keys(): + instance = self._instances[key] + if instance.needs_update(): + instance.update() -- cgit From a57ae2808fd983f4f5e36a0b5cac527f54b72265 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Thu, 24 Jun 2010 01:46:02 +0100 Subject: fix a bug with AOE number generation --- nova/volume/storage.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nova/volume/storage.py b/nova/volume/storage.py index cf64b995f..c2affe3ee 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -243,9 +243,12 @@ class FakeVolume(Volume): pass def get_next_aoe_numbers(): - aoes = glob.glob("/var/lib/vblade-persist/vblades/e*") - aoes.extend(['e0.0']) - blade_id = int(max([int(a.split('.')[1]) for a in aoes])) + 1 - logging.debug("Next blade_id is %s" % (blade_id)) + aoes = subprocess.Popen("sudo ls -1 /var/lib/vblade-persist/vblades/", shell=True, stdout=subprocess.PIPE).communicate()[0] + last_aoe = aoes.strip().split("\n")[-1] + if last_aoe == '': + last_aoe = 'e0.0' + logging.debug("Last aoe is %s" % (last_aoe)) + blade_id = last_aoe.rpartition(".")[2] shelf_id = FLAGS.shelf_id + blade_id = int(blade_id) + 1 return (shelf_id, blade_id) -- cgit From 5a40f59be9214821e150cff8232cebde54bc6012 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Thu, 24 Jun 2010 04:11:49 +0100 Subject: tools to clean vlans and run our old install script --- tools/clean-vlans | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 tools/clean-vlans diff --git a/tools/clean-vlans b/tools/clean-vlans new file mode 100755 index 000000000..39010ba1d --- /dev/null +++ b/tools/clean-vlans @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +sudo ifconfig -a | grep br | grep -v bridge | cut -f1 -d" " | xargs -n1 -ifoo ifconfig foo down +sudo ifconfig -a | grep br | grep -v bridge | cut -f1 -d" " | xargs -n1 -ifoo brctl delbr foo +sudo ifconfig -a | grep vlan | grep -v vlan124 | grep -v vlan5 | cut -f1 -d" " | xargs -n1 -ifoo ifconfig foo down +sudo ifconfig -a | grep vlan | grep -v vlan124 | grep -v vlan5 | cut -f1 -d" " | xargs -n1 -ifoo vconfig rem foo -- cgit From 6dc4d23e01d1fcd8aa27d34d8b3b2cba5eac9573 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Thu, 24 Jun 2010 04:11:53 +0100 Subject: devin's smoketests --- smoketests/README | 6 + smoketests/novatestcase.py | 117 ++++++++ smoketests/openwrt-x86-ext2.image | Bin 0 -> 4612608 bytes smoketests/openwrt-x86-vmlinuz | Bin 0 -> 1169948 bytes smoketests/smoketest.py | 543 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 666 insertions(+) create mode 100644 smoketests/README create mode 100644 smoketests/novatestcase.py create mode 100644 smoketests/openwrt-x86-ext2.image create mode 100644 smoketests/openwrt-x86-vmlinuz create mode 100644 smoketests/smoketest.py diff --git a/smoketests/README b/smoketests/README new file mode 100644 index 000000000..1a357c672 --- /dev/null +++ b/smoketests/README @@ -0,0 +1,6 @@ +a test suite to run against a deployed cloud + +THIS IS NASA CODE! + +It will need to be opensourced by the NASA legal process before it is in the open source +release diff --git a/smoketests/novatestcase.py b/smoketests/novatestcase.py new file mode 100644 index 000000000..d83359920 --- /dev/null +++ b/smoketests/novatestcase.py @@ -0,0 +1,117 @@ +# COPYRIGHT NASA + +import os, unittest, sys +from commands import getstatusoutput +from paramiko import SSHClient, RSAKey, AutoAddPolicy +import random + +BUCKET_NAME = 'smoketest' + +try: + # pulling from environment means euca-bundle and other shell commands + # are runable without futzing with the environment and zip files + access_key = os.environ['EC2_ACCESS_KEY'] + secret_key = os.environ['EC2_SECRET_KEY'] + endpoint = os.environ['EC2_URL'] + host = endpoint.split('/')[2].split(':')[0] # http://HOST:8773/services/Cloud +except: + print 'you need to source admin rc before running smoketests' + sys.exit(2) + +from nova.adminclient import NovaAdminClient +admin = NovaAdminClient(access_key=access_key, secret_key=secret_key, clc_ip=host) + +class NovaTestCase(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + pass + + def connect_ssh(self, ip, key_name): + # TODO: set a more reasonable connection timeout time + key = RSAKey.from_private_key_file('/tmp/%s.pem' % key_name) + client = SSHClient() + client.load_system_host_keys() + client.set_missing_host_key_policy(AutoAddPolicy()) + client.connect(ip, username='ubuntu', pkey=key) + stdin, stdout, stderr = client.exec_command('uptime') + print 'uptime: ', stdout.read() + return client + + def can_ping(self, ip): + return getstatusoutput('ping -c 1 %s' % ip)[0] == 0 + + @property + def admin(self): + return admin.connection_for('admin') + + def connection_for(self, username): + return admin.connection_for(username) + + def create_user(self, username): + return admin.create_user(username) + + def get_user(self, username): + return admin.get_user(username) + + def delete_user(self, username): + return admin.delete_user(username) + + def get_signed_zip(self, username): + return admin.get_zip(username) + + def create_key_pair(self, conn, key_name): + try: + os.remove('/tmp/%s.pem' % key_name) + except: + pass + key = conn.create_key_pair(key_name) + key.save('/tmp/') + return key + + def delete_key_pair(self, conn, key_name): + conn.delete_key_pair(key_name) + try: + os.remove('/tmp/%s.pem' % key_name) + except: + pass + + def bundle_image(self, image, kernel=False): + cmd = 'euca-bundle-image -i %s' % image + if kernel: + cmd += ' --kernel true' + status, output = getstatusoutput(cmd) + if status != 0: + print '%s -> \n %s' % (cmd, output) + raise Exception(output) + return True + + def upload_image(self, bucket_name, image): + cmd = 'euca-upload-bundle -b %s -m /tmp/%s.manifest.xml' % (bucket_name, image) + status, output = getstatusoutput(cmd) + if status != 0: + print '%s -> \n %s' % (cmd, output) + raise Exception(output) + return True + + def delete_bundle_bucket(self, bucket_name): + cmd = 'euca-delete-bundle --clear -b %s' % (bucket_name) + status, output = getstatusoutput(cmd) + if status != 0: + print '%s -> \n%s' % (cmd, output) + raise Exception(output) + return True + + def register_image(self, bucket_name, manifest): + conn = admin.connection_for('admin') + return conn.register_image("%s/%s.manifest.xml" % (bucket_name, manifest)) + + def setUp_test_image(self, image, kernel=False): + self.bundle_image(image, kernel=kernel) + bucket = "auto_test_%s" % int(random.random() * 1000000) + self.upload_image(bucket, image) + return self.register_image(bucket, image) + + def tearDown_test_image(self, conn, image_id): + conn.deregister_image(image_id) diff --git a/smoketests/openwrt-x86-ext2.image b/smoketests/openwrt-x86-ext2.image new file mode 100644 index 000000000..cd2dfa426 Binary files /dev/null and b/smoketests/openwrt-x86-ext2.image differ diff --git a/smoketests/openwrt-x86-vmlinuz b/smoketests/openwrt-x86-vmlinuz new file mode 100644 index 000000000..59cc9bb1f Binary files /dev/null and b/smoketests/openwrt-x86-vmlinuz differ diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py new file mode 100644 index 000000000..dc653dc9f --- /dev/null +++ b/smoketests/smoketest.py @@ -0,0 +1,543 @@ +# COPYRIGHT NASA + +import os, re, sys, time, unittest, random +from novatestcase import NovaTestCase +from commands import getstatusoutput +from paramiko import SSHException +from zipfile import ZipFile, ZIP_DEFLATED + +# TODO: Make endpoint configurable + +DEBUG = True + +KERNEL_FILENAME = 'openwrt-x86-vmlinuz' +IMAGE_FILENAME = 'openwrt-x86-ext2.image' + +ZIP_FILENAME = '/tmp/nova-x509.zip' + +data = {} + +test_prefix = 'test%s' % int(random.random()*1000000) +test_username = '%suser' % test_prefix +test_bucket = '%s_bucket' % test_prefix +test_key = '%s_key' % test_prefix + +# Test admin credentials and user creation +class UserTests(NovaTestCase): + def test_001_admin_can_connect(self): + conn = self.connection_for('admin') + self.assert_(conn) + + def test_002_admin_can_create_user(self): + userinfo = self.create_user(test_username) + self.assertEqual(userinfo.username, test_username) + + def test_003_user_can_download_credentials(self): + buf = self.get_signed_zip(test_username) + output = open(ZIP_FILENAME, 'w') + output.write(buf) + output.close() + + zip = ZipFile(ZIP_FILENAME, 'a', ZIP_DEFLATED) + bad = zip.testzip() + zip.close() + + self.failIf(bad) + + def test_999_tearDown(self): + self.delete_user(test_username) + user = self.get_user(test_username) + self.assert_(user is None) + try: + os.remove(ZIP_FILENAME) + except: + pass + +# Test image bundling, registration, and launching +class ImageTests(NovaTestCase): + def test_000_setUp(self): + self.create_user(test_username) + + def test_001_admin_can_bundle_image(self): + self.assertTrue(self.bundle_image(IMAGE_FILENAME)) + + def test_002_admin_can_upload_image(self): + self.assertTrue(self.upload_image(test_bucket, IMAGE_FILENAME)) + + def test_003_admin_can_register_image(self): + image_id = self.register_image(test_bucket, IMAGE_FILENAME) + self.assert_(image_id is not None) + data['image_id'] = image_id + + def test_004_admin_can_bundle_kernel(self): + self.assertTrue(self.bundle_image(KERNEL_FILENAME, kernel=True)) + + def test_005_admin_can_upload_kernel(self): + self.assertTrue(self.upload_image(test_bucket, KERNEL_FILENAME)) + + def test_006_admin_can_register_kernel(self): + # FIXME: registeration should verify that bucket/manifest exists before returning successfully! + kernel_id = self.register_image(test_bucket, KERNEL_FILENAME) + self.assert_(kernel_id is not None) + data['kernel_id'] = kernel_id + + def test_007_admin_images_are_available_within_10_seconds(self): + for i in xrange(10): + image = self.admin.get_image(data['image_id']) + if image and image.state == 'available': + break + time.sleep(1) + else: + print image.state + self.assert_(False) # wasn't available within 10 seconds + self.assert_(image.type == 'machine') + + for i in xrange(10): + kernel = self.admin.get_image(data['kernel_id']) + if kernel and kernel.state == 'available': + break + time.sleep(1) + else: + self.assert_(False) # wasn't available within 10 seconds + self.assert_(kernel.type == 'kernel') + + def test_008_images_not_public_by_default(self): + conn = self.connection_for(test_username) + images = conn.get_all_images(image_ids=[data['image_id']]) + self.assertEqual(len(images), 0) + images = conn.get_all_images(image_ids=[data['kernel_id']]) + self.assertEqual(len(images), 0) + + def test_009_images_can_be_made_public(self): + userconn = self.connection_for(test_username) + + self.admin.modify_image_attribute(image_id=data['image_id'], + operation='add', + attribute='launchPermission', + groups='all') + + image = userconn.get_image(data['image_id']) + self.assertEqual(image.id, data['image_id']) + + self.admin.modify_image_attribute(image_id=data['kernel_id'], + operation='add', + attribute='launchPermission', + groups='all') + + image = userconn.get_image(data['kernel_id']) + self.assertEqual(image.id, data['kernel_id']) + + # FIXME: add tests that user can launch image + +# def test_010_user_can_launch_admin_public_image(self): +# # TODO: Use openwrt kernel instead of default kernel +# conn = self.connection_for(test_username) +# reservation = conn.run_instances(data['image_id']) +# self.assertEqual(len(reservation.instances), 1) +# data['my_instance_id'] = reservation.instances[0].id + +# def test_011_instances_launch_within_30_seconds(self): +# pass + +# def test_012_user_can_terminate(self): +# conn = self.connection_for(test_username) +# terminated = conn.terminate_instances(instance_ids=[data['my_instance_id']]) +# self.assertEqual(len(terminated), 1) + + def test_013_admin_can_deregister_kernel(self): + self.assertTrue(self.admin.deregister_image(data['kernel_id'])) + + def test_014_admin_can_deregister_image(self): + self.assertTrue(self.admin.deregister_image(data['image_id'])) + + def test_015_admin_can_delete_bundle(self): + self.assertTrue(self.delete_bundle_bucket(test_bucket)) + + def test_999_tearDown(self): + data = {} + self.delete_user(test_username) + + +# Test key pairs and security groups +class SecurityTests(NovaTestCase): + def test_000_setUp(self): + self.create_user(test_username + '_me') + self.create_user(test_username + '_you') + data['kernel_id'] = 'aki-EAB510D9' + data['image_id'] = 'ami-25CB1213' + + def test_001_me_can_create_keypair(self): + conn = self.connection_for(test_username + '_me') + key = self.create_key_pair(conn, test_key) + self.assertEqual(key.name, test_key) + + def test_002_you_can_create_keypair(self): + conn = self.connection_for(test_username + '_you') + key = self.create_key_pair(conn, test_key+ 'yourkey') + self.assertEqual(key.name, test_key+'yourkey') + + def test_003_me_can_create_instance_with_keypair(self): + conn = self.connection_for(test_username + '_me') + reservation = conn.run_instances(data['image_id'], kernel_id=data['kernel_id'], key_name=test_key) + self.assertEqual(len(reservation.instances), 1) + data['my_instance_id'] = reservation.instances[0].id + + def test_004_me_can_obtain_private_ip_within_60_seconds(self): + conn = self.connection_for(test_username + '_me') + reservations = conn.get_all_instances([data['my_instance_id']]) + instance = reservations[0].instances[0] + # allow 60 seconds to exit pending with IP + for x in xrange(60): + instance.update() + if instance.state != u'pending': + break + time.sleep(1) + else: + self.assert_(False) + # self.assertEqual(instance.state, u'running') + ip = reservations[0].instances[0].private_dns_name + self.failIf(ip == '0.0.0.0') + data['my_private_ip'] = ip + print data['my_private_ip'], + + def test_005_can_ping_private_ip(self): + # allow 30 seconds for PING to work + print "ping -c1 -w1 %s" % data['my_private_ip'] + for x in xrange(120): + # ping waits for 1 second + status, output = getstatusoutput("ping -c1 -w1 %s" % data['my_private_ip']) + if status == 0: + break + else: + self.assert_(False) + #def test_005_me_cannot_ssh_when_unauthorized(self): + # self.assertRaises(SSHException, self.connect_ssh, data['my_private_ip'], 'mykey') + + #def test_006_me_can_authorize_ssh(self): + # conn = self.connection_for(test_username + '_me') + # self.assertTrue( + # conn.authorize_security_group( + # 'default', + # ip_protocol='tcp', + # from_port=22, + # to_port=22, + # cidr_ip='0.0.0.0/0' + # ) + # ) + + def test_007_me_can_ssh_when_authorized(self): + # Wait for the instance to ACTUALLY have ssh ru/nning + for x in xrange(120): + try: + conn = self.connect_ssh(data['my_private_ip'], test_key) + conn.close() + break + except: + time.sleep(1) + else: + self.assertTrue(False) + + #def test_008_me_can_revoke_ssh_authorization(self): + # conn = self.connection_for('me') + # self.assertTrue( + # conn.revoke_security_group( + # 'default', + # ip_protocol='tcp', + # from_port=22, + # to_port=22, + # cidr_ip='0.0.0.0/0' + # ) + # ) + + #def test_009_you_cannot_ping_my_instance(self): + # 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.close() + except SSHException: + pass + else: + self.fail("expected SSHException") + + def test_999_tearDown(self): + conn = self.connection_for(test_username + '_me') + self.delete_key_pair(conn, test_key) + if data.has_key('my_instance_id'): + conn.terminate_instances([data['my_instance_id']]) + + conn = self.connection_for(test_username + '_you') + self.delete_key_pair(conn, test_key + 'yourkey') + + conn = self.connection_for('admin') + self.delete_user(test_username + '_me') + self.delete_user(test_username + '_you') + #self.tearDown_test_image(conn, data['image_id']) + #self.tearDown_test_image(conn, data['kernel_id']) + +# TODO: verify wrt image boots +# build python into wrt image +# build boto/m2crypto into wrt image +# build euca2ools into wrt image +# build a script to download and unpack credentials +# - return "ok" to stdout for comparison in self.assertEqual() +# build a script to bundle the instance +# build a script to upload the bundle + +# status, output = getstatusoutput('cmd') +# if status == 0: +# print 'ok' +# else: +# print output + +# Testing rebundling +class RebundlingTests(NovaTestCase): + def test_000_setUp(self): + self.create_user('me') + self.create_user('you') + # TODO: create keypair for me + # upload smoketest img + # run instance + + 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') + 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') + 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') + 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') + conn.close() + if re.matches('emi-{\w+}', stdout): + data['my_image_id'] = stdout.strip() + else: + self.fail('expected emi-nnnnnn, got:\n ' + stdout) + + def test_005_you_cannot_see_my_private_image(self): + conn = self.connection_for('you') + image = conn.get_image(data['my_image_id']) + self.assertEqual(image, None) + +# def test_006_me_can_make_image_public(self): +# # TODO: research this +# self.assert_(False) +# + def test_007_you_can_see_my_public_image(self): + conn = self.connection_for('you') + image = conn.get_image(data['my_image_id']) + self.assertEqual(image.id, data['my_image_id']) + + def test_999_tearDown(self): + self.delete_user('me') + self.delete_user('you') + + #if data.has_key('image_id'): + # deregister rebundled image + + # TODO: tear down instance + # delete keypairs + data = {} + +# Test elastic IPs +class ElasticIPTests(NovaTestCase): + def test_000_setUp(self): + data['kernel_id'] = 'aki-EAB510D9' + data['image_id'] = 'ami-25CB1213' + + self.create_user('me') + conn = self.connection_for('me') + self.create_key_pair(conn, 'mykey') + + conn = self.connection_for('admin') + #data['kernel_id'] = self.setUp_test_image(KERNEL_FILENAME, kernel=True) + #data['image_id'] = self.setUp_test_image(IMAGE_FILENAME) + + def test_001_me_can_launch_image_with_keypair(self): + conn = self.connection_for('me') + reservation = conn.run_instances(data['image_id'], key_name='mykey') + self.assertEqual(len(reservation.instances), 1) + data['my_instance_id'] = reservation.instances[0].id + + def test_002_me_can_allocate_elastic_ip(self): + conn = self.connection_for('me') + data['my_public_ip'] = conn.allocate_address() + self.assert_(data['my_public_ip'].public_ip) + + def test_003_me_can_associate_ip_with_instance(self): + self.assertTrue(data['my_public_ip'].associate(data['my_instance_id'])) + + def test_004_me_can_ssh_with_public_ip(self): + conn = self.connect_ssh(data['my_public_ip'].public_ip, 'mykey') + conn.close() + + def test_005_me_can_disassociate_ip_from_instance(self): + self.assertTrue(data['my_public_ip'].disassociate()) + + def test_006_me_can_deallocate_elastic_ip(self): + self.assertTrue(data['my_public_ip'].delete()) + + def test_999_tearDown(self): + conn = self.connection_for('me') + self.delete_key_pair(conn, 'mykey') + + conn = self.connection_for('admin') + #self.tearDown_test_image(conn, data['image_id']) + #self.tearDown_test_image(conn, data['kernel_id']) + data = {} + +ZONE = 'nova' +DEVICE = '/dev/vdb' +vol_key = test_key + 'volumekey' +# Test iscsi volumes +class VolumeTests(NovaTestCase): + def test_000_setUp(self): + self.create_user('me') + data['kernel_id'] = 'aki-EAB510D9' + data['image_id'] = 'ami-25CB1213' # A7370FE3 + + conn = self.connection_for('me') + self.create_key_pair(conn, vol_key) + reservation = conn.run_instances(data['image_id'], key_name=vol_key) + data['my_instance_id'] = reservation.instances[0].id + data['my_private_ip'] = reservation.instances[0].private_dns_name + + time.sleep(60) + """ + # wait for instance to show up + for x in xrange(120): + # ping waits for 1 second + status, output = getstatusoutput("ping -c1 -w1 %s" % data['my_private_ip']) + if status == 0: + break + else: + self.assertTrue(False) + """ + def test_001_me_can_create_volume(self): + conn = self.connection_for('me') + volume = conn.create_volume(1, ZONE) + self.assertEqual(volume.size, 1) + data['volume_id'] = volume.id + + def test_002_me_can_attach_volume(self): + # Wait for the volume to be reported to cloud + + time.sleep(30) + conn = self.connection_for('me') + for x in xrange(20): + try: + conn.attach_volume( + volume_id = data['volume_id'], + instance_id = data['my_instance_id'], + device = DEVICE + ) + break + except: + time.sleep(1) + else: + self.assertTrue(False) + + # fixme: test cannot delete attached volume! + + def test_003_me_can_mount_volume(self): + # Wait for the instance to ACTUALLY have ssh running + time.sleep(20) + for x in xrange(5): + try: + conn = self.connect_ssh(data['my_private_ip'], vol_key) + break + except: + time.sleep(5) + else: + self.assertTrue(False) + if conn: + conn.close() + return + stdin, stdout, stderr = conn.exec_command('sudo bash -c "mkdir -p /mnt/vol && mkfs.ext3 %s && mount %s /mnt/vol && echo success"' % (DEVICE, DEVICE)) + out = stdout.read() + conn.close() + if not out.strip().endswith('success'): + self.fail('Unable to mount: %s %s' % (out, stderr.read())) + + def test_004_me_can_write_to_volume(self): + conn = self.connect_ssh(data['my_private_ip'], vol_key) + # FIXME: This doesn't fail if the volume hasn't been mounted + stdin, stdout, stderr = conn.exec_command('sudo bash -c "echo hello > /mnt/vol/test.txt"') + err = stderr.read() + conn.close() + if len(err) > 0: + self.fail('Unable to write to mount: %s' % (err)) + + def test_005_volume_is_correct_size(self): + conn = self.connect_ssh(data['my_private_ip'], vol_key) + # FIXME: This doesn't fail if the volume hasn't been mounted + stdin, stdout, stderr = conn.exec_command("df -h | grep %s | awk {'print $2'}" % DEVICE) + out = stdout.read() + conn.close() + if not out.strip() == '1008M': + self.fail('Volume is not the right size: %s %s' % (out, stderr.read())) + + def test_006_me_can_umount_volume(self): + conn = self.connect_ssh(data['my_private_ip'], vol_key) + stdin, stdout, stderr = conn.exec_command('sudo umount /mnt/vol') + err = stderr.read() + conn.close() + if len(err) > 0: + self.fail('Unable to unmount: %s' % (err)) + + def test_007_me_can_detach_volume(self): + conn = self.connection_for('me') + self.assertTrue(conn.detach_volume(volume_id = data['volume_id'])) + + def test_008_me_can_delete_volume(self): + conn = self.connection_for('me') + self.assertTrue(conn.delete_volume(data['volume_id'])) + + def test_999_tearDown(self): + global data + conn = self.connection_for('me') + self.delete_key_pair(conn, vol_key) + if data.has_key('my_instance_id'): + conn.terminate_instances([data['my_instance_id']]) + self.delete_user('me') + data = {} + +def build_suites(): + return { + 'user': unittest.makeSuite(UserTests), + 'image': unittest.makeSuite(ImageTests), + 'security': unittest.makeSuite(SecurityTests), + 'public_network': unittest.makeSuite(ElasticIPTests), + 'volume': unittest.makeSuite(VolumeTests), + } + +def main(argv=None): + if len(argv) == 1: + unittest.main() + else: + suites = build_suites() + + try: + suite = suites[argv[1]] + except KeyError: + print >> sys.stderr, 'Available test suites: [user, image, security, public_network, volume]' + return + + unittest.TextTestRunner(verbosity=2).run(suite) + +if __name__ == "__main__": + sys.exit(main(sys.argv)) -- cgit From c910b470e61a35230bc7ddaced13c3d51fac32fd Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:11:53 +0100 Subject: re-added cloudpipe Conflicts: bin/nova-manage nova/auth/users.py nova/compute/network.py --- CA/geninter.sh | 6 +- bin/nova-manage | 41 ++++++++++++ debian/changelog | 127 +++++++++++++++++++++++++++++++++++- debian/nova-common.install | 1 + nova/auth/users.py | 25 ++++++- nova/cloudpipe/__init__.py | 26 ++++++++ nova/cloudpipe/api.py | 70 ++++++++++++++++++++ nova/cloudpipe/bootscript.sh | 58 ++++++++++++++++ nova/cloudpipe/client.ovpn.template | 41 ++++++++++++ nova/cloudpipe/pipelib.py | 83 +++++++++++++++++++++++ nova/compute/network.py | 10 +++ nova/endpoint/api.py | 3 + nova/flags.py | 2 + 13 files changed, 487 insertions(+), 6 deletions(-) create mode 100644 nova/cloudpipe/__init__.py create mode 100644 nova/cloudpipe/api.py create mode 100755 nova/cloudpipe/bootscript.sh create mode 100644 nova/cloudpipe/client.ovpn.template create mode 100644 nova/cloudpipe/pipelib.py diff --git a/CA/geninter.sh b/CA/geninter.sh index ad3332ad9..2aa64a842 100755 --- a/CA/geninter.sh +++ b/CA/geninter.sh @@ -16,7 +16,7 @@ # ARG is the id of the user - +export SUBJ=/C=US/ST=California/L=Mountain View/O=Anso Labs/OU=Nova Dev/CN=customer-intCA-$3 mkdir INTER/$1 cd INTER/$1 cp ../../openssl.cnf.tmpl openssl.cnf @@ -25,6 +25,6 @@ mkdir certs crl newcerts private echo "10" > serial touch index.txt openssl genrsa -out private/cakey.pem 1024 -config ./openssl.cnf -batch -nodes -openssl req -new -sha1 -key private/cakey.pem -out ../../reqs/inter$1.csr -batch -subj "/C=US/ST=California/L=Mountain View/O=Anso Labs/OU=Nova Dev/CN=customer-intCA-$1" +openssl req -new -sha2 -key private/cakey.pem -out ../../reqs/inter$1.csr -batch -subj "$SUBJ" cd ../../ -openssl ca -extensions v3_ca -days 365 -out INTER/$1/cacert.pem -in reqs/inter$1.csr -config openssl.cnf -batch \ No newline at end of file +openssl ca -extensions v3_ca -days 365 -out INTER/$1/cacert.pem -in reqs/inter$1.csr -config openssl.cnf -batch diff --git a/bin/nova-manage b/bin/nova-manage index 765eb1f53..76de41308 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -25,11 +25,51 @@ from nova import flags from nova import utils from nova.auth import users from nova.compute import model +from nova.cloudpipe import pipelib from nova.endpoint import cloud import time FLAGS = flags.FLAGS +class VpnCommands(object): + def __init__(self): + self.manager = users.UserManager.instance() + self.instdir = model.InstanceDirectory() + self.pipe = pipelib.CloudPipe(cloud.CloudController()) + + def list(self): + print "%-12s\t" % 'user', + print "%-12s\t" % 'ip:port', + print "%s" % 'state' + for user in self.manager.get_users(): + print "%-12s\t" % user.name, + print "%s:%s\t" % (user.vpn_ip, user.vpn_port), + + vpn = self.__vpn_for(user.name) + if vpn: + print vpn['instance_id'], + print vpn['state'] + else: + print None + + def __vpn_for(self, username): + for instance in self.instdir.all: + if (instance.state.has_key('image_id') + and instance['image_id'] == FLAGS.vpn_image_id + and not instance['state'] in ['shutting_down', 'shutdown'] + and instance['owner_id'] == username): + return instance + + def spawn(self): + for u in reversed(self.manager.get_users()): + if not self.__vpn_for(u.id): + print 'spawning %s' % u.id + self.pipe.launch_vpn_instance(u.id) + time.sleep(10) + + def run(self, username): + self.pipe.launch_vpn_instance(username) + class UserCommands(object): def __init__(self): @@ -109,6 +149,7 @@ def usage(script_name): categories = [ ('user', UserCommands), ('project', ProjectCommands), + ('vpn', VpnCommands), ] diff --git a/debian/changelog b/debian/changelog index 2b226e048..ee326f3a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,129 @@ -nova (0.3.0-1) UNRELEASED; urgency=low +nova (0.2.1-1) UNRELEASED; urgency=low + + * Support ephemeral (local) space for instances + * instance related fixes + * fix network & cloudpipe bugs + + -- Vishvananda Ishaya Mon, 25 May 2010 12:14:00 -0700 + +nova (0.2.0-20) UNRELEASED; urgency=low + + * template files are in proper folder + + -- Vishvananda Ishaya Mon, 25 May 2010 12:14:00 -0700 + +nova (0.2.0-19) UNRELEASED; urgency=low + + * removed mox dependency and added templates to install + + -- Vishvananda Ishaya Mon, 25 May 2010 11:53:00 -0700 + +nova (0.2.0-18) UNRELEASED; urgency=low + + * api server properly sends instance status code + + -- Vishvananda Ishaya Mon, 24 May 2010 17:18:00 -0700 + +nova (0.2.0-17) UNRELEASED; urgency=low + + * redis-backed datastore + + -- Vishvananda Ishaya Mon, 24 May 2010 16:28:00 -0700 + +nova (0.2.0-16) UNRELEASED; urgency=low + + * make sure twistd.pid is really overriden + + -- Manish Singh Sun, 23 May 2010 22:18:47 -0700 + +nova (0.2.0-15) UNRELEASED; urgency=low + + * rpc shouldn't require tornado unless you are using attach_to_tornado + + -- Jesse Andrews Sun, 23 May 2010 21:59:00 -0700 + +nova (0.2.0-14) UNRELEASED; urgency=low + + * quicky init scripts for the other services, based on nova-objectstore + + -- Manish Singh Sun, 23 May 2010 21:49:43 -0700 + +nova (0.2.0-13) UNRELEASED; urgency=low + + * init script for nova-objectstore + + -- Manish Singh Sun, 23 May 2010 21:33:25 -0700 + +nova (0.2.0-12) UNRELEASED; urgency=low + + * kvm, kpartx required for nova-compute + + -- Jesse Andrews Sun, 23 May 2010 21:32:00 -0700 + +nova (0.2.0-11) UNRELEASED; urgency=low + + * Need to include the python modules in nova-common.install as well. + + -- Manish Singh Sun, 23 May 2010 20:04:27 -0700 + +nova (0.2.0-10) UNRELEASED; urgency=low + + * add more requirements to bin packages + + -- Jesse Andrews Sun, 23 May 2010 19:54:00 -0700 + +nova (0.2.0-9) UNRELEASED; urgency=low + + * nova bin packages should depend on the same version of nova-common they + were built from. + + -- Manish Singh Sun, 23 May 2010 18:46:34 -0700 + +nova (0.2.0-8) UNRELEASED; urgency=low + + * Require libvirt 0.8.1 or newer for nova-compute + + -- Jesse Andrews Sun, 23 May 2010 18:33:00 -0700 + +nova (0.2.0-7) UNRELEASED; urgency=low + + * Split bins into separate packages + + -- Manish Singh Sun, 23 May 2010 18:46:34 -0700 + +nova (0.2.0-6) UNRELEASED; urgency=low + + * Add python-m2crypto to deps + + -- Jesse Andrews Sun, 23 May 2010 18:33:00 -0700 + +nova (0.2.0-5) UNRELEASED; urgency=low + + * Add python-gflags to deps + + -- Manish Singh Sun, 23 May 2010 18:28:50 -0700 + +nova (0.2.0-4) UNRELEASED; urgency=low + + * install scripts + + -- Manish Singh Sun, 23 May 2010 18:16:27 -0700 + +nova (0.2.0-3) UNRELEASED; urgency=low + + * debian build goop + + -- Manish Singh Sun, 23 May 2010 18:06:37 -0700 + +nova (0.2.0-2) UNRELEASED; urgency=low + + * improved requirements + + -- Jesse Andrews Sun, 23 May 2010 17:42:00 -0700 + +nova (0.2.0-1) UNRELEASED; urgency=low * initial release - -- Jesse Andrews Thur, 27 May 2010 12:28:00 -0700 + -- Jesse Andrews Fri, 21 May 2010 12:28:00 -0700 diff --git a/debian/nova-common.install b/debian/nova-common.install index c9358ac41..ab7455314 100644 --- a/debian/nova-common.install +++ b/debian/nova-common.install @@ -1,4 +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 usr/lib/python*/*-packages/nova/* diff --git a/nova/auth/users.py b/nova/auth/users.py index c60922feb..2bfc3cec3 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -23,6 +23,7 @@ import logging import os import shutil import string +from string import Template import tempfile import uuid import zipfile @@ -56,12 +57,16 @@ flags.DEFINE_string('project_ldap_subtree', 'ou=Groups,dc=example,dc=com', 'OU f flags.DEFINE_string('credentials_template', utils.abspath('auth/novarc.template'), 'Template for creating users rc file') +flags.DEFINE_string('vpn_client_template', + utils.abspath('cloudpipe/client.ovpn.template'), + 'Template for creating users vpn file') flags.DEFINE_string('credential_key_file', 'pk.pem', 'Filename of private key in credentials zip') 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('vpn_ip', '127.0.0.1', 'Public IP for the cloudpipe VPN servers') class AuthBase(object): @classmethod @@ -83,6 +88,23 @@ class User(AuthBase): self.secret = secret self.admin = admin + @property + def vpn_port(self): + port_map = self.keeper['vpn_ports'] + if not port_map: port_map = {} + if not port_map.has_key(self.id): + ports = port_map.values() + if len(ports) > 0: + port_map[self.id] = max(ports) + 1 + else: + port_map[self.id] = 8000 + self.keeper['vpn_ports'] = port_map + return self.keeper['vpn_ports'][self.id] + + @property + def vpn_ip(self): + return FLAGS.vpn_ip + def is_admin(self): """allows user to see objects from all projects""" return self.admin @@ -353,7 +375,8 @@ class UserManager(object): return crypto.sign_csr(csr, uid) def __cert_subject(self, uid): - return "/C=US/ST=California/L=The_Mission/O=AnsoLabs/OU=Nova/CN=%s-%s" % (uid, str(datetime.datetime.utcnow().isoformat())) + # 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())) class LDAPWrapper(object): diff --git a/nova/cloudpipe/__init__.py b/nova/cloudpipe/__init__.py new file mode 100644 index 000000000..e8ac53976 --- /dev/null +++ b/nova/cloudpipe/__init__.py @@ -0,0 +1,26 @@ +# 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 +# +# 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. + +""" +:mod:`nova.cloudpipe` -- VPN Server Management +===================================================== + +.. automodule:: nova.cloudpipe + :platform: Unix + :synopsis: An OpenVPN server for every nova user. +.. moduleauthor:: Devin Carlen +.. moduleauthor:: Vishvananda Ishaya +.. moduleauthor:: Joshua McKenty +""" diff --git a/nova/cloudpipe/api.py b/nova/cloudpipe/api.py new file mode 100644 index 000000000..5395e9724 --- /dev/null +++ b/nova/cloudpipe/api.py @@ -0,0 +1,70 @@ +#!/usr/bin/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 +# +# 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. + +""" +Tornado REST API Request Handlers for CloudPipe +""" + +import logging +import urllib + +from nova import vendor +import tornado.web + +from nova import crypto +from nova.auth import users + +_log = logging.getLogger("api") +_log.setLevel(logging.DEBUG) + + +class CloudPipeRequestHandler(tornado.web.RequestHandler): + def get(self, path): + path = self.request.path + _log.debug( "Cloudpipe path is %s" % path) + self.manager = users.UserManager.instance() + if path.endswith("/getca/"): + self.send_root_ca() + elif path.endswith("/getcert/"): + _log.debug( "Getting zip for %s" % (path[9:])) + try: + self.send_signed_zip(self.path[9:]) + except Exception, err: + _log.debug('ERROR: %s\n' % str(err)) + raise tornado.web.HTTPError(404) + self.finish() + + def get_username_from_ip(self, ip): + cc = self.application.controllers['Cloud'] + instance = cc.get_instance_by_ip(ip) + return instance['owner_id'] + + def send_root_ca(self): + _log.debug( "Getting root ca") + username = self.get_username_from_ip(self.request.remote_ip) + self.set_header("Content-Type", "text/plain") + self.write(crypto.fetch_ca(username)) + + def send_signed_zip(self, username): + self.set_header("Content-Type", "application/zip") + self.write(self.manager.get_signed_zip(username)) + + def post(self, *args, **kwargs): + self.manager = users.UserManager.instance() + username = self.get_username_from_ip(self.request.remote_ip) + cert = self.get_argument('cert', '') + self.write(self.manager.sign_cert(urllib.unquote(cert), username)) + self.finish() diff --git a/nova/cloudpipe/bootscript.sh b/nova/cloudpipe/bootscript.sh new file mode 100755 index 000000000..bb710617e --- /dev/null +++ b/nova/cloudpipe/bootscript.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# 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. + +# This gets zipped and run on the cloudpipe-managed OpenVPN server + +export SUPERVISOR="http://10.255.255.1:8773/cloudpipe" +export VPN_IP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{print $1}'` +export BROADCAST=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f3 | awk '{print $1}'` +export DHCP_MASK=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f4 | awk '{print $1}'` +export GATEWAY=`netstat -r | grep default | cut -d' ' -f10` +export SUBJ=/C=US/ST=California/L=Mountain View/O=Anso Labs/OU=Nova Dev/CN=customer-vpn-$VPN_IP + +DHCP_LOWER=`echo $BROADCAST | awk -F. '{print $1"."$2"."$3"." $4 - 10 }'` +DHCP_UPPER=`echo $BROADCAST | awk -F. '{print $1"."$2"."$3"." $4 - 1 }'` + +# generate a server DH +openssl dhparam -out /etc/openvpn/dh1024.pem 1024 + +# generate a server priv key +openssl genrsa -out /etc/openvpn/server.key 2048 + +# generate a server CSR +openssl req -new -key /etc/openvpn/server.key -out /etc/openvpn/server.csr -batch -subj "$SUBJ" + +# URLEncode the CSR +CSRTEXT=`cat /etc/openvpn/server.csr` +CSRTEXT=$(python -c "import urllib; print urllib.quote('''$CSRTEXT''')") + +# SIGN the csr and save as server.crt +# CURL fetch to the supervisor, POSTing the CSR text, saving the result as the CRT file +curl $SUPERVISOR -d "cert=$CSRTEXT" > /etc/openvpn/server.crt +curl $SUPERVISOR/getca/ > /etc/openvpn/ca.crt + +# Customize the server.conf.template +cd /etc/openvpn + +sed -e s/VPN_IP/$VPN_IP/g server.conf.template > server.conf +sed -i -e s/DHCP_SUBNET/$DHCP_MASK/g server.conf +sed -i -e s/DHCP_LOWER/$DHCP_LOWER/g server.conf +sed -i -e s/DHCP_UPPER/$DHCP_UPPER/g server.conf +sed -i -e s/max-clients\ 1/max-clients\ 10/g server.conf + +echo "\npush \"route 10.255.255.1 255.255.255.255 $GATEWAY\"\n" >> server.conf +echo "\npush \"route 10.255.255.253 255.255.255.255 $GATEWAY\"\n" >> server.conf + +/etc/init.d/openvpn start diff --git a/nova/cloudpipe/client.ovpn.template b/nova/cloudpipe/client.ovpn.template new file mode 100644 index 000000000..d6cf8e19c --- /dev/null +++ b/nova/cloudpipe/client.ovpn.template @@ -0,0 +1,41 @@ +# 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. + +# NOVA user connection +# Edit the following lines to point to your cert files: +cert $certfile +key $keyfile + +ca cacert.pem + +client +dev tap +proto udp + +remote $ip $port +resolv-retry infinite +nobind + +# Downgrade privileges after initialization (non-Windows only) +user nobody +group nogroup +comp-lzo + +# Set log file verbosity. +verb 2 + +keepalive 10 120 +ping-timer-rem +persist-tun +persist-key diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py new file mode 100644 index 000000000..f69486f3e --- /dev/null +++ b/nova/cloudpipe/pipelib.py @@ -0,0 +1,83 @@ +# 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. + +""" +CloudPipe - Build a user-data payload zip file, and launch +an instance with it. + +""" + +import logging +import os +import tempfile +from zipfile import ZipFile, ZIP_DEFLATED + +from nova import flags +from nova.auth import users +from nova import utils +from nova.endpoint import api + +FLAGS = flags.FLAGS + +flags.DEFINE_string('boot_script_template', + utils.abspath('cloudpipe/bootscript.sh'), + 'Template for script to run on cloudpipe instance boot') + +class CloudPipe(object): + def __init__(self, cloud_controller): + self.controller = cloud_controller + self.manager = users.UserManager.instance() + + def launch_vpn_instance(self, username): + logging.debug( "Launching VPN for %s" % (username)) + user = self.manager.get_user(username) + # Make a payload.zip + tmpfolder = tempfile.mkdtemp() + filename = "payload.zip" + zippath = os.path.join(tmpfolder, filename) + z = ZipFile(zippath, "w", ZIP_DEFLATED) + + z.write(FLAGS.boot_script_template,'autorun.sh') + z.close() + + self.setup_keypair(username) + zippy = open(zippath, "r") + context = api.APIRequestContext(handler=None, user=user) + + reservation = self.controller.run_instances(context, + user_data=zippy.read().encode("base64"), + max_count=1, + min_count=1, + image_id=FLAGS.vpn_image_id, + key_name="vpn-key", + security_groups=["vpn-secgroup"]) + zippy.close() + + def setup_keypair(self, username): + try: + private_key, fingerprint = self.manager.generate_key_pair(username, "vpn-key") + os.mkdir("%s/%s" % (FLAGS.keys_path, username)) + private_key.save(os.path.abspath("%s/%s" % (FLAGS.keys_path, username))) + except: + pass + + # def setup_secgroups(self, username): + # conn = self.euca.connection_for(username) + # try: + # secgroup = conn.create_security_group("vpn-secgroup", "vpn-secgroup") + # secgroup.authorize(ip_protocol = "udp", from_port = "1194", to_port = "1194", cidr_ip = "0.0.0.0/0") + # secgroup.authorize(ip_protocol = "tcp", from_port = "80", to_port = "80", cidr_ip = "0.0.0.0/0") + # secgroup.authorize(ip_protocol = "tcp", from_port = "22", to_port = "22", cidr_ip = "0.0.0.0/0") + # except: + # pass diff --git a/nova/compute/network.py b/nova/compute/network.py index 618e7bffb..3001b1375 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -51,6 +51,11 @@ flags.DEFINE_string('private_range', '10.0.0.0/8', 'Private IP address block') logging.getLogger().setLevel(logging.DEBUG) +# CLEANUP: +# TODO(ja): Save the IPs at the top of each subnet for cloudpipe vpn clients +# TODO(ja): use singleton for usermanager instead of self.manager in vlanpool et al +# TODO(ja): does vlanpool "keeper" need to know the min/max - shouldn't FLAGS always win? +# TODO(joshua): Save the IPs at the top of each subnet for cloudpipe vpn clients class BaseNetwork(datastore.RedisModel): bridge_gets_ip = False @@ -97,6 +102,11 @@ class BaseNetwork(datastore.RedisModel): 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']) diff --git a/nova/endpoint/api.py b/nova/endpoint/api.py index e70694210..977daff27 100755 --- a/nova/endpoint/api.py +++ b/nova/endpoint/api.py @@ -37,6 +37,7 @@ from nova import flags from nova import utils from nova.endpoint import cloud from nova.auth import users +import nova.cloudpipe.api FLAGS = flags.FLAGS flags.DEFINE_integer('cc_port', 8773, 'cloud controller port') @@ -322,6 +323,8 @@ class APIServerApplication(tornado.web.Application): def __init__(self, user_manager, controllers): tornado.web.Application.__init__(self, [ (r'/', RootRequestHandler), + (r'/cloudpipe/(.*)', nova.cloudpipe.api.CloudPipeRequestHandler), + (r'/cloudpipe', nova.cloudpipe.api.CloudPipeRequestHandler), (r'/services/([A-Za-z0-9]+)/', APIRequestHandler), (r'/latest/([-A-Za-z0-9/]*)', MetadataRequestHandler), (r'/2009-04-04/([-A-Za-z0-9/]*)', MetadataRequestHandler), diff --git a/nova/flags.py b/nova/flags.py index 7818e1b14..84a670e6b 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -68,6 +68,8 @@ DEFINE_string('default_instance_type', 'm1.small', 'default instance type to use, testing only') +DEFINE_string('vpn_image_id', 'ami-CLOUDPIPE', 'AMI for cloudpipe vpn server') + # UNUSED DEFINE_string('node_availability_zone', 'nova', -- cgit From 0ba3f01c66e9eb016311339cd1a23b4f8710c265 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: Revert "fix a bug with AOE number generation" This reverts commit 7e8b5bcbad634cd4eabd0387d70beb25115bb680. --- nova/volume/storage.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nova/volume/storage.py b/nova/volume/storage.py index c2affe3ee..cf64b995f 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -243,12 +243,9 @@ class FakeVolume(Volume): pass def get_next_aoe_numbers(): - aoes = subprocess.Popen("sudo ls -1 /var/lib/vblade-persist/vblades/", shell=True, stdout=subprocess.PIPE).communicate()[0] - last_aoe = aoes.strip().split("\n")[-1] - if last_aoe == '': - last_aoe = 'e0.0' - logging.debug("Last aoe is %s" % (last_aoe)) - blade_id = last_aoe.rpartition(".")[2] + aoes = glob.glob("/var/lib/vblade-persist/vblades/e*") + aoes.extend(['e0.0']) + blade_id = int(max([int(a.split('.')[1]) for a in aoes])) + 1 + logging.debug("Next blade_id is %s" % (blade_id)) shelf_id = FLAGS.shelf_id - blade_id = int(blade_id) + 1 return (shelf_id, blade_id) -- cgit From 426f5777cc65a6e7ec2a539bf5def80aaf21cd75 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: how we build our debs --- builddeb.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 builddeb.sh diff --git a/builddeb.sh b/builddeb.sh new file mode 100755 index 000000000..88e1477d7 --- /dev/null +++ b/builddeb.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# 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. + +dpkg-buildpackage -b -rfakeroot -tc -uc -D -- cgit From 34f4fa8495bca4d971872e59d358195263e72bf7 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: Adding cloudpipe and vpn data back in to network.py --- nova/compute/network.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/nova/compute/network.py b/nova/compute/network.py index 3001b1375..4489f26d4 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -48,6 +48,10 @@ flags.DEFINE_integer('network_size', 256, 'Number of addresses in each private subnet') flags.DEFINE_string('public_range', '4.4.4.0/24', 'Public IP address block') flags.DEFINE_string('private_range', '10.0.0.0/8', 'Private IP address block') +flags.DEFINE_integer('cnt_vpn_clients', 5, + 'Number of addresses reserved for vpn clients') +flags.DEFINE_integer('cloudpipe_start_port', 12000, + 'Starting port for mapped CloudPipe external ports') logging.getLogger().setLevel(logging.DEBUG) @@ -135,7 +139,9 @@ class BaseNetwork(datastore.RedisModel): @property def available(self): - for idx in range(3, len(self.network) - 1): + # the .2 address is always CloudPipe + # and the top are for vpn clients + for idx in range(3, len(self.network)-(1 + FLAGS.cnt_vpn_clients)): address = str(self.network[idx]) if not address in self.hosts.keys(): yield str(address) @@ -210,7 +216,7 @@ class DHCPNetwork(BridgedNetwork): 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] + self.dhcp_range_end = self.network[-(1 + FLAGS.cnt_vpn_clients)] try: os.makedirs(FLAGS.networks_path) except Exception, err: @@ -224,6 +230,20 @@ class DHCPNetwork(BridgedNetwork): linux_net.start_dnsmasq(self) else: logging.debug("Not launching dnsmasq: no hosts.") + self.express_cloudpipe() + + def allocate_vpn_ip(self, mac): + address = str(self.network[2]) + self._add_host(self['user_id'], self['project_id'], address, mac) + self.express(address=address) + return address + + def express_cloudpipe(self): + private_ip = self.network[2] + linux_net.confirm_rule("FORWARD -d %s -p udp --dport 1194 -j ACCEPT" + % (private_ip, )) + linux_net.confirm_rule("PREROUTING -t nat -d %s -p udp --dport %s -j DNAT --to %s:1194" + % (self.project.vpn_ip, self.project.vpn_port, private_ip)) def deexpress(self, address=None): # if this is the last address, stop dns @@ -394,6 +414,9 @@ def get_network_by_address(address): return net raise exception.AddressNotAllocated() +def allocate_vpn_ip(user_id, project_id, mac): + return get_project_network(project_id).allocate_vpn_ip(mac) + def allocate_ip(user_id, project_id, mac): return get_project_network(project_id).allocate_ip(user_id, project_id, mac) -- cgit From 2cf40bb3b21d33f4025f80d175a4c2ec7a2f8414 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: Adding mpi data --- nova/endpoint/cloud.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 8046d42e8..74da0eea3 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -95,8 +95,21 @@ class CloudController(object): def get_instance_by_ip(self, ip): return self.instdir.by_ip(ip) + def _get_mpi_data(self, project_id): + result = {} + for node_name, node in self.instances.iteritems(): + for instance in node.values(): + if instance['project_id'] == project_id: + line = '%s slots=%d' % (instance['private_dns_name'], instance.get('vcpus', 0)) + if instance['key_name'] in result: + result[instance['key_name']].append(line) + else: + result[instance['key_name']] = [line] + return result + 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 if i['key_name']: @@ -135,7 +148,8 @@ class CloudController(object): 'public-keys' : keys, 'ramdisk-id': i.get('ramdisk_id', ''), 'reservation-id': i['reservation_id'], - 'security-groups': i.get('groups', '') + 'security-groups': i.get('groups', ''), + 'mpi': mpi } } if False: # TODO: store ancestor ids -- cgit From 23733a44c152d6998e5ab3a7a96db9728030f627 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: Patch to allow rbac Conflicts: nova/auth/users.py --- nova/auth/rbac.py | 35 ++++++++++++++ nova/auth/users.py | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 nova/auth/rbac.py diff --git a/nova/auth/rbac.py b/nova/auth/rbac.py new file mode 100644 index 000000000..2283a7cd2 --- /dev/null +++ b/nova/auth/rbac.py @@ -0,0 +1,35 @@ +from nova import exception +from nova.auth import users + + +def allow(*roles): + def wrap(f): + def wrapped_f(self, context, *args, **kwargs): + if context.user.is_superuser(): + return f(self, context, *args, **kwargs) + for role in roles: + if __matches_role(context, role): + return f(self, context, *args, **kwargs) + raise exception.NotAuthorized() + return wrapped_f + return wrap + +def deny(*roles): + def wrap(f): + def wrapped_f(self, context, *args, **kwargs): + if context.user.is_superuser(): + return f(self, context, *args, **kwargs) + for role in roles: + if __matches_role(context, role): + raise exception.NotAuthorized() + return f(self, context, *args, **kwargs) + return wrapped_f + return wrap + +def __matches_role(context, role): + if role == 'all': + return True + if role == 'none': + return False + return context.project.has_role(context.user.id, role) + diff --git a/nova/auth/users.py b/nova/auth/users.py index 2bfc3cec3..98462b362 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -53,6 +53,17 @@ flags.DEFINE_string('user_dn', 'cn=Manager,dc=example,dc=com', 'DN of admin user flags.DEFINE_string('user_unit', 'Users', 'OID for Users') flags.DEFINE_string('user_ldap_subtree', 'ou=Users,dc=example,dc=com', 'OU for Users') flags.DEFINE_string('project_ldap_subtree', 'ou=Groups,dc=example,dc=com', 'OU for Projects') +flags.DEFINE_string('role_ldap_subtree', 'ou=Groups,dc=example,dc=com', 'OU for Roles') + +# mapping with these flags is necessary because we're going to tie in to an existing ldap schema +flags.DEFINE_string('ldap_cloudadmin', + 'cn=cloudadmins,ou=Groups,dc=example,dc=com', 'cn for Cloud Admins') + +# a user with one of these roles will be a superuser and have access to all api commands +flags.DEFINE_list('superuser_roles', ['cloudadmin'], 'roles that ignore rbac checking completely') + +# a user with one of these roles will have it for every project, even if he or she is not a member of the project +flags.DEFINE_list('global_roles', ['cloudadmin'], 'roles that apply to all projects') flags.DEFINE_string('credentials_template', utils.abspath('auth/novarc.template'), @@ -68,6 +79,7 @@ flags.DEFINE_string('credential_rc_file', 'novarc', 'Filename of rc in credentials zip') flags.DEFINE_string('vpn_ip', '127.0.0.1', 'Public IP for the cloudpipe VPN servers') + class AuthBase(object): @classmethod def safe_id(cls, obj): @@ -105,9 +117,30 @@ class User(AuthBase): def vpn_ip(self): return FLAGS.vpn_ip + def is_superuser(self): + """allows user to bypass rbac completely""" + if self.admin: + return True + for role in FLAGS.superuser_roles: + if self.has_role(role): + return True + def is_admin(self): """allows user to see objects from all projects""" - return self.admin + if self.is_superuser(): + return True + for role in FLAGS.global_roles: + if self.has_role(role): + return True + + def has_role(self, role): + return UserManager.instance().has_role(self, role) + + def add_role(self, role): + return UserManager.instance().add_role(self, role) + + def remove_role(self, role): + return UserManager.instance().remove_role(self, role) def is_project_member(self, project): return UserManager.instance().is_project_member(self, project) @@ -192,18 +225,54 @@ class Project(Group): def has_manager(self, user): return User.safe_id(user) == self.project_manager_id + def add_role(self, user, role): + return UserManager.instance().add_role(user, role, self) + + def remove_role(self, user, role): + return UserManager.instance().remove_role(user, role, self) + + def has_role(self, user, role): + return UserManager.instance().has_role(user, role, self) + + + @property + def vpn_port(self): + port_map = self.keeper['vpn_ports'] + if not port_map: port_map = {} + if not port_map.has_key(self.id): + ports = port_map.values() + if len(ports) > 0: + port_map[self.id] = max(ports) + 1 + else: + port_map[self.id] = 8000 + self.keeper['vpn_ports'] = port_map + return self.keeper['vpn_ports'][self.id] + + @property + def vpn_ip(self): + return FLAGS.vpn_ip + def get_credentials(self, user): if not isinstance(user, User): user = UserManager.instance().get_user(user) rc = user.generate_rc(self.id) private_key, signed_cert = self.generate_x509_cert(user) + configfile = open(FLAGS.vpn_client_template,"r") + s = string.Template(configfile.read()) + configfile.close() + config = s.substitute(keyfile=FLAGS.credential_key_file, + certfile=FLAGS.credential_cert_file, + ip=self.vpn_ip, + port=self.vpn_port) + tmpdir = tempfile.mkdtemp() zf = os.path.join(tmpdir, "temp.zip") zippy = zipfile.ZipFile(zf, 'w') zippy.writestr(FLAGS.credential_rc_file, rc) zippy.writestr(FLAGS.credential_key_file, private_key) zippy.writestr(FLAGS.credential_cert_file, signed_cert) + zippy.writestr("nebula-client.conf", config) zippy.writestr(FLAGS.ca_file, crypto.fetch_ca(self.id)) zippy.close() with open(zf, 'rb') as f: @@ -265,6 +334,32 @@ class UserManager(object): raise exception.NotAuthorized('Signature does not match') return (user, project) + def has_role(self, user, role, project=None): + with LDAPWrapper() as conn: + if project and role == 'projectmanager': + return self.is_project_manager(user, project) + + global_role = conn.has_role(User.safe_id(user), + role, + None) + if not global_role: + return global_role + + if not project or role in FLAGS.global_roles: + return global_role + + return conn.has_role(User.safe_id(user), + role, + Project.safe_id(project)) + + def add_role(self, user, role, project=None): + with LDAPWrapper() as conn: + return conn.add_role(User.safe_id(user), role, Project.safe_id(project)) + + def remove_role(self, user, role, project=None): + with LDAPWrapper() as conn: + return conn.remove_role(User.safe_id(user), role, Project.safe_id(project)) + def create_project(self, name, manager_user, description=None, member_users=None): if member_users: member_users = [User.safe_id(u) for u in member_users] @@ -428,6 +523,10 @@ class LDAPWrapper(object): attrs = self.find_objects(FLAGS.project_ldap_subtree, '(objectclass=novaProject)') return [self.__to_project(attr) for attr in attrs] + def find_roles(self, tree): + attrs = self.find_objects(tree, '(&(objectclass=groupOfNames)(!(objectclass=NovaProject)))') + return [self.__to_group(attr) for attr in attrs] + def find_groups_with_member(self, tree, dn): attrs = self.find_objects(tree, '(&(objectclass=groupOfNames)(member=%s))' % dn ) return [self.__to_group(attr) for attr in attrs] @@ -530,6 +629,12 @@ class LDAPWrapper(object): dn = 'cn=%s,%s' % (project_id, FLAGS.project_ldap_subtree) return self.is_in_group(uid, dn) + def __role_to_dn(self, role, project_id=None): + if project_id == None: + return FLAGS.__getitem__("ldap_%s" % role).value + else: + return 'cn=%s,cn=%s,%s' % (role, project_id, FLAGS.project_ldap_subtree) + def __create_group(self, group_dn, name, uid, description, member_uids = None): if self.group_exists(name): raise exception.Duplicate("Group can't be created because group %s already exists" % name) @@ -551,6 +656,27 @@ class LDAPWrapper(object): self.conn.add_s(group_dn, attr) return self.__to_group(dict(attr)) + def has_role(self, uid, role, project_id=None): + role_dn = self.__role_to_dn(role, project_id) + return self.is_in_group(uid, role_dn) + + def add_role(self, uid, role, project_id=None): + role_dn = self.__role_to_dn(role, project_id) + if not self.group_exists(role_dn): + # create the role if it doesn't exist + description = '%s role for %s' % (role, project_id) + self.__create_group(role_dn, role, uid, description) + else: + return self.add_to_group(uid, role_dn) + + def remove_role(self, uid, role, project_id=None): + role_dn = self.__role_to_dn(role, project_id) + try: + return self.remove_from_group(uid, role_dn) + except Exception, ex: + print type(ex), ex + + def is_in_group(self, uid, group_dn): if not self.user_exists(uid): raise exception.NotFound("User %s can't be searched in group becuase the user doesn't exist" % (uid,)) @@ -596,6 +722,9 @@ class LDAPWrapper(object): attr = [ (ldap.MOD_DELETE, 'member', dn) ] + roles = self.find_groups_with_member(FLAGS.role_ldap_subtree, dn) + for role in roles: + self.conn.modify_s('cn=%s,%s' % (role.id, FLAGS.role_ldap_subtree), attr) projects = self.find_groups_with_member(FLAGS.project_ldap_subtree, dn) for project in projects: self.conn.modify_s('cn=%s,%s' % (project.id, FLAGS.project_ldap_subtree), attr) @@ -640,8 +769,15 @@ class LDAPWrapper(object): raise exception.NotFound("Group at dn %s doesn't exist" % group_dn) self.conn.delete_s(group_dn) + def delete_roles(self, project_dn): + roles = self.find_roles(project_dn) + if roles != None: + for role in roles: + self.delete_group('cn=%s,%s' % (role.id, project_dn)) + def delete_project(self, name): project_dn = 'cn=%s,%s' % (name, FLAGS.project_ldap_subtree) + self.delete_roles(project_dn) self.delete_group(project_dn) def __to_user(self, attr): -- cgit From 28cd0ed991bb7f31495797e25969d325872cd542 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: Tests for rbac code --- nova/auth/users.py | 4 ++ nova/tests/access_unittest.py | 160 ++++++++++++++++++++++++++++++++++++++++++ nova/tests/users_unittest.py | 26 +++++++ run_tests.py | 1 + 4 files changed, 191 insertions(+) create mode 100644 nova/tests/access_unittest.py diff --git a/nova/auth/users.py b/nova/auth/users.py index 98462b362..f3248166c 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -58,6 +58,10 @@ flags.DEFINE_string('role_ldap_subtree', 'ou=Groups,dc=example,dc=com', 'OU for # mapping with these flags is necessary because we're going to tie in to an existing ldap schema flags.DEFINE_string('ldap_cloudadmin', 'cn=cloudadmins,ou=Groups,dc=example,dc=com', 'cn for Cloud Admins') +flags.DEFINE_string('ldap_sysadmin', + 'cn=sysadmins,ou=Groups,dc=example,dc=com', 'cn for Sysadmins') +flags.DEFINE_string('ldap_netadmin', + 'cn=netadmins,ou=Groups,dc=example,dc=com', 'cn for NetAdmins') # a user with one of these roles will be a superuser and have access to all api commands flags.DEFINE_list('superuser_roles', ['cloudadmin'], 'roles that ignore rbac checking completely') diff --git a/nova/tests/access_unittest.py b/nova/tests/access_unittest.py new file mode 100644 index 000000000..a1b574dd8 --- /dev/null +++ b/nova/tests/access_unittest.py @@ -0,0 +1,160 @@ +# 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 +# +# 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. + +import unittest + + +from nova.auth.users import UserManager +from nova.auth import rbac +from nova import exception +from nova import flags +from nova import test + +FLAGS = flags.FLAGS +class Context(object): + pass + +class AccessTestCase(test.BaseTestCase): + def setUp(self): + FLAGS.fake_libvirt = True + FLAGS.fake_storage = True + um = UserManager.instance() + # Make test users + try: + self.testadmin = um.create_user('testadmin') + except: pass + try: + self.testpmsys = um.create_user('testpmsys') + except: pass + try: + self.testnet = um.create_user('testnet') + except: pass + try: + self.testsys = um.create_user('testsys') + except: pass + # Assign some rules + try: + um.add_role('testadmin', 'cloudadmin') + except: pass + try: + um.add_role('testpmsys', 'sysadmin') + except: pass + try: + um.add_role('testnet', 'netadmin') + except: pass + try: + um.add_role('testsys', 'sysadmin') + except: pass + + # Make a test project + try: + self.project = um.create_project('testproj', 'testpmsys', 'a test project', ['testpmsys', 'testnet', 'testsys']) + except: pass + try: + self.project.add_role(self.testnet, 'netadmin') + except: pass + try: + self.project.add_role(self.testsys, 'sysadmin') + except: pass + self.context = Context() + self.context.project = self.project + #user is set in each test + super(AccessTestCase, self).setUp() + + def tearDown(self): + um = UserManager.instance() + # Delete the test project + um.delete_project('testproj') + # Delete the test user + um.delete_user('testadmin') + um.delete_user('testpmsys') + um.delete_user('testnet') + um.delete_user('testsys') + super(AccessTestCase, self).tearDown() + + def test_001_allow_all(self): + self.context.user = self.testadmin + self.assertTrue(self._allow_all(self.context)) + self.context.user = self.testpmsys + self.assertTrue(self._allow_all(self.context)) + self.context.user = self.testnet + self.assertTrue(self._allow_all(self.context)) + self.context.user = self.testsys + self.assertTrue(self._allow_all(self.context)) + + def test_002_allow_none(self): + self.context.user = self.testadmin + self.assertTrue(self._allow_none(self.context)) + self.context.user = self.testpmsys + self.assertRaises(exception.NotAuthorized, self._allow_none, self.context) + self.context.user = self.testnet + self.assertRaises(exception.NotAuthorized, self._allow_none, self.context) + self.context.user = self.testsys + self.assertRaises(exception.NotAuthorized, self._allow_none, self.context) + + def test_003_allow_project_manager(self): + self.context.user = self.testadmin + self.assertTrue(self._allow_project_manager(self.context)) + self.context.user = self.testpmsys + self.assertTrue(self._allow_project_manager(self.context)) + self.context.user = self.testnet + self.assertRaises(exception.NotAuthorized, self._allow_project_manager, self.context) + self.context.user = self.testsys + self.assertRaises(exception.NotAuthorized, self._allow_project_manager, self.context) + + def test_004_allow_sys_and_net(self): + self.context.user = self.testadmin + self.assertTrue(self._allow_sys_and_net(self.context)) + self.context.user = self.testpmsys # doesn't have the per project sysadmin + self.assertRaises(exception.NotAuthorized, self._allow_sys_and_net, self.context) + self.context.user = self.testnet + self.assertTrue(self._allow_sys_and_net(self.context)) + self.context.user = self.testsys + self.assertTrue(self._allow_sys_and_net(self.context)) + + def test_005_allow_sys_no_pm(self): + self.context.user = self.testadmin + self.assertTrue(self._allow_sys_no_pm(self.context)) + self.context.user = self.testpmsys + self.assertRaises(exception.NotAuthorized, self._allow_sys_no_pm, self.context) + self.context.user = self.testnet + self.assertRaises(exception.NotAuthorized, self._allow_sys_no_pm, self.context) + self.context.user = self.testsys + self.assertTrue(self._allow_sys_no_pm(self.context)) + + @rbac.allow('all') + def _allow_all(self, context): + return True + + @rbac.allow('none') + def _allow_none(self, context): + return True + + @rbac.allow('projectmanager') + def _allow_project_manager(self, context): + return True + + @rbac.allow('sysadmin', 'netadmin') + def _allow_sys_and_net(self, context): + return True + + @rbac.allow('sysadmin') + @rbac.deny('projectmanager') + def _allow_sys_no_pm(self, context): + return True + +if __name__ == "__main__": + # TODO: Implement use_fake as an option + unittest.main() diff --git a/nova/tests/users_unittest.py b/nova/tests/users_unittest.py index ff34b8957..a226de455 100644 --- a/nova/tests/users_unittest.py +++ b/nova/tests/users_unittest.py @@ -99,6 +99,16 @@ class UserTestCase(test.BaseTestCase): users = self.users.get_users() self.assertTrue(filter(lambda u: u.id == 'test1', users)) + def test_101_can_add_user_role(self): + self.assertFalse(self.users.has_role('test1', 'itsec')) + self.users.add_role('test1', 'itsec') + self.assertTrue(self.users.has_role('test1', 'itsec')) + + def test_199_can_remove_user_role(self): + self.assertTrue(self.users.has_role('test1', 'itsec')) + self.users.remove_role('test1', 'itsec') + self.assertFalse(self.users.has_role('test1', 'itsec')) + def test_201_can_create_project(self): project = self.users.create_project('testproj', 'test1', 'A test project', ['test1']) self.assertTrue(filter(lambda p: p.name == 'testproj', self.users.get_projects())) @@ -151,6 +161,22 @@ class UserTestCase(test.BaseTestCase): else: self.assertFalse(signed_cert.verify(cloud_cert.get_pubkey())) + def test_210_can_add_project_role(self): + project = self.users.get_project('testproj') + self.assertFalse(project.has_role('test1', 'sysadmin')) + self.users.add_role('test1', 'sysadmin') + self.assertFalse(project.has_role('test1', 'sysadmin')) + project.add_role('test1', 'sysadmin') + self.assertTrue(project.has_role('test1', 'sysadmin')) + + def test_211_can_remove_project_role(self): + project = self.users.get_project('testproj') + self.assertTrue(project.has_role('test1', 'sysadmin')) + project.remove_role('test1', 'sysadmin') + self.assertFalse(project.has_role('test1', 'sysadmin')) + self.users.remove_role('test1', 'sysadmin') + self.assertFalse(project.has_role('test1', 'sysadmin')) + def test_299_can_delete_project(self): self.users.delete_project('testproj') self.assertFalse(filter(lambda p: p.name == 'testproj', self.users.get_projects())) diff --git a/run_tests.py b/run_tests.py index f80f0af16..847911032 100644 --- a/run_tests.py +++ b/run_tests.py @@ -44,6 +44,7 @@ from twisted.scripts import trial as trial_script from nova import flags from nova import twistd +from nova.tests.access_unittest import * from nova.tests.api_unittest import * from nova.tests.cloud_unittest import * from nova.tests.keeper_unittest import * -- cgit From bf448e27a31a93f65d01001ccfad1511b9557afa Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: sensible rbac defaults Conflicts: nova/endpoint/cloud.py --- nova/endpoint/cloud.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 74da0eea3..1a433a2aa 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -33,6 +33,7 @@ from nova import flags from nova import rpc from nova import utils from nova import exception +from nova.auth import rbac from nova.auth import users from nova.compute import model from nova.compute import network @@ -158,10 +159,12 @@ class CloudController(object): data['product-codes'] = i['product_codes'] return data + @rbac.allow('all') def describe_availability_zones(self, context, **kwargs): return {'availabilityZoneInfo': [{'zoneName': 'nova', 'zoneState': 'available'}]} + @rbac.allow('all') def describe_key_pairs(self, context, key_name=None, **kwargs): key_pairs = [] key_names = key_name and key_name or [] @@ -182,6 +185,7 @@ class CloudController(object): return { 'keypairsSet': key_pairs } + @rbac.allow('all') def create_key_pair(self, context, key_name, **kwargs): try: d = defer.Deferred() @@ -200,23 +204,28 @@ class CloudController(object): except users.UserError, e: raise + @rbac.allow('all') def delete_key_pair(self, context, key_name, **kwargs): context.user.delete_key_pair(key_name) # aws returns true even if the key doens't exist return True + @rbac.allow('all') def describe_security_groups(self, context, group_names, **kwargs): groups = { 'securityGroupSet': [] } # Stubbed for now to unblock other things. return groups + @rbac.allow('netadmin') def create_security_group(self, context, group_name, **kwargs): return True + @rbac.allow('netadmin') def delete_security_group(self, context, group_name, **kwargs): return True + @rbac.allow('projectmanager', 'sysadmin') def get_console_output(self, context, instance_id, **kwargs): # instance_id is passed in as a list of instances instance = self._get_instance(context, instance_id[0]) @@ -232,6 +241,7 @@ class CloudController(object): else: return None + @rbac.allow('projectmanager', 'sysadmin') def describe_volumes(self, context, **kwargs): volumes = [] for volume in self.volumes: @@ -256,6 +266,7 @@ class CloudController(object): volume.get('mountpoint', '')) return v + @rbac.allow('projectmanager', 'sysadmin') def create_volume(self, context, size, **kwargs): # TODO(vish): refactor this to create the volume object here and tell storage to create it res = rpc.call(FLAGS.storage_topic, {"method": "create_volume", @@ -298,6 +309,7 @@ class CloudController(object): return volume raise exception.NotFound('Volume %s could not be found' % volume_id) + @rbac.allow('projectmanager', 'sysadmin') def attach_volume(self, context, volume_id, instance_id, device, **kwargs): volume = self._get_volume(context, volume_id) storage_node = volume['node_name'] @@ -320,6 +332,7 @@ class CloudController(object): return defer.succeed(True) + @rbac.allow('projectmanager', 'sysadmin') def detach_volume(self, context, volume_id, **kwargs): # TODO(joshua): Make sure the updated state has been received first volume = self._get_volume(context, volume_id) @@ -346,6 +359,7 @@ class CloudController(object): return None return [{str: x} for x in lst] + @rbac.allow('all') def describe_instances(self, context, **kwargs): return defer.succeed(self._format_instances(context)) @@ -391,6 +405,7 @@ class CloudController(object): instance_response = {'reservationSet' : list(reservations.values()) } return instance_response + @rbac.allow('all') def describe_addresses(self, context, **kwargs): return self.format_addresses(context) @@ -413,15 +428,18 @@ class CloudController(object): # logging.debug(addresses) return {'addressesSet': addresses} + @rbac.allow('netadmin') def allocate_address(self, context, **kwargs): address = self.network.allocate_ip( context.user.id, context.project.id, 'public') return defer.succeed({'addressSet': [{'publicIp' : address}]}) + @rbac.allow('netadmin') def release_address(self, context, public_ip, **kwargs): self.network.deallocate_ip(public_ip) return defer.succeed({'releaseResponse': ["Address released."]}) + @rbac.allow('netadmin') def associate_address(self, context, instance_id, **kwargs): instance = self._get_instance(context, instance_id) self.network.associate_address( @@ -430,12 +448,14 @@ class CloudController(object): instance_id) return defer.succeed({'associateResponse': ["Address associated."]}) + @rbac.allow('netadmin') def disassociate_address(self, context, public_ip, **kwargs): address = self._get_address(public_ip) self.network.disassociate_address(public_ip) # TODO - Strip the IP from the instance return defer.succeed({'disassociateResponse': ["Address disassociated."]}) + @rbac.allow('projectmanager', 'sysadmin') def run_instances(self, context, **kwargs): image = self._get_image(context, kwargs['image_id']) logging.debug("Going to run instances...") @@ -478,6 +498,7 @@ class CloudController(object): return defer.succeed(self._format_instances( context, reservation_id)) + @rbac.allow('projectmanager', 'sysadmin') def terminate_instances(self, context, instance_id, **kwargs): logging.debug("Going to start terminating instances") for i in instance_id: @@ -506,6 +527,7 @@ class CloudController(object): instance.destroy() return defer.succeed(True) + @rbac.allow('projectmanager', 'sysadmin') def reboot_instances(self, context, instance_id, **kwargs): """instance_id is a list of instance ids""" for i in instance_id: @@ -517,6 +539,7 @@ class CloudController(object): "args" : {"instance_id": i}}) return defer.succeed(True) + @rbac.allow('projectmanager', 'sysadmin') def delete_volume(self, context, volume_id, **kwargs): # TODO: return error if not authorized volume = self._get_volume(context, volume_id) @@ -526,16 +549,19 @@ class CloudController(object): "args" : {"volume_id": volume_id}}) return defer.succeed(True) + @rbac.allow('all') def describe_images(self, context, image_id=None, **kwargs): # The objectstore does its own authorization for describe imageSet = images.list(context, image_id) return defer.succeed({'imagesSet': imageSet}) + @rbac.allow('projectmanager', 'sysadmin') def deregister_image(self, context, image_id, **kwargs): # FIXME: should the objectstore be doing these authorization checks? images.deregister(context, image_id) return defer.succeed({'imageId': image_id}) + @rbac.allow('projectmanager', 'sysadmin') def register_image(self, context, image_location=None, **kwargs): # FIXME: should the objectstore be doing these authorization checks? if image_location is None and kwargs.has_key('name'): @@ -558,6 +584,7 @@ class CloudController(object): return defer.succeed(result) + @rbac.allow('projectmanager', 'sysadmin') def modify_image_attribute(self, context, image_id, attribute, operation_type, **kwargs): # TODO(devcamcar): Support users and groups other than 'all'. if attribute != 'launchPermission': -- cgit From 1183f3ebc8ace74f8413b80d23b67b2d14094432 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: nasa ldap defaults --- nova/auth/slap.sh | 26 ++++++++++++++++++++++++++ nova/auth/users.py | 6 +++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/nova/auth/slap.sh b/nova/auth/slap.sh index c3369e396..44a041d74 100755 --- a/nova/auth/slap.sh +++ b/nova/auth/slap.sh @@ -213,6 +213,32 @@ description: Special account for authenticating users userPassword: {MD5}TLnIqASP0CKUR3/LGkEZGg== objectClass: account objectClass: simpleSecurityObject + +# create the sysadmin entry + +dn: cn=sysadmins,ou=Groups,dc=example,dc=com +objectclass: groupOfNames +cn: sysadmins +description: IT admin group +member: uid=admin,ou=Users,dc=example,dc=com + +dn: cn=netadmins,ou=Groups,dc=example,dc=com +objectclass: groupOfNames +cn: netadmins +description: Network admin group +member: uid=admin,ou=Users,dc=example,dc=com + +dn: cn=cloudadmins,ou=Groups,dc=example,dc=com +objectclass: groupOfNames +cn: cloudadmins +description: Cloud admin group +member: uid=admin,ou=Users,dc=example,dc=com + +dn: cn=itsec,ou=Groups,dc=example,dc=com +objectclass: groupOfNames +cn: itsec +description: IT security users group +member: uid=admin,ou=Users,dc=example,dc=com BASE_LDIF_EOF /etc/init.d/slapd stop diff --git a/nova/auth/users.py b/nova/auth/users.py index f3248166c..118740182 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -58,16 +58,20 @@ flags.DEFINE_string('role_ldap_subtree', 'ou=Groups,dc=example,dc=com', 'OU for # mapping with these flags is necessary because we're going to tie in to an existing ldap schema flags.DEFINE_string('ldap_cloudadmin', 'cn=cloudadmins,ou=Groups,dc=example,dc=com', 'cn for Cloud Admins') +flags.DEFINE_string('ldap_itsec', + 'cn=itsec,ou=Groups,dc=example,dc=com', 'cn for ItSec') flags.DEFINE_string('ldap_sysadmin', 'cn=sysadmins,ou=Groups,dc=example,dc=com', 'cn for Sysadmins') flags.DEFINE_string('ldap_netadmin', 'cn=netadmins,ou=Groups,dc=example,dc=com', 'cn for NetAdmins') +flags.DEFINE_string('ldap_developer', + 'cn=developers,ou=Groups,dc=example,dc=com', 'cn for Developers') # a user with one of these roles will be a superuser and have access to all api commands flags.DEFINE_list('superuser_roles', ['cloudadmin'], 'roles that ignore rbac checking completely') # a user with one of these roles will have it for every project, even if he or she is not a member of the project -flags.DEFINE_list('global_roles', ['cloudadmin'], 'roles that apply to all projects') +flags.DEFINE_list('global_roles', ['cloudadmin', 'itsec'], 'roles that apply to all projects') flags.DEFINE_string('credentials_template', utils.abspath('auth/novarc.template'), -- cgit From 384742d65d756412f75df727b32f6c06754ef494 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: fix instance iteration to use self.instdir.all instead of older iterators Conflicts: nova/endpoint/cloud.py --- nova/endpoint/cloud.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 1a433a2aa..2b5d59420 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -98,14 +98,13 @@ class CloudController(object): def _get_mpi_data(self, project_id): result = {} - for node_name, node in self.instances.iteritems(): - for instance in node.values(): - if instance['project_id'] == project_id: - line = '%s slots=%d' % (instance['private_dns_name'], instance.get('vcpus', 0)) - if instance['key_name'] in result: - result[instance['key_name']].append(line) - else: - result[instance['key_name']] = [line] + for instance in self.instdir.all: + if instance['project_id'] == project_id: + line = '%s slots=%d' % (instance['private_dns_name'], instance.get('vcpus', 0)) + if instance['key_name'] in result: + result[instance['key_name']].append(line) + else: + result[instance['key_name']] = [line] return result def get_metadata(self, ip): @@ -365,7 +364,7 @@ class CloudController(object): def _format_instances(self, context, reservation_id = None): reservations = {} - for instance in self.instances: + for instance in self.instdir.all: res_id = instance.get('reservation_id', 'Unknown') if ((context.user.is_admin() or context.project.id == instance['project_id']) and (reservation_id == None or reservation_id == res_id)): -- cgit From 7b8747024d1711c6a45dd05ae397f26bd054a2d1 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: Fix for #437 (deleting attached volumes), plus some >9 blade_id fixes. --- nova/endpoint/cloud.py | 2 -- nova/tests/storage_unittest.py | 28 ++++++++++++------ nova/volume/storage.py | 66 +++++++++++++++++++++++++----------------- 3 files changed, 59 insertions(+), 37 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 2b5d59420..2d7e82387 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -316,8 +316,6 @@ class CloudController(object): instance = self._get_instance(context, instance_id) compute_node = instance['node_name'] aoe_device = volume['aoe_device'] - # Needs to get right node controller for attaching to - # TODO: Maybe have another exchange that goes to everyone? rpc.cast('%s.%s' % (FLAGS.compute_topic, compute_node), {"method": "attach_volume", "args" : {"aoe_device": aoe_device, diff --git a/nova/tests/storage_unittest.py b/nova/tests/storage_unittest.py index 31966d2d5..80cfaebec 100644 --- a/nova/tests/storage_unittest.py +++ b/nova/tests/storage_unittest.py @@ -48,14 +48,10 @@ class StorageTestCase(test.TrialTestCase): else: self.mystorage = storage.BlockStore() - @test.skip_if_fake def test_run_create_volume(self): vol_size = '0' user_id = 'fake' volume_id = self.mystorage.create_volume(vol_size, user_id) - # rv = self.mystorage.describe_volumes() - - # Volumes have to be sorted by timestamp in order to work here... # TODO(termie): get_volume returns differently than create_volume self.assertEqual(volume_id, self.mystorage.get_volume(volume_id)['volume_id']) @@ -65,22 +61,36 @@ class StorageTestCase(test.TrialTestCase): self.mystorage.get_volume, volume_id) - @test.skip_if_fake def test_run_attach_detach_volume(self): # Create one volume and one node to test with instance_id = "storage-test" - # TODO(joshua) - Redo this test, can't make fake instances this way any more - # rv = self.mynode.run_instance(instance_id) vol_size = "5" user_id = "fake" + mountpoint = "/dev/sdf" volume_id = self.mystorage.create_volume(vol_size, user_id) rv = self.mystorage.attach_volume(volume_id, instance_id, - "/dev/sdf") + mountpoint) volume_obj = self.mystorage.get_volume(volume_id) self.assertEqual(volume_obj['status'], "attached") - # TODO(???): assert that it's attached to the right instance + self.assertEqual(volume_obj['instance_id'], instance_id) + self.assertEqual(volume_obj['mountpoint'], mountpoint) + + self.assertRaises(exception.Error, + self.mystorage.delete_volume, + volume_id) rv = self.mystorage.detach_volume(volume_id) volume_obj = self.mystorage.get_volume(volume_id) self.assertEqual(volume_obj['status'], "available") + + rv = self.mystorage.delete_volume(volume_id) + self.assertRaises(exception.Error, + self.mystorage.get_volume, + volume_id) + + def test_multi_node(self): + # TODO(termie): Figure out how to test with two nodes, + # each of them having a different FLAG for storage_node + # This will allow us to test cross-node interactions + pass diff --git a/nova/volume/storage.py b/nova/volume/storage.py index cf64b995f..3efef085f 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -56,7 +56,14 @@ flags.DEFINE_string('storage_availability_zone', flags.DEFINE_boolean('fake_storage', False, 'Should we make real storage volumes to attach?') +# TODO(joshua) Index of volumes by project + class BlockStore(object): + """ + There is one BlockStore running on each volume node. + However, each BlockStore can report on the state of + *all* volumes in the cluster. + """ def __init__(self): super(BlockStore, self).__init__() self.volume_class = Volume @@ -78,6 +85,7 @@ class BlockStore(object): logging.debug("Creating volume of size: %s" % (size)) vol = self.volume_class.create(size, user_id) self.keeper.set_add('volumes', vol['volume_id']) + self.keeper.set_add('volumes:%s' % (FLAGS.storage_name), vol['volume_id']) self._restart_exports() return vol['volume_id'] @@ -87,14 +95,6 @@ class BlockStore(object): return self.volume_class(volume_id=volume_id) raise exception.Error("Volume does not exist") - def by_project(self, project): - """ returns a list of volume objects for a project """ - # TODO(termie): I don't understand why this is doing a range - #for volume_id in datastore.Redis.instance().lrange("project:%s:volumes" % - #project, 0, -1): - for volume_id in datastore['project:%s:volumes' % project]: - yield self.volume_class(volume_id=volume_id) - def by_node(self, node_id): """ returns a list of volumes for a node """ for volume in self.all: @@ -104,35 +104,48 @@ class BlockStore(object): @property def all(self): """ returns a list of all volumes """ - for volume_id in self.keeper['volumes']: + for volume_id in self.keeper.set_members('volumes'): yield self.volume_class(volume_id=volume_id) + @property + def local(self): + """ returns a list of locally attached volumes """ + for volume_id in self.keeper.set_members('volumes:%s' % (FLAGS.storage_name)): + yield self.volume_class(volume_id=volume_id) def delete_volume(self, volume_id): logging.debug("Deleting volume with id of: %s" % (volume_id)) vol = self.get_volume(volume_id) + if vol['status'] == "attached": + raise exception.Error("Volume is still attached") + if vol['node_name'] != FLAGS.storage_name: + raise exception.Error("Volume is not local to this node") vol.destroy() self.keeper.set_remove('volumes', vol['volume_id']) + self.keeper.set_remove('volumes:%s' % (FLAGS.storage_name), vol['volume_id']) return True def attach_volume(self, volume_id, instance_id, mountpoint): - self.volume_class(volume_id).attach(instance_id, mountpoint) + vol = self.get_volume(volume_id) + if vol['status'] == "attached": + raise exception.Error("Volume is already attached") + if vol['node_name'] != FLAGS.storage_name: + raise exception.Error("Volume is not local to this node") + vol.attach(instance_id, mountpoint) def detach_volume(self, volume_id): - self.volume_class(volume_id).detach() - - def loop_volumes(self): - volumes = subprocess.Popen(["sudo", "lvs", "--noheadings"], stdout=subprocess.PIPE).communicate()[0].split("\n") - for lv in volumes: - if len(lv.split(" ")) > 1: - yield lv.split(" ")[2] + vol = self.get_volume(volume_id) + if vol['status'] == "available": + raise exception.Error("Volume is already detached") + if vol['node_name'] != FLAGS.storage_name: + raise exception.Error("Volume is not local to this node") + vol.detach() def _restart_exports(self): if FLAGS.fake_storage: return utils.runthis("Setting exports to auto: %s", "sudo vblade-persist auto all") utils.runthis("Starting all exports: %s", "sudo vblade-persist start all") - utils.runthis("Discovering AOE devices: %s", "sudo aoe-discover") def _init_volume_group(self): if FLAGS.fake_storage: @@ -145,9 +158,6 @@ class FakeBlockStore(BlockStore): def __init__(self): super(FakeBlockStore, self).__init__() - def loop_volumes(self): - return self.volumes - def _init_volume_group(self): pass @@ -208,7 +218,7 @@ class Volume(datastore.RedisModel): sizestr = '100M' else: sizestr = '%sG' % self['size'] - utils.runthis("Creating LV: %s", "sudo lvcreate -L %s -n %s %s" % (sizestr, self.volume_id, FLAGS.volume_group)) + utils.runthis("Creating LV: %s", "sudo lvcreate -L %s -n %s %s" % (sizestr, self['volume_id'], FLAGS.volume_group)) def _delete_lv(self): utils.runthis("Removing LV: %s", "sudo lvremove -f %s/%s" % (FLAGS.volume_group, self.volume_id)) @@ -216,14 +226,16 @@ class Volume(datastore.RedisModel): def setup_export(self): (shelf_id, blade_id) = get_next_aoe_numbers() self['aoe_device'] = "e%s.%s" % (shelf_id, blade_id) + self['shelf_id'] = shelf_id + self['blade_id'] = blade_id self.save() utils.runthis("Creating AOE export: %s", "sudo vblade-persist setup %s %s %s /dev/%s/%s" % (shelf_id, blade_id, FLAGS.aoe_eth_dev, FLAGS.volume_group, self.volume_id)) def _remove_export(self): - utils.runthis("Destroyed AOE export: %s", "sudo vblade-persist stop %s %s" % (self.aoe_device[1], self.aoe_device[3])) - utils.runthis("Destroyed AOE export: %s", "sudo vblade-persist destroy %s %s" % (self.aoe_device[1], self.aoe_device[3])) + utils.runthis("Stopped AOE export: %s", "sudo vblade-persist stop %s %s" % (self['shelf_id'], self['blade_id'])) + utils.runthis("Destroyed AOE export: %s", "sudo vblade-persist destroy %s %s" % (self['shelf_id'], self['blade_id'])) class FakeVolume(Volume): @@ -232,8 +244,10 @@ class FakeVolume(Volume): def setup_export(self): # TODO(???): This may not be good enough? - self['aoe_device'] = 'e%s.%s' % (FLAGS.shelf_id, - ''.join([random.choice('0123456789') for x in xrange(3)])) + blade_id = ''.join([random.choice('0123456789') for x in xrange(3)]) + self['shelf_id'] = FLAGS.shelf_id + self['blade_id'] = blade_id + self['aoe_device'] = "e%s.%s" % (FLAGS.shelf_id, blade_id) self.save() def _remove_export(self): -- cgit From c02283d077c667fa406d7e43d7a312c0f1fbdd86 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: Adding nojekyll for directories --- .nojekyll | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .nojekyll diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb -- cgit From 32850264fdec24971683f06ff4d1420691d0bf0d Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:54 +0100 Subject: Volumes support intermediate state. Don't have to cast to storage nodes for attach/detach anymore, just let node update redis with state. --- nova/compute/model.py | 14 -------- nova/compute/node.py | 18 +++++++---- nova/datastore.py | 13 ++++++-- nova/endpoint/cloud.py | 65 +++++++++++++++++++++++--------------- nova/tests/storage_unittest.py | 19 ++++++----- nova/volume/storage.py | 72 ++++++++++++++++++++---------------------- 6 files changed, 108 insertions(+), 93 deletions(-) diff --git a/nova/compute/model.py b/nova/compute/model.py index 2754e9e6d..03de7a455 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -190,20 +190,6 @@ class Instance(object): """ Returns a reservation object """ pass -# class Reservation(object): -# """ ORM wrapper for a batch of launched instances """ -# def __init__(self): -# pass -# -# def userdata(self): -# """ """ -# pass -# -# -# class NodeDirectory(object): -# def __init__(self): -# pass -# if __name__ == "__main__": import doctest diff --git a/nova/compute/node.py b/nova/compute/node.py index 72c2f2b70..b8b46d1e2 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -46,6 +46,7 @@ from nova import utils from nova.compute import disk from nova.compute import model from nova.compute import network +from nova.volume import storage from nova.objectstore import image # for image_path flag FLAGS = flags.FLAGS @@ -203,24 +204,29 @@ class Node(object, service.Service): @defer.inlineCallbacks @exception.wrap_exception def attach_volume(self, instance_id = None, - aoe_device = None, mountpoint = None): - utils.runthis("Attached Volume: %s", + volume_id = None, mountpoint = None): + volume = storage.get_volume(volume_id) + yield self._init_aoe() + yield utils.runthis("Attached Volume: %s", "sudo virsh attach-disk %s /dev/etherd/%s %s" - % (instance_id, aoe_device, mountpoint.split("/")[-1])) - return defer.succeed(True) + % (instance_id, volume['aoe_device'], mountpoint.split("/")[-1])) + volume.finish_attach() + defer.returnValue(True) def _init_aoe(self): utils.runthis("Doin an AoE discover, returns %s", "sudo aoe-discover") utils.runthis("Doin an AoE stat, returns %s", "sudo aoe-stat") @exception.wrap_exception - def detach_volume(self, instance_id, mountpoint): + def detach_volume(self, instance_id, volume_id): """ detach a volume from an instance """ # despite the documentation, virsh detach-disk just wants the device # name without the leading /dev/ - target = mountpoint.rpartition('/dev/')[2] + volume = storage.get_volume(volume_id) + target = volume['mountpoint'].rpartition('/dev/')[2] utils.runthis("Detached Volume: %s", "sudo virsh detach-disk %s %s " % (instance_id, target)) + volume.finish_detach() return defer.succeed(True) diff --git a/nova/datastore.py b/nova/datastore.py index 0da89d594..055a30a79 100644 --- a/nova/datastore.py +++ b/nova/datastore.py @@ -76,10 +76,19 @@ class RedisModel(object): self.set_default_state() def set_default_state(self): - self.state = {'state' : 'pending'} + self.state = {'state' : 'pending', + 'node_name': 'unassigned', + 'project_id': 'unassigned', + 'user_id': 'unassigned'} self.state[self.object_type+"_id"] = self.object_id self.state["create_time"] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) - + + @property + def project(self): + if self.state.get('project_id', None): + return self.state['project_id'] + return self.state.get('owner_id', 'unassigned') + @property def __redis_key(self): """ Magic string for keys """ diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 2d7e82387..9ad5816b4 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -263,6 +263,15 @@ class CloudController(object): volume.get('node_name', None), volume.get('instance_id', ''), volume.get('mountpoint', '')) + if volume['status'] == 'attached': + v['attachmentSet'] = [{'attachTime': volume['attachTime'], + 'deleteOnTermination': volume['deleteOnTermination'], + 'device' : volume['mountpoint'], + 'instanceId' : volume['instance_id'], + 'status' : 'attached', + 'volume_id' : volume['volume_id']}] + else: + v['attachmentSet'] = [{}] return v @rbac.allow('projectmanager', 'sysadmin') @@ -302,54 +311,58 @@ class CloudController(object): raise exception.NotFound('Instance %s could not be found' % instance_id) def _get_volume(self, context, volume_id): - for volume in self.volumes: - if volume['volume_id'] == volume_id: - if context.user.is_admin() or volume['project_id'] == context.project.id: - return volume + volume = storage.get_volume(volume_id) + if context.user.is_admin() or volume['project_id'] == context.project.id: + return volume raise exception.NotFound('Volume %s could not be found' % volume_id) @rbac.allow('projectmanager', 'sysadmin') def attach_volume(self, context, volume_id, instance_id, device, **kwargs): volume = self._get_volume(context, volume_id) - storage_node = volume['node_name'] - # TODO: (joshua) Fix volumes to store creator id + if volume['status'] == "attached": + raise exception.Error("Volume is already attached") + volume.start_attach(instance_id, device) instance = self._get_instance(context, instance_id) compute_node = instance['node_name'] - aoe_device = volume['aoe_device'] rpc.cast('%s.%s' % (FLAGS.compute_topic, compute_node), - {"method": "attach_volume", - "args" : {"aoe_device": aoe_device, - "instance_id" : instance_id, - "mountpoint" : device}}) - rpc.cast('%s.%s' % (FLAGS.storage_topic, storage_node), {"method": "attach_volume", "args" : {"volume_id": volume_id, "instance_id" : instance_id, "mountpoint" : device}}) - return defer.succeed(True) + return defer.succeed({'attachTime' : volume['attachTime'], + 'device' : volume['mountpoint'], + 'instanceId' : instance_id, + 'requestId' : context.request_id, + 'status' : volume['attachStatus'], + 'volumeId' : volume_id}) @rbac.allow('projectmanager', 'sysadmin') def detach_volume(self, context, volume_id, **kwargs): - # TODO(joshua): Make sure the updated state has been received first volume = self._get_volume(context, volume_id) - storage_node = volume['node_name'] - if 'instance_id' in volume.keys(): - instance_id = volume['instance_id'] + instance_id = volume.get('instance_id', None) + if volume['status'] == "available": + raise exception.Error("Volume is already detached") + volume.start_detach() + if instance_id: try: instance = self._get_instance(context, instance_id) - compute_node = instance['node_name'] - mountpoint = volume['mountpoint'] - rpc.cast('%s.%s' % (FLAGS.compute_topic, compute_node), + rpc.cast('%s.%s' % (FLAGS.compute_topic, instance['node_name']), {"method": "detach_volume", "args" : {"instance_id": instance_id, - "mountpoint": mountpoint}}) + "mountpoint": volume['mountpoint']}}) except exception.NotFound: - pass - rpc.cast('%s.%s' % (FLAGS.storage_topic, storage_node), - {"method": "detach_volume", - "args" : {"volume_id": volume_id}}) - return defer.succeed(True) + # If the instance doesn't exist anymore, + # then we need to call detach blind + volume.finish_detach() + else: + raise exception.Error("Volume isn't attached to anything!") + return defer.succeed({'attachTime' : volume['attachTime'], + 'device' : volume['mountpoint'], + 'instanceId' : instance_id, + 'requestId' : context.request_id, + 'status' : volume['attachStatus'], + 'volumeId' : volume_id}) def _convert_to_set(self, lst, str): if lst == None or lst == []: diff --git a/nova/tests/storage_unittest.py b/nova/tests/storage_unittest.py index 80cfaebec..cbfedbfc1 100644 --- a/nova/tests/storage_unittest.py +++ b/nova/tests/storage_unittest.py @@ -54,11 +54,11 @@ class StorageTestCase(test.TrialTestCase): volume_id = self.mystorage.create_volume(vol_size, user_id) # TODO(termie): get_volume returns differently than create_volume self.assertEqual(volume_id, - self.mystorage.get_volume(volume_id)['volume_id']) + storage.get_volume(volume_id)['volume_id']) rv = self.mystorage.delete_volume(volume_id) self.assertRaises(exception.Error, - self.mystorage.get_volume, + storage.get_volume, volume_id) def test_run_attach_detach_volume(self): @@ -68,11 +68,14 @@ class StorageTestCase(test.TrialTestCase): user_id = "fake" mountpoint = "/dev/sdf" volume_id = self.mystorage.create_volume(vol_size, user_id) - rv = self.mystorage.attach_volume(volume_id, + + volume_obj = storage.get_volume(volume_id) + volume_obj.start_attach(instance_id, mountpoint) + rv = yield self.mynode.attach_volume(volume_id, instance_id, mountpoint) - volume_obj = self.mystorage.get_volume(volume_id) - self.assertEqual(volume_obj['status'], "attached") + self.assertEqual(volume_obj['status'], "in-use") + self.assertEqual(volume_obj['attachStatus'], "attached") self.assertEqual(volume_obj['instance_id'], instance_id) self.assertEqual(volume_obj['mountpoint'], mountpoint) @@ -80,13 +83,13 @@ class StorageTestCase(test.TrialTestCase): self.mystorage.delete_volume, volume_id) - rv = self.mystorage.detach_volume(volume_id) - volume_obj = self.mystorage.get_volume(volume_id) + rv = yield self.mystorage.detach_volume(volume_id) + volume_obj = storage.get_volume(volume_id) self.assertEqual(volume_obj['status'], "available") rv = self.mystorage.delete_volume(volume_id) self.assertRaises(exception.Error, - self.mystorage.get_volume, + storage.get_volume, volume_id) def test_multi_node(self): diff --git a/nova/volume/storage.py b/nova/volume/storage.py index 3efef085f..a409ec0db 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -58,6 +58,15 @@ flags.DEFINE_boolean('fake_storage', False, # TODO(joshua) Index of volumes by project +def get_volume(volume_id): + """ Returns a redis-backed volume object """ + volume_class = Volume + if FLAGS.fake_storage: + volume_class = FakeVolume + if datastore.Keeper('storage-').set_is_member('volumes', volume_id): + return volume_class(volume_id=volume_id) + raise exception.Error("Volume does not exist") + class BlockStore(object): """ There is one BlockStore running on each volume node. @@ -89,17 +98,10 @@ class BlockStore(object): self._restart_exports() return vol['volume_id'] - def get_volume(self, volume_id): - """ Returns a redis-backed volume object """ - if self.keeper.set_is_member('volumes', volume_id): - return self.volume_class(volume_id=volume_id) - raise exception.Error("Volume does not exist") - def by_node(self, node_id): """ returns a list of volumes for a node """ - for volume in self.all: - if volume['node_name'] == node_id: - yield volume + for volume_id in self.keeper.set_members('volumes:%s' % (node_id)): + yield self.volume_class(volume_id=volume_id) @property def all(self): @@ -107,15 +109,9 @@ class BlockStore(object): for volume_id in self.keeper.set_members('volumes'): yield self.volume_class(volume_id=volume_id) - @property - def local(self): - """ returns a list of locally attached volumes """ - for volume_id in self.keeper.set_members('volumes:%s' % (FLAGS.storage_name)): - yield self.volume_class(volume_id=volume_id) - def delete_volume(self, volume_id): logging.debug("Deleting volume with id of: %s" % (volume_id)) - vol = self.get_volume(volume_id) + vol = get_volume(volume_id) if vol['status'] == "attached": raise exception.Error("Volume is still attached") if vol['node_name'] != FLAGS.storage_name: @@ -125,22 +121,6 @@ class BlockStore(object): self.keeper.set_remove('volumes:%s' % (FLAGS.storage_name), vol['volume_id']) return True - def attach_volume(self, volume_id, instance_id, mountpoint): - vol = self.get_volume(volume_id) - if vol['status'] == "attached": - raise exception.Error("Volume is already attached") - if vol['node_name'] != FLAGS.storage_name: - raise exception.Error("Volume is not local to this node") - vol.attach(instance_id, mountpoint) - - def detach_volume(self, volume_id): - vol = self.get_volume(volume_id) - if vol['status'] == "available": - raise exception.Error("Volume is already detached") - if vol['node_name'] != FLAGS.storage_name: - raise exception.Error("Volume is not local to this node") - vol.detach() - def _restart_exports(self): if FLAGS.fake_storage: return @@ -186,23 +166,41 @@ class Volume(datastore.RedisModel): vol["instance_id"] = 'none' vol["mountpoint"] = 'none' vol["create_time"] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) - vol["attachment_set"] = '' + vol['status'] = "creating" # creating | available | in-use + vol['attachStatus'] = "detached" # attaching | attached | detaching | detached + vol.save() vol.create_lv() vol.setup_export() - vol['status'] = "available" + # TODO(joshua) - We need to trigger a fanout message for aoe-discover on all the nodes + # TODO(joshua vol.save() return vol - def attach(self, instance_id, mountpoint): + def start_attach(self, instance_id, mountpoint): + """ """ self['instance_id'] = instance_id self['mountpoint'] = mountpoint - self['status'] = "attached" + self['status'] = "in-use" + self['attachStatus'] = "attaching" + self['attachTime'] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) + self['deleteOnTermination'] = 'False' + self.save() + + def finish_attach(self): + """ """ + self['attachStatus'] = "attached" + self.save() + + def start_detach(self): + """ """ + self['attachStatus'] = "detaching" self.save() - def detach(self): + def finish_detach(self): self['instance_id'] = None self['mountpoint'] = None self['status'] = "available" + self['attachStatus'] = "detached" self.save() def destroy(self): -- cgit From c0983f71f25bbe9a3a4d94c5ee79bbbdf8f57884 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: change pipelib to work with projects --- bin/nova-manage | 26 +++++++++++++------------- nova/auth/users.py | 3 --- nova/cloudpipe/api.py | 25 ++++++------------------- nova/cloudpipe/pipelib.py | 34 ++++++++++++++++++++++------------ 4 files changed, 41 insertions(+), 47 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 76de41308..b1e984096 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -38,37 +38,37 @@ class VpnCommands(object): self.pipe = pipelib.CloudPipe(cloud.CloudController()) def list(self): - print "%-12s\t" % 'user', + print "%-12s\t" % 'project', print "%-12s\t" % 'ip:port', print "%s" % 'state' - for user in self.manager.get_users(): - print "%-12s\t" % user.name, - print "%s:%s\t" % (user.vpn_ip, user.vpn_port), + for project in self.manager.get_projects(): + print "%-12s\t" % project.name, + print "%s:%s\t" % (project.vpn_ip, project.vpn_port), - vpn = self.__vpn_for(user.name) + vpn = self.__vpn_for(project.id) if vpn: print vpn['instance_id'], print vpn['state'] else: print None - def __vpn_for(self, username): + def __vpn_for(self, project_id): for instance in self.instdir.all: if (instance.state.has_key('image_id') and instance['image_id'] == FLAGS.vpn_image_id and not instance['state'] in ['shutting_down', 'shutdown'] - and instance['owner_id'] == username): + and instance['project_id'] == project_id): return instance def spawn(self): - for u in reversed(self.manager.get_users()): - if not self.__vpn_for(u.id): - print 'spawning %s' % u.id - self.pipe.launch_vpn_instance(u.id) + for p in reversed(self.manager.get_projects()): + if not self.__vpn_for(p.id): + print 'spawning %s' % p.id + self.pipe.launch_vpn_instance(p.id) time.sleep(10) - def run(self, username): - self.pipe.launch_vpn_instance(username) + def run(self, project_id): + self.pipe.launch_vpn_instance(project_id) class UserCommands(object): diff --git a/nova/auth/users.py b/nova/auth/users.py index 118740182..e165c3ff0 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -474,9 +474,6 @@ class UserManager(object): signed_cert = crypto.sign_csr(csr, Project.safe_id(project)) return (private_key, signed_cert) - def sign_cert(self, csr, uid): - return crypto.sign_csr(csr, uid) - 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())) diff --git a/nova/cloudpipe/api.py b/nova/cloudpipe/api.py index 5395e9724..a8ecbd285 100644 --- a/nova/cloudpipe/api.py +++ b/nova/cloudpipe/api.py @@ -35,36 +35,23 @@ class CloudPipeRequestHandler(tornado.web.RequestHandler): def get(self, path): path = self.request.path _log.debug( "Cloudpipe path is %s" % path) - self.manager = users.UserManager.instance() if path.endswith("/getca/"): self.send_root_ca() - elif path.endswith("/getcert/"): - _log.debug( "Getting zip for %s" % (path[9:])) - try: - self.send_signed_zip(self.path[9:]) - except Exception, err: - _log.debug('ERROR: %s\n' % str(err)) - raise tornado.web.HTTPError(404) self.finish() - def get_username_from_ip(self, ip): + def get_project_id_from_ip(self, ip): cc = self.application.controllers['Cloud'] instance = cc.get_instance_by_ip(ip) - return instance['owner_id'] + instance['project_id'] def send_root_ca(self): _log.debug( "Getting root ca") - username = self.get_username_from_ip(self.request.remote_ip) + project_id = self.get_project_id_from_ip(self.request.remote_ip) self.set_header("Content-Type", "text/plain") - self.write(crypto.fetch_ca(username)) - - def send_signed_zip(self, username): - self.set_header("Content-Type", "application/zip") - self.write(self.manager.get_signed_zip(username)) + self.write(crypto.fetch_ca(project_id)) def post(self, *args, **kwargs): - self.manager = users.UserManager.instance() - username = self.get_username_from_ip(self.request.remote_ip) + project_id = self.get_project_id_from_ip(self.request.remote_ip) cert = self.get_argument('cert', '') - self.write(self.manager.sign_cert(urllib.unquote(cert), username)) + self.write(crypto.sign_csr(urllib.unquote(cert), project_id)) self.finish() diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index f69486f3e..47a2602a6 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -21,6 +21,7 @@ an instance with it. import logging import os import tempfile +import base64 from zipfile import ZipFile, ZIP_DEFLATED from nova import flags @@ -39,9 +40,9 @@ class CloudPipe(object): self.controller = cloud_controller self.manager = users.UserManager.instance() - def launch_vpn_instance(self, username): - logging.debug( "Launching VPN for %s" % (username)) - user = self.manager.get_user(username) + def launch_vpn_instance(self, project_id): + logging.debug( "Launching VPN for %s" % (project_id)) + project = self.manager.get_project(project_id) # Make a payload.zip tmpfolder = tempfile.mkdtemp() filename = "payload.zip" @@ -51,26 +52,35 @@ class CloudPipe(object): z.write(FLAGS.boot_script_template,'autorun.sh') z.close() - self.setup_keypair(username) + key_name = self.setup_keypair(project.project_manager_id, project_id) zippy = open(zippath, "r") - context = api.APIRequestContext(handler=None, user=user) + context = api.APIRequestContext(handler=None, user=project.project_manager, project=project) reservation = self.controller.run_instances(context, - user_data=zippy.read().encode("base64"), + # run instances expects encoded userdata, it is decoded in the get_metadata_call + # autorun.sh also decodes the zip file, hence the double encoding + user_data=zippy.read().encode("base64").encode("base64"), max_count=1, min_count=1, image_id=FLAGS.vpn_image_id, - key_name="vpn-key", + key_name=key_name, security_groups=["vpn-secgroup"]) zippy.close() - def setup_keypair(self, username): + def setup_keypair(self, user_id, project_id): + key_name = '%s-key' % project_id try: - private_key, fingerprint = self.manager.generate_key_pair(username, "vpn-key") - os.mkdir("%s/%s" % (FLAGS.keys_path, username)) - private_key.save(os.path.abspath("%s/%s" % (FLAGS.keys_path, username))) - except: + private_key, fingerprint = self.manager.generate_key_pair(user_id, key_name) + try: + key_dir = os.path.join(FLAGS.keys_path, user_id) + os.makedirs(key_dir) + with open(os.path.join(key_dir, '%s.pem' % key_name),'w') as f: + f.write(private_key) + except: + pass + except exception.Duplicate: pass + return key_name # def setup_secgroups(self, username): # conn = self.euca.connection_for(username) -- cgit From 4a273bbbff2aaad5c83f9cb65bbab2c89fd643e4 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: Cleaning up my accidental merge of the docs branch --- .nojekyll | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .nojekyll diff --git a/.nojekyll b/.nojekyll deleted file mode 100644 index e69de29bb..000000000 -- cgit From 347eebe09199c70b93e07e8cf8c9344846e2fe00 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: Flush redis db in setup and teardown of tests. --- nova/test.py | 5 +++++ nova/tests/cloud_unittest.py | 3 +-- nova/tests/network_unittest.py | 3 +-- nova/tests/node_unittest.py | 3 +-- nova/tests/storage_unittest.py | 3 +-- nova/tests/users_unittest.py | 3 +-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nova/test.py b/nova/test.py index 610ad89aa..8cf60af70 100644 --- a/nova/test.py +++ b/nova/test.py @@ -103,6 +103,9 @@ class BaseTestCase(TrialTestCase): self._waiting = None self._doneWaiting = False self._timedOut = False + self.flags(redis_db=8) + r = datastore.Redis.instance() + r.flushdb() self.set_up() def set_up(self): @@ -118,6 +121,8 @@ class BaseTestCase(TrialTestCase): if FLAGS.fake_rabbit: fakerabbit.reset_all() self.tear_down() + r = datastore.Redis.instance() + r.flushdb() def _waitForTest(self, timeout=60): """ Push the ioloop along to wait for our test to complete. """ diff --git a/nova/tests/cloud_unittest.py b/nova/tests/cloud_unittest.py index 40eeb8a23..24472451f 100644 --- a/nova/tests/cloud_unittest.py +++ b/nova/tests/cloud_unittest.py @@ -40,8 +40,7 @@ class CloudTestCase(test.BaseTestCase): super(CloudTestCase, self).setUp() self.flags(fake_libvirt=True, fake_storage=True, - fake_users=True, - redis_db=8) + fake_users=True) self.conn = rpc.Connection.instance() logging.getLogger().setLevel(logging.DEBUG) diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index a2ad89a32..a5d80875d 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -32,8 +32,7 @@ class NetworkTestCase(test.TrialTestCase): self.flags(fake_libvirt=True, fake_storage=True, fake_network=True, - network_size=32, - redis_db=8) + network_size=32) logging.getLogger().setLevel(logging.DEBUG) self.manager = users.UserManager.instance() try: diff --git a/nova/tests/node_unittest.py b/nova/tests/node_unittest.py index 5ecd56d52..3807beeb1 100644 --- a/nova/tests/node_unittest.py +++ b/nova/tests/node_unittest.py @@ -56,8 +56,7 @@ class NodeConnectionTestCase(test.TrialTestCase): super(NodeConnectionTestCase, self).setUp() self.flags(fake_libvirt=True, fake_storage=True, - fake_users=True, - redis_db=8) + fake_users=True) self.node = node.Node() def create_instance(self): diff --git a/nova/tests/storage_unittest.py b/nova/tests/storage_unittest.py index cbfedbfc1..84f3126c0 100644 --- a/nova/tests/storage_unittest.py +++ b/nova/tests/storage_unittest.py @@ -41,8 +41,7 @@ class StorageTestCase(test.TrialTestCase): self.mynode = node.Node() self.mystorage = None self.flags(fake_libvirt=True, - fake_storage=True, - redis_db=8) + fake_storage=True) if FLAGS.fake_storage: self.mystorage = storage.FakeBlockStore() else: diff --git a/nova/tests/users_unittest.py b/nova/tests/users_unittest.py index a226de455..b87faec9e 100644 --- a/nova/tests/users_unittest.py +++ b/nova/tests/users_unittest.py @@ -34,8 +34,7 @@ class UserTestCase(test.BaseTestCase): def setUp(self): super(UserTestCase, self).setUp() self.flags(fake_libvirt=True, - fake_storage=True, - redis_db=8) + fake_storage=True) self.users = users.UserManager.instance() def test_001_can_create_users(self): -- cgit From 0ae67b85338a7f28cb230fc271f7cb632e98844a Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: Delete instance files on shutdown. --- nova/compute/node.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nova/compute/node.py b/nova/compute/node.py index b8b46d1e2..c977ceb97 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -403,15 +403,20 @@ class Instance(object): self._s['state'] = Instance.SHUTDOWN #self.datamodel['state'] = 'shutdown' #self.datamodel.save() - timer.stop() - d.callback(None) + timer.stop() + self._cleanup() + d.callback(None) except Exception: self._s['state'] = Instance.SHUTDOWN timer.stop() + self._cleanup() d.callback(None) timer.f = _wait_for_shutdown timer.start(interval=0.5, now=True) return d + + def _cleanup(self): + shutil.rmtree(os.path.abspath(self._s['basepath'])) @defer.inlineCallbacks @exception.wrap_exception -- cgit From ec621ee9a72ab2c154c6a6e82960d1d0dc3619d1 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: Refactored Instance to get rid of _s bits, and fixed some bugs in state management. Conflicts: nova/compute/node.py --- nova/auth/fakeldap.py | 6 +- nova/compute/model.py | 18 ++++ nova/compute/node.py | 196 ++++++++++++++++++++++-------------------- nova/datastore.py | 2 +- nova/test.py | 9 +- nova/tests/access_unittest.py | 7 +- nova/tests/api_unittest.py | 11 ++- nova/tests/fake_flags.py | 2 +- nova/tests/node_unittest.py | 4 + nova/tests/users_unittest.py | 2 + 10 files changed, 153 insertions(+), 104 deletions(-) diff --git a/nova/auth/fakeldap.py b/nova/auth/fakeldap.py index 8a5bbdf44..33003f057 100644 --- a/nova/auth/fakeldap.py +++ b/nova/auth/fakeldap.py @@ -40,7 +40,7 @@ def initialize(uri): class FakeLDAP(object): def __init__(self, _uri): - self.keeper = datastore.Keeper('fakeldap') + self.keeper = datastore.SqliteKeeper('fakeldap') #Redis keeper never works here... if self.keeper['objects'] is None: self.keeper['objects'] = {} @@ -91,7 +91,7 @@ class FakeLDAP(object): return False def search_s(self, dn, scope, query=None, fields=None): - logging.debug("searching for %s" % dn) + #logging.debug("searching for %s" % dn) filtered = {} d = self.keeper['objects'] or {} for cn, attrs in d.iteritems(): @@ -108,7 +108,7 @@ class FakeLDAP(object): return objects.items() def add_s(self, cn, attr): - logging.debug("adding %s" % cn) + #logging.debug("adding %s" % cn) stored = {} for k, v in attr: if type(v) is list: diff --git a/nova/compute/model.py b/nova/compute/model.py index 03de7a455..14f2461da 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -37,6 +37,8 @@ True True """ +import logging + from nova import vendor from nova import datastore @@ -128,9 +130,24 @@ class Instance(object): def __repr__(self): return "" % self.instance_id + def keys(self): + return self.state.keys() + + def copy(self): + copyDict = {} + for item in self.keys(): + copyDict[item] = self[item] + return copyDict + def get(self, item, default): return self.state.get(item, default) + def update(self, update_dict): + return self.state.update(update_dict) + + def setdefault(self, item, default): + return self.state.setdefault(item, default) + def __getitem__(self, item): return self.state[item] @@ -174,6 +191,7 @@ class Instance(object): """ deletes all related records from datastore. does NOT do anything to running libvirt state. """ + logging.info("Destroying datamodel for instance %s", self.instance_id) self.keeper.set_remove('project:%s:instances' % self.project, self.instance_id) del self.keeper[self.__redis_key] diff --git a/nova/compute/node.py b/nova/compute/node.py index c977ceb97..bb6e27e22 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -155,6 +155,7 @@ class Node(object, service.Service): # TODO(vish) check to make sure the availability zone matches new_inst = Instance(self._conn, name=instance_id, pool=self._pool, data=inst) + logging.info("Instances current state is %s", new_inst.state) if new_inst.is_running(): raise exception.Error("Instance is already running") d = new_inst.spawn() @@ -258,68 +259,49 @@ class Instance(object): self._conn = conn # TODO(vish): this can be removed after data has been updated # data doesn't seem to have a working iterator so in doesn't work - if not data.get('owner_id', None) is None: + if data.get('owner_id', None) is not None: data['user_id'] = data['owner_id'] data['project_id'] = data['owner_id'] self.datamodel = data - - # NOTE(termie): to be passed to multiprocess self._s must be - # pickle-able by cPickle - self._s = {} - - # TODO(termie): is instance_type that actual name for this? + size = data.get('instance_type', FLAGS.default_instance_type) if size not in INSTANCE_TYPES: raise exception.Error('invalid instance type: %s' % size) - self._s.update(INSTANCE_TYPES[size]) + self.datamodel.update(INSTANCE_TYPES[size]) - self._s['name'] = name - self._s['instance_id'] = name - self._s['instance_type'] = size - self._s['mac_address'] = data.get( - 'mac_address', 'df:df:df:df:df:df') - self._s['basepath'] = data.get( + self.datamodel['name'] = name + self.datamodel['instance_id'] = name + self.datamodel['basepath'] = data.get( 'basepath', os.path.abspath( os.path.join(FLAGS.instances_path, self.name))) - self._s['memory_kb'] = int(self._s['memory_mb']) * 1024 - self._s['image_id'] = data.get('image_id', FLAGS.default_image) - self._s['kernel_id'] = data.get('kernel_id', FLAGS.default_kernel) - self._s['ramdisk_id'] = data.get('ramdisk_id', FLAGS.default_ramdisk) - self._s['user_id'] = data.get('user_id', None) - self._s['project_id'] = data.get('project_id', self._s['user_id']) - self._s['node_name'] = data.get('node_name', '') - self._s['user_data'] = data.get('user_data', '') - self._s['ami_launch_index'] = data.get('ami_launch_index', None) - self._s['launch_time'] = data.get('launch_time', None) - self._s['reservation_id'] = data.get('reservation_id', None) - # self._s['state'] = Instance.NOSTATE - self._s['state'] = data.get('state', Instance.NOSTATE) - self._s['key_data'] = data.get('key_data', None) - - # TODO: we may not need to save the next few - self._s['groups'] = data.get('security_group', ['default']) - self._s['product_codes'] = data.get('product_code', []) - self._s['key_name'] = data.get('key_name', None) - self._s['addressing_type'] = data.get('addressing_type', None) - self._s['availability_zone'] = data.get('availability_zone', 'fixme') - - self._s['bridge_name'] = data.get('bridge_name', None) - #TODO: put real dns items here - self._s['private_dns_name'] = data.get('private_dns_name', 'fixme') - self._s['dns_name'] = data.get('dns_name', - self._s['private_dns_name']) + self.datamodel['memory_kb'] = int(self.datamodel['memory_mb']) * 1024 + self.datamodel.setdefault('image_id', FLAGS.default_image) + self.datamodel.setdefault('kernel_id', FLAGS.default_kernel) + self.datamodel.setdefault('ramdisk_id', FLAGS.default_ramdisk) + self.datamodel.setdefault('project_id', self.datamodel['user_id']) + self.datamodel.setdefault('bridge_name', None) + #self.datamodel.setdefault('key_data', None) + #self.datamodel.setdefault('key_name', None) + #self.datamodel.setdefault('addressing_type', None) + + # TODO(joshua) - The ugly non-flat ones + self.datamodel['groups'] = data.get('security_group', 'default') + # TODO(joshua): Support product codes somehow + self.datamodel.setdefault('product_codes', None) + + self.datamodel.save() logging.debug("Finished init of Instance with id of %s" % name) def toXml(self): # TODO(termie): cache? logging.debug("Starting the toXML method") libvirt_xml = open(FLAGS.libvirt_xml_template).read() - xml_info = self._s.copy() - #xml_info.update(self._s) + xml_info = self.datamodel.copy() + # TODO(joshua): Make this xml express the attached disks as well # TODO(termie): lazy lazy hack because xml is annoying - xml_info['nova'] = json.dumps(self._s) + xml_info['nova'] = json.dumps(self.datamodel.copy()) libvirt_xml = libvirt_xml % xml_info logging.debug("Finished the toXML method") @@ -328,16 +310,20 @@ class Instance(object): @classmethod def fromName(cls, conn, pool, name): """ use the saved data for reloading the instance """ - # if FLAGS.fake_libvirt: - # raise Exception('this is a bit useless, eh?') - instdir = model.InstanceDirectory() instance = instdir.get(name) return cls(conn=conn, pool=pool, name=name, data=instance) + def set_state(self, state_code, state_description=None): + self.datamodel['state'] = state_code + if not state_description: + state_description = STATE_NAMES[state_code] + self.datamodel['state_description'] = state_description + self.datamodel.save() + @property def state(self): - return self._s['state'] + return self.datamodel['state'] @property def name(self): @@ -364,16 +350,16 @@ class Instance(object): 'max_mem': max_mem, 'mem': mem, 'num_cpu': num_cpu, - 'cpu_time': cpu_time} + 'cpu_time': cpu_time, + 'node_name': FLAGS.node_name} def basepath(self, path=''): return os.path.abspath(os.path.join(self._s['basepath'], path)) def update_state(self): - info = self.info() - self.datamodel['state'] = info['state'] - self.datamodel['node_name'] = FLAGS.node_name - self.datamodel.save() + self.datamodel.update(self.info()) + self.set_state(self.state) + self.datamodel.save() # Extra, but harmless @exception.wrap_exception def destroy(self): @@ -382,8 +368,7 @@ class Instance(object): raise exception.Error('trying to destroy already destroyed' ' instance: %s' % self.name) - self.datamodel['state'] = 'shutting_down' - self.datamodel.save() + self.set_state(Instance.NOSTATE, 'shutting_down') try: virt_dom = self._conn.lookupByName(self.name) virt_dom.destroy() @@ -391,6 +376,7 @@ class Instance(object): pass # If the instance is already terminated, we're still happy d = defer.Deferred() + d.addCallback(lambda x: self._cleanup()) d.addCallback(lambda x: self.datamodel.destroy()) # TODO(termie): short-circuit me for tests # WE'LL save this for when we do shutdown, @@ -398,46 +384,52 @@ class Instance(object): timer = task.LoopingCall(f=None) def _wait_for_shutdown(): try: - info = self.info() - if info['state'] == Instance.SHUTDOWN: - self._s['state'] = Instance.SHUTDOWN - #self.datamodel['state'] = 'shutdown' - #self.datamodel.save() - timer.stop() - self._cleanup() - d.callback(None) + self.update_state() + if self.state == Instance.SHUTDOWN: + timer.stop() + d.callback(None) except Exception: - self._s['state'] = Instance.SHUTDOWN + self.set_state(Instance.SHUTDOWN) timer.stop() - self._cleanup() d.callback(None) timer.f = _wait_for_shutdown timer.start(interval=0.5, now=True) return d def _cleanup(self): - shutil.rmtree(os.path.abspath(self._s['basepath'])) + target = os.path.abspath(self.datamodel['basepath']) + logging.info("Deleting instance files at %s", target) + shutil.rmtree(target) @defer.inlineCallbacks @exception.wrap_exception def reboot(self): - # if not self.is_running(): - # raise exception.Error( - # 'trying to reboot a non-running' - # 'instance: %s (state: %s)' % (self.name, self.state)) + if not self.is_running(): + raise exception.Error( + 'trying to reboot a non-running' + 'instance: %s (state: %s)' % (self.name, self.state)) + logging.debug('rebooting instance %s' % self.name) + self.set_state(Instance.NOSTATE, 'rebooting') yield self._conn.lookupByName(self.name).destroy() - self.datamodel['state'] = 'rebooting' - self.datamodel.save() - self._s['state'] = Instance.NOSTATE self._conn.createXML(self.toXml(), 0) - # TODO(termie): this should actually register a callback to check - # for successful boot - self.datamodel['state'] = 'running' - self.datamodel.save() - self._s['state'] = Instance.RUNNING - logging.debug('rebooted instance %s' % self.name) - defer.returnValue(None) + + d = defer.Deferred() + timer = task.LoopingCall(f=None) + def _wait_for_reboot(): + try: + self.update_state() + if self.is_running(): + logging.debug('rebooted instance %s' % self.name) + timer.stop() + d.callback(None) + except Exception: + self.set_state(Instance.SHUTDOWN) + timer.stop() + d.callback(None) + timer.f = _wait_for_reboot + timer.start(interval=0.5, now=True) + yield d def _fetch_s3_image(self, image, path): url = _image_url('%s/image' % image) @@ -500,36 +492,56 @@ class Instance(object): @defer.inlineCallbacks @exception.wrap_exception def spawn(self): - self.datamodel['state'] = "spawning" - self.datamodel.save() + self.set_state(Instance.NOSTATE, 'spawning') logging.debug("Starting spawn in Instance") xml = self.toXml() + self.set_state(Instance.NOSTATE, 'launching') logging.info('self %s', self) try: yield self._create_image(xml) - self.datamodel['state'] = 'launching' - self.datamodel.save() self._conn.createXML(xml, 0) # TODO(termie): this should actually register # a callback to check for successful boot - self._s['state'] = Instance.RUNNING - self.datamodel['state'] = 'running' - self.datamodel.save() logging.debug("Instance is running") + + local_d = defer.Deferred() + timer = task.LoopingCall(f=None) + def _wait_for_boot(): + try: + self.update_state() + if self.is_running(): + logging.debug('booted instance %s' % self.name) + timer.stop() + local_d.callback(None) + except Exception: + self.set_state(Instance.SHUTDOWN) + logging.error('Failed to boot instance %s' % self.name) + timer.stop() + local_d.callback(None) + timer.f = _wait_for_boot + timer.start(interval=0.5, now=True) except Exception: - #logging.exception('while spawning instance: %s', self.name) - self.datamodel['state'] = 'shutdown' - self.datamodel.save() - raise + logging.debug(ex) + self.set_state(Instance.SHUTDOWN) @exception.wrap_exception def console_output(self): if not FLAGS.fake_libvirt: fname = os.path.abspath( - os.path.join(self._s['basepath'], 'console.log')) + os.path.join(self.datamodel['basepath'], 'console.log')) with open(fname, 'r') as f: console = f.read() else: console = 'FAKE CONSOLE OUTPUT' return defer.succeed(console) + +STATE_NAMES = { + Instance.NOSTATE : 'pending', + Instance.RUNNING : 'running', + Instance.BLOCKED : 'blocked', + Instance.PAUSED : 'paused', + Instance.SHUTDOWN : 'shutdown', + Instance.SHUTOFF : 'shutdown', + Instance.CRASHED : 'crashed', +} diff --git a/nova/datastore.py b/nova/datastore.py index 055a30a79..61e507cd1 100644 --- a/nova/datastore.py +++ b/nova/datastore.py @@ -333,7 +333,7 @@ class RedisKeeper(object): """ def __init__(self, prefix="redis-"): self.prefix = prefix - Redis.instance().ping() + #Redis.instance().ping() def __setitem__(self, item, value): """ diff --git a/nova/test.py b/nova/test.py index 8cf60af70..05cb5b504 100644 --- a/nova/test.py +++ b/nova/test.py @@ -53,6 +53,7 @@ def skip_if_fake(f): class TrialTestCase(trial_unittest.TestCase): + flush_db = True def setUp(self): super(TrialTestCase, self).setUp() @@ -61,6 +62,11 @@ class TrialTestCase(trial_unittest.TestCase): self.mox = mox.Mox() self.stubs = stubout.StubOutForTesting() self.flag_overrides = {} + self.flags(redis_db=8) + if self.flush_db: + logging.info("Flushing redis datastore") + r = datastore.Redis.instance() + r.flushdb() def tearDown(self): super(TrialTestCase, self).tearDown() @@ -103,9 +109,6 @@ class BaseTestCase(TrialTestCase): self._waiting = None self._doneWaiting = False self._timedOut = False - self.flags(redis_db=8) - r = datastore.Redis.instance() - r.flushdb() self.set_up() def set_up(self): diff --git a/nova/tests/access_unittest.py b/nova/tests/access_unittest.py index a1b574dd8..9eb528555 100644 --- a/nova/tests/access_unittest.py +++ b/nova/tests/access_unittest.py @@ -14,7 +14,7 @@ # limitations under the License. import unittest - +import logging from nova.auth.users import UserManager from nova.auth import rbac @@ -28,13 +28,15 @@ class Context(object): class AccessTestCase(test.BaseTestCase): def setUp(self): + super(AccessTestCase, self).setUp() FLAGS.fake_libvirt = True FLAGS.fake_storage = True um = UserManager.instance() # Make test users try: self.testadmin = um.create_user('testadmin') - except: pass + except Exception, err: + logging.error(str(err)) try: self.testpmsys = um.create_user('testpmsys') except: pass @@ -71,7 +73,6 @@ class AccessTestCase(test.BaseTestCase): self.context = Context() self.context.project = self.project #user is set in each test - super(AccessTestCase, self).setUp() def tearDown(self): um = UserManager.instance() diff --git a/nova/tests/api_unittest.py b/nova/tests/api_unittest.py index fdbf088f9..29834a840 100644 --- a/nova/tests/api_unittest.py +++ b/nova/tests/api_unittest.py @@ -174,16 +174,25 @@ class ApiEc2TestCase(test.BaseTestCase): def test_describe_instances(self): self.expect_http() self.mox.ReplayAll() - + try: + self.users.create_user('fake', 'fake', 'fake') + except Exception, _err: + pass # User may already exist self.assertEqual(self.ec2.get_all_instances(), []) + self.users.delete_user('fake') def test_get_all_key_pairs(self): self.expect_http() self.mox.ReplayAll() keyname = "".join(random.choice("sdiuisudfsdcnpaqwertasd") for x in range(random.randint(4, 8))) + try: + self.users.create_user('fake', 'fake', 'fake') + except Exception, _err: + pass # User may already exist self.users.generate_key_pair('fake', keyname) rv = self.ec2.get_all_key_pairs() self.assertTrue(filter(lambda k: k.name == keyname, rv)) + self.users.delete_user('fake') diff --git a/nova/tests/fake_flags.py b/nova/tests/fake_flags.py index 3c7b0be52..b7ec73601 100644 --- a/nova/tests/fake_flags.py +++ b/nova/tests/fake_flags.py @@ -21,6 +21,6 @@ FLAGS.fake_storage = True FLAGS.fake_rabbit = True FLAGS.fake_network = True FLAGS.fake_users = True -FLAGS.keeper_backend = 'sqlite' +#FLAGS.keeper_backend = 'sqlite' FLAGS.datastore_path = ':memory:' FLAGS.verbose = True diff --git a/nova/tests/node_unittest.py b/nova/tests/node_unittest.py index 3807beeb1..0666730af 100644 --- a/nova/tests/node_unittest.py +++ b/nova/tests/node_unittest.py @@ -14,6 +14,8 @@ # limitations under the License. import logging +import time + from xml.etree import ElementTree from nova import vendor @@ -81,11 +83,13 @@ class NodeConnectionTestCase(test.TrialTestCase): rv = yield self.node.run_instance(instance_id) rv = yield self.node.describe_instances() + logging.info("Running instances: %s", rv) self.assertEqual(rv[instance_id].name, instance_id) rv = yield self.node.terminate_instance(instance_id) rv = yield self.node.describe_instances() + logging.info("After terminating instances: %s", rv) self.assertEqual(rv, {}) @defer.inlineCallbacks diff --git a/nova/tests/users_unittest.py b/nova/tests/users_unittest.py index b87faec9e..850d59026 100644 --- a/nova/tests/users_unittest.py +++ b/nova/tests/users_unittest.py @@ -31,6 +31,7 @@ FLAGS = flags.FLAGS class UserTestCase(test.BaseTestCase): + flush_db = False def setUp(self): super(UserTestCase, self).setUp() self.flags(fake_libvirt=True, @@ -96,6 +97,7 @@ class UserTestCase(test.BaseTestCase): def test_010_can_list_users(self): users = self.users.get_users() + logging.warn(users) self.assertTrue(filter(lambda u: u.id == 'test1', users)) def test_101_can_add_user_role(self): -- cgit From 5d5e460ac841763f8e8a3ebc30ecd23821d9a351 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: Added back in missing gateway property on networks. --- nova/compute/network.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nova/compute/network.py b/nova/compute/network.py index 4489f26d4..15373cb20 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -103,6 +103,9 @@ class BaseNetwork(datastore.RedisModel): 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"]) -- cgit From bf9b83278f7b8f54f58b03b4cb0b4d0d6182f1fa Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: NetworkNode doesn't exist anymore --- bin/nova-compute | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/nova-compute b/bin/nova-compute index bd3648d20..f89bc86b1 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -2,13 +2,13 @@ # 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 -# +# # 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. @@ -17,7 +17,7 @@ """ Twistd daemon for the nova compute nodes. Receives messages via AMQP, manages pool of worker threads - for async tasks. + for async tasks. """ import logging @@ -55,7 +55,7 @@ logging.getLogger().setLevel(logging.DEBUG) def main(): logging.warn('Starting compute node') - n = node.NetworkNode() + n = node.Node() d = n.adopt_instances() d.addCallback(lambda x: logging.info('Adopted %d instances', x)) -- cgit From 4d81110e10e186c3b72a5cc60073a2cba8a98696 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: fix modify image attribute typo Conflicts: nova/endpoint/cloud.py --- nova/endpoint/cloud.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 9ad5816b4..f14532b97 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -352,7 +352,7 @@ class CloudController(object): "args" : {"instance_id": instance_id, "mountpoint": volume['mountpoint']}}) except exception.NotFound: - # If the instance doesn't exist anymore, + # If the instance doesn't exist anymore, # then we need to call detach blind volume.finish_detach() else: @@ -601,8 +601,8 @@ class CloudController(object): raise exception.ApiError('attribute not supported: %s' % attribute) if len(kwargs['user_group']) != 1 and kwargs['user_group'][0] != 'all': raise exception.ApiError('only group "all" is supported') - if not operation_type in ['add', 'remove']: - raise exception.ApiError('operation_type must be add or remove') + if not operation_type in ['add', 'delete']: + raise exception.ApiError('operation_type must be add or delete') result = images.modify(context, image_id, operation_type) return defer.succeed(result) -- cgit From 316435cce05c5506972d70f5894b0ea67880d3b6 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: fix objectstore handler typo --- nova/objectstore/handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/objectstore/handler.py b/nova/objectstore/handler.py index 3f00bb0c4..199df226a 100644 --- a/nova/objectstore/handler.py +++ b/nova/objectstore/handler.py @@ -294,7 +294,7 @@ class ImageHandler(BaseRequestHandler): image_object = image.Image(image_id) - if not image.is_authorized(self.context): + if not image_object.is_authorized(self.context): raise web.HTTPError(403) image_object.set_public(operation=='add') -- cgit From 9526e1b3f14a7d9b8b2dcf7012e099a13e6fc80e Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: one more handler typo --- nova/objectstore/handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/objectstore/handler.py b/nova/objectstore/handler.py index 199df226a..97c4eeb36 100644 --- a/nova/objectstore/handler.py +++ b/nova/objectstore/handler.py @@ -307,7 +307,7 @@ class ImageHandler(BaseRequestHandler): image_id = self.get_argument("image_id", u"") image_object = image.Image(image_id) - if not image.is_authorized(self.context): + if not image_object.is_authorized(self.context): raise web.HTTPError(403) image_object.delete() -- cgit From 8c535fae46a6944e1ca5fd8bb44db739befb0054 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:55 +0100 Subject: Adding missing default values and fixing bare Redis fetch for volume list. --- nova/endpoint/cloud.py | 2 +- nova/volume/storage.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index f14532b97..2e5a18afd 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -72,7 +72,7 @@ class CloudController(object): @property def volumes(self): """ returns a list of all volumes """ - for volume_id in datastore.Redis.instance().smembers("volumes"): + for volume_id in datastore.Redis.instance().smembers("storage-volumes"): volume = storage.Volume(volume_id=volume_id) yield volume diff --git a/nova/volume/storage.py b/nova/volume/storage.py index a409ec0db..1cf6b0343 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -165,9 +165,11 @@ class Volume(datastore.RedisModel): vol['availability_zone'] = FLAGS.storage_availability_zone vol["instance_id"] = 'none' vol["mountpoint"] = 'none' + vol['attachTime'] = 'none' vol["create_time"] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) vol['status'] = "creating" # creating | available | in-use vol['attachStatus'] = "detached" # attaching | attached | detaching | detached + vol['deleteOnTermination'] = 'False' vol.save() vol.create_lv() vol.setup_export() -- cgit From c168754e1a822c98c9574946986113d4f827e9d7 Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: Set volume status properly, first pass at validation decorators. --- nova/endpoint/cloud.py | 2 +- nova/validate.py | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ nova/volume/storage.py | 1 + run_tests.py | 1 + 4 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 nova/validate.py diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 2e5a18afd..570cdee45 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -73,7 +73,7 @@ class CloudController(object): def volumes(self): """ returns a list of all volumes """ for volume_id in datastore.Redis.instance().smembers("storage-volumes"): - volume = storage.Volume(volume_id=volume_id) + volume = storage.get_volume(volume_id) yield volume def __str__(self): diff --git a/nova/validate.py b/nova/validate.py new file mode 100644 index 000000000..d1358d402 --- /dev/null +++ b/nova/validate.py @@ -0,0 +1,83 @@ +# 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 +# +# 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. + +""" + Decorators for argument validation, courtesy of + http://rmi.net/~lutz/rangetest.html +""" + +def rangetest(**argchecks): # validate ranges for both+defaults + def onDecorator(func): # onCall remembers func and argchecks + import sys + code = func.__code__ if sys.version_info[0] == 3 else func.func_code + allargs = code.co_varnames[:code.co_argcount] + funcname = func.__name__ + + def onCall(*pargs, **kargs): + # all pargs match first N args by position + # the rest must be in kargs or omitted defaults + positionals = list(allargs) + positionals = positionals[:len(pargs)] + + for (argname, (low, high)) in argchecks.items(): + # for all args to be checked + if argname in kargs: + # was passed by name + if kargs[argname] < low or kargs[argname] > high: + errmsg = '{0} argument "{1}" not in {2}..{3}' + errmsg = errmsg.format(funcname, argname, low, high) + raise TypeError(errmsg) + + elif argname in positionals: + # was passed by position + position = positionals.index(argname) + if pargs[position] < low or pargs[position] > high: + errmsg = '{0} argument "{1}" not in {2}..{3}' + errmsg = errmsg.format(funcname, argname, low, high) + raise TypeError(errmsg) + else: + pass + + return func(*pargs, **kargs) # okay: run original call + return onCall + return onDecorator + +def typetest(**argchecks): + def onDecorator(func): + import sys + code = func.__code__ if sys.version_info[0] == 3 else func.func_code + allargs = code.co_varnames[:code.co_argcount] + funcname = func.__name__ + + def onCall(*pargs, **kargs): + positionals = list(allargs)[:len(pargs)] + for (argname, type) in argchecks.items(): + if argname in kargs: + if not isinstance(kargs[argname], type): + errmsg = '{0} argument "{1}" not of type {2}' + errmsg = errmsg.format(funcname, argname, type) + raise TypeError(errmsg) + elif argname in positionals: + position = positionals.index(argname) + if not isinstance(pargs[position], type): + errmsg = '{0} argument "{1}" not of type {2}' + errmsg = errmsg.format(funcname, argname, type) + raise TypeError(errmsg) + else: + pass + return func(*pargs, **kargs) + return onCall + return onDecorator + diff --git a/nova/volume/storage.py b/nova/volume/storage.py index 1cf6b0343..2eb9e7969 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -175,6 +175,7 @@ class Volume(datastore.RedisModel): vol.setup_export() # TODO(joshua) - We need to trigger a fanout message for aoe-discover on all the nodes # TODO(joshua + vol['status'] = "available" vol.save() return vol diff --git a/run_tests.py b/run_tests.py index 847911032..957e5d208 100644 --- a/run_tests.py +++ b/run_tests.py @@ -55,6 +55,7 @@ from nova.tests.process_unittest import * from nova.tests.storage_unittest import * from nova.tests.users_unittest import * from nova.tests.datastore_unittest import * +from nova.tests.validator_unittest import * FLAGS = flags.FLAGS -- cgit From 6ebd60377382a23d37eea9e65df38f0f581252fa Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: Removing keeper sludge. --- nova/volume/storage.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/nova/volume/storage.py b/nova/volume/storage.py index 2eb9e7969..993e01bb7 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -63,7 +63,7 @@ def get_volume(volume_id): volume_class = Volume if FLAGS.fake_storage: volume_class = FakeVolume - if datastore.Keeper('storage-').set_is_member('volumes', volume_id): + if datastore.Redis.instance().sismember('volumes', volume_id): return volume_class(volume_id=volume_id) raise exception.Error("Volume does not exist") @@ -79,7 +79,6 @@ class BlockStore(object): if FLAGS.fake_storage: self.volume_class = FakeVolume self._init_volume_group() - self.keeper = datastore.Keeper('storage-') def report_state(self): #TODO: aggregate the state of the system @@ -93,20 +92,20 @@ class BlockStore(object): """ logging.debug("Creating volume of size: %s" % (size)) vol = self.volume_class.create(size, user_id) - self.keeper.set_add('volumes', vol['volume_id']) - self.keeper.set_add('volumes:%s' % (FLAGS.storage_name), vol['volume_id']) + datastore.Redis.instance().sadd('volumes', vol['volume_id']) + datastore.Redis.instance().sadd('volumes:%s' % (FLAGS.storage_name), vol['volume_id']) self._restart_exports() return vol['volume_id'] def by_node(self, node_id): """ returns a list of volumes for a node """ - for volume_id in self.keeper.set_members('volumes:%s' % (node_id)): + for volume_id in datastore.Redis.instance().smembers('volumes:%s' % (node_id)): yield self.volume_class(volume_id=volume_id) @property def all(self): """ returns a list of all volumes """ - for volume_id in self.keeper.set_members('volumes'): + for volume_id in datastore.Redis.instance().smembers('volumes'): yield self.volume_class(volume_id=volume_id) def delete_volume(self, volume_id): @@ -117,8 +116,8 @@ class BlockStore(object): if vol['node_name'] != FLAGS.storage_name: raise exception.Error("Volume is not local to this node") vol.destroy() - self.keeper.set_remove('volumes', vol['volume_id']) - self.keeper.set_remove('volumes:%s' % (FLAGS.storage_name), vol['volume_id']) + datastore.Redis.instance().srem('volumes', vol['volume_id']) + datastore.Redis.instance().srem('volumes:%s' % (FLAGS.storage_name), vol['volume_id']) return True def _restart_exports(self): -- cgit From 108f97f5d7854cfed2c006112a91873ac4f2ed1a Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: First pass at validation unit tests. Haven't figured out class methods yet. --- nova/tests/validator_unittest.py | 41 ++++++++++++++++++++++++++++++++++++++++ nova/validate.py | 14 +++++++------- 2 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 nova/tests/validator_unittest.py diff --git a/nova/tests/validator_unittest.py b/nova/tests/validator_unittest.py new file mode 100644 index 000000000..e605f86cb --- /dev/null +++ b/nova/tests/validator_unittest.py @@ -0,0 +1,41 @@ +# 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 +# +# 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. + +import logging +import unittest + +from nova import vendor + +from nova import flags +from nova import test +from nova import validate + + +class ValidationTestCase(test.TrialTestCase): + def setUp(self): + super(ValidationTestCase, self).setUp() + + def tearDown(self): + super(ValidationTestCase, self).tearDown() + + def test_type_validation(self): + self.assertTrue(type_case("foo", 5, 1)) + self.assertRaises(TypeError, type_case, "bar", "5", 1) + self.assertRaises(TypeError, type_case, None, 5, 1) + +@validate.typetest(instanceid=str, size=int, number_of_instances=int) +def type_case(instanceid, size, number_of_instances): + print ("type_case was successfully executed") + return True \ No newline at end of file diff --git a/nova/validate.py b/nova/validate.py index d1358d402..e96a47059 100644 --- a/nova/validate.py +++ b/nova/validate.py @@ -63,17 +63,17 @@ def typetest(**argchecks): def onCall(*pargs, **kargs): positionals = list(allargs)[:len(pargs)] - for (argname, type) in argchecks.items(): - if argname in kargs: - if not isinstance(kargs[argname], type): + for (argname, typeof) in argchecks.items(): + if argname in kargs: + if not isinstance(kargs[argname], typeof): errmsg = '{0} argument "{1}" not of type {2}' - errmsg = errmsg.format(funcname, argname, type) + errmsg = errmsg.format(funcname, argname, typeof) raise TypeError(errmsg) elif argname in positionals: position = positionals.index(argname) - if not isinstance(pargs[position], type): - errmsg = '{0} argument "{1}" not of type {2}' - errmsg = errmsg.format(funcname, argname, type) + if not isinstance(pargs[position], typeof): + errmsg = '{0} argument "{1}" with value of {2} not of type {3}' + errmsg = errmsg.format(funcname, argname, pargs[position], typeof) raise TypeError(errmsg) else: pass -- cgit From a17abe20d34336d0642bbf2b49cb37f6b9d0a197 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: finished gutting keeper from volume --- 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 570cdee45..c10a7130a 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -72,7 +72,7 @@ class CloudController(object): @property def volumes(self): """ returns a list of all volumes """ - for volume_id in datastore.Redis.instance().smembers("storage-volumes"): + for volume_id in datastore.Redis.instance().smembers("volumes"): volume = storage.get_volume(volume_id) yield volume -- cgit From 0912a1c2d55e031287ca5dd5c8df0597667ad12d Mon Sep 17 00:00:00 2001 From: Joshua McKenty Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: Adding basic validation of volume size on creation, plus tests for it. --- nova/tests/storage_unittest.py | 7 +++++++ nova/validate.py | 8 ++++---- nova/volume/storage.py | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/nova/tests/storage_unittest.py b/nova/tests/storage_unittest.py index 84f3126c0..4f2a60b25 100644 --- a/nova/tests/storage_unittest.py +++ b/nova/tests/storage_unittest.py @@ -59,6 +59,13 @@ class StorageTestCase(test.TrialTestCase): self.assertRaises(exception.Error, storage.get_volume, volume_id) + + def test_too_big_volume(self): + vol_size = '1001' + user_id = 'fake' + self.assertRaises(TypeError, + self.mystorage.create_volume, + vol_size, user_id) def test_run_attach_detach_volume(self): # Create one volume and one node to test with diff --git a/nova/validate.py b/nova/validate.py index e96a47059..adf2d147c 100644 --- a/nova/validate.py +++ b/nova/validate.py @@ -35,7 +35,7 @@ def rangetest(**argchecks): # validate ranges for both+defaults # for all args to be checked if argname in kargs: # was passed by name - if kargs[argname] < low or kargs[argname] > high: + if float(kargs[argname]) < low or float(kargs[argname]) > high: errmsg = '{0} argument "{1}" not in {2}..{3}' errmsg = errmsg.format(funcname, argname, low, high) raise TypeError(errmsg) @@ -43,9 +43,9 @@ def rangetest(**argchecks): # validate ranges for both+defaults elif argname in positionals: # was passed by position position = positionals.index(argname) - if pargs[position] < low or pargs[position] > high: - errmsg = '{0} argument "{1}" not in {2}..{3}' - errmsg = errmsg.format(funcname, argname, low, high) + if float(pargs[position]) < low or float(pargs[position]) > high: + errmsg = '{0} argument "{1}" with value of {4} not in {2}..{3}' + errmsg = errmsg.format(funcname, argname, low, high, pargs[position]) raise TypeError(errmsg) else: pass diff --git a/nova/volume/storage.py b/nova/volume/storage.py index 993e01bb7..5ebd8b941 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -35,6 +35,7 @@ from nova import exception from nova import flags from nova import rpc from nova import utils +from nova import validate FLAGS = flags.FLAGS @@ -84,6 +85,7 @@ class BlockStore(object): #TODO: aggregate the state of the system pass + @validate.rangetest(size=(0, 100)) def create_volume(self, size, user_id): """ Creates an exported volume (fake or real), -- cgit From f02df04fb0de76f9051c184ce98e81ed1a7e3f6c Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: fix bridge name Conflicts: nova/endpoint/cloud.py --- nova/endpoint/cloud.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index c10a7130a..975309c56 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -478,7 +478,9 @@ class CloudController(object): raise exception.ApiError('Key Pair %s not found' % kwargs['key_name']) 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'] for num in range(int(kwargs['max_count'])): inst = self.instdir.new() # TODO(ja): add ari, aki @@ -496,7 +498,7 @@ class CloudController(object): address = network.allocate_ip( inst['user_id'], inst['project_id'], mac=inst['mac_address']) inst['private_dns_name'] = str(address) - inst['bridge_name'] = network.BridgedNetwork.get_network_for_project(inst['user_id'], inst['project_id'], 'default')['bridge_name'] + inst['bridge_name'] = bridge_name # TODO: allocate expresses on the router node inst.save() rpc.cast(FLAGS.compute_topic, -- cgit From f2a507ad6d0d99e046ffa7dbca624b2699141c57 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: Use instdir to iterate through instances --- 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 975309c56..1df4a3ba6 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -304,7 +304,7 @@ class CloudController(object): return image def _get_instance(self, context, instance_id): - for instance in self.instances: + for instance in self.instdir.all: if instance['instance_id'] == instance_id: if context.user.is_admin() or instance['project_id'] == context.project.id: return instance -- cgit From 011a27455441f2fb5260aa8821b52b553ea40ba4 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: whitespace fixes and format instances set of object fixes --- nova/compute/node.py | 10 +++++----- nova/endpoint/cloud.py | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/nova/compute/node.py b/nova/compute/node.py index bb6e27e22..e2263f671 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -263,7 +263,7 @@ class Instance(object): data['user_id'] = data['owner_id'] data['project_id'] = data['owner_id'] self.datamodel = data - + size = data.get('instance_type', FLAGS.default_instance_type) if size not in INSTANCE_TYPES: raise exception.Error('invalid instance type: %s' % size) @@ -284,12 +284,12 @@ class Instance(object): #self.datamodel.setdefault('key_data', None) #self.datamodel.setdefault('key_name', None) #self.datamodel.setdefault('addressing_type', None) - + # TODO(joshua) - The ugly non-flat ones self.datamodel['groups'] = data.get('security_group', 'default') # TODO(joshua): Support product codes somehow self.datamodel.setdefault('product_codes', None) - + self.datamodel.save() logging.debug("Finished init of Instance with id of %s" % name) @@ -395,7 +395,7 @@ class Instance(object): timer.f = _wait_for_shutdown timer.start(interval=0.5, now=True) return d - + def _cleanup(self): target = os.path.abspath(self.datamodel['basepath']) logging.info("Deleting instance files at %s", target) @@ -413,7 +413,7 @@ class Instance(object): self.set_state(Instance.NOSTATE, 'rebooting') yield self._conn.lookupByName(self.name).destroy() self._conn.createXML(self.toXml(), 0) - + d = defer.Deferred() timer = task.LoopingCall(f=None) def _wait_for_reboot(): diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 1df4a3ba6..e3d3fdada 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -367,6 +367,8 @@ class CloudController(object): def _convert_to_set(self, lst, str): if lst == None or lst == []: return None + if not isinstance(lst, list): + lst = [lst] return [{str: x} for x in lst] @rbac.allow('all') -- cgit From ab7c9651539dd88f7e545641bdc5a16f69d5dfb0 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: add back accidentally removed bridge name. str is reserved, so don't use it as a variable name --- nova/endpoint/cloud.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index e3d3fdada..2f30d2992 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -364,12 +364,12 @@ class CloudController(object): 'status' : volume['attachStatus'], 'volumeId' : volume_id}) - def _convert_to_set(self, lst, str): + def _convert_to_set(self, lst, label): if lst == None or lst == []: return None if not isinstance(lst, list): lst = [lst] - return [{str: x} for x in lst] + return [{label: x} for x in lst] @rbac.allow('all') def describe_instances(self, context, **kwargs): @@ -497,10 +497,10 @@ class CloudController(object): inst['project_id'] = context.project.id inst['mac_address'] = utils.generate_mac() inst['ami_launch_index'] = num + inst['bridge_name'] = bridge_name address = network.allocate_ip( inst['user_id'], inst['project_id'], mac=inst['mac_address']) inst['private_dns_name'] = str(address) - inst['bridge_name'] = bridge_name # TODO: allocate expresses on the router node inst.save() rpc.cast(FLAGS.compute_topic, -- cgit From d658b59128c8b9a6671cc3cb157249d5a9d2c9eb Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: add project ids to volumes --- nova/endpoint/cloud.py | 3 ++- nova/tests/storage_unittest.py | 34 ++++++++++++++-------------------- nova/volume/storage.py | 19 ++++++++++--------- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 2f30d2992..93efa1361 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -279,7 +279,8 @@ class CloudController(object): # TODO(vish): refactor this to create the volume object here and tell storage to create it res = rpc.call(FLAGS.storage_topic, {"method": "create_volume", "args" : {"size": size, - "user_id": context.user.id}}) + "user_id": context.user.id, + "project_id": context.project.id}}) def _format_result(result): volume = self._get_volume(context, result['result']) return {'volumeSet': [self.format_volume(context, volume)]} diff --git a/nova/tests/storage_unittest.py b/nova/tests/storage_unittest.py index 4f2a60b25..d2daccf6f 100644 --- a/nova/tests/storage_unittest.py +++ b/nova/tests/storage_unittest.py @@ -1,12 +1,12 @@ # 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 -# +# # 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. @@ -14,15 +14,6 @@ # limitations under the License. import logging -import StringIO -import time -import unittest -from xml.etree import ElementTree - -from nova import vendor -import mox -from tornado import ioloop -from twisted.internet import defer from nova import exception from nova import flags @@ -50,7 +41,8 @@ class StorageTestCase(test.TrialTestCase): def test_run_create_volume(self): vol_size = '0' user_id = 'fake' - volume_id = self.mystorage.create_volume(vol_size, user_id) + project_id = 'fake' + volume_id = self.mystorage.create_volume(vol_size, user_id, project_id) # TODO(termie): get_volume returns differently than create_volume self.assertEqual(volume_id, storage.get_volume(volume_id)['volume_id']) @@ -59,22 +51,24 @@ class StorageTestCase(test.TrialTestCase): self.assertRaises(exception.Error, storage.get_volume, volume_id) - + def test_too_big_volume(self): vol_size = '1001' user_id = 'fake' + project_id = 'fake' self.assertRaises(TypeError, self.mystorage.create_volume, - vol_size, user_id) + vol_size, user_id, project_id) def test_run_attach_detach_volume(self): # Create one volume and one node to test with instance_id = "storage-test" vol_size = "5" user_id = "fake" + project_id = 'fake' mountpoint = "/dev/sdf" - volume_id = self.mystorage.create_volume(vol_size, user_id) - + volume_id = self.mystorage.create_volume(vol_size, user_id, project_id) + volume_obj = storage.get_volume(volume_id) volume_obj.start_attach(instance_id, mountpoint) rv = yield self.mynode.attach_volume(volume_id, @@ -84,7 +78,7 @@ class StorageTestCase(test.TrialTestCase): self.assertEqual(volume_obj['attachStatus'], "attached") self.assertEqual(volume_obj['instance_id'], instance_id) self.assertEqual(volume_obj['mountpoint'], mountpoint) - + self.assertRaises(exception.Error, self.mystorage.delete_volume, volume_id) @@ -92,12 +86,12 @@ class StorageTestCase(test.TrialTestCase): rv = yield self.mystorage.detach_volume(volume_id) volume_obj = storage.get_volume(volume_id) self.assertEqual(volume_obj['status'], "available") - + rv = self.mystorage.delete_volume(volume_id) self.assertRaises(exception.Error, storage.get_volume, volume_id) - + def test_multi_node(self): # TODO(termie): Figure out how to test with two nodes, # each of them having a different FLAG for storage_node diff --git a/nova/volume/storage.py b/nova/volume/storage.py index 5ebd8b941..7da5afe20 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -71,7 +71,7 @@ def get_volume(volume_id): class BlockStore(object): """ There is one BlockStore running on each volume node. - However, each BlockStore can report on the state of + However, each BlockStore can report on the state of *all* volumes in the cluster. """ def __init__(self): @@ -86,14 +86,14 @@ class BlockStore(object): pass @validate.rangetest(size=(0, 100)) - def create_volume(self, size, user_id): + def create_volume(self, size, user_id, project_id): """ Creates an exported volume (fake or real), restarts exports to make it available. Volume at this point has size, owner, and zone. """ logging.debug("Creating volume of size: %s" % (size)) - vol = self.volume_class.create(size, user_id) + vol = self.volume_class.create(size, user_id, project_id) datastore.Redis.instance().sadd('volumes', vol['volume_id']) datastore.Redis.instance().sadd('volumes:%s' % (FLAGS.storage_name), vol['volume_id']) self._restart_exports() @@ -155,7 +155,7 @@ class Volume(datastore.RedisModel): super(Volume, self).__init__(object_id=volume_id) @classmethod - def create(cls, size, user_id): + def create(cls, size, user_id, project_id): volume_id = utils.generate_uid('vol') vol = cls(volume_id=volume_id) #TODO(vish): do we really need to store the volume id as .object_id .volume_id and ['volume_id']? @@ -163,6 +163,7 @@ class Volume(datastore.RedisModel): vol['node_name'] = FLAGS.storage_name vol['size'] = size vol['user_id'] = user_id + vol['project_id'] = project_id vol['availability_zone'] = FLAGS.storage_availability_zone vol["instance_id"] = 'none' vol["mountpoint"] = 'none' @@ -185,26 +186,26 @@ class Volume(datastore.RedisModel): self['instance_id'] = instance_id self['mountpoint'] = mountpoint self['status'] = "in-use" - self['attachStatus'] = "attaching" + self['attachStatus'] = "attaching" self['attachTime'] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) self['deleteOnTermination'] = 'False' self.save() - + def finish_attach(self): """ """ - self['attachStatus'] = "attached" + self['attachStatus'] = "attached" self.save() def start_detach(self): """ """ - self['attachStatus'] = "detaching" + self['attachStatus'] = "detaching" self.save() def finish_detach(self): self['instance_id'] = None self['mountpoint'] = None self['status'] = "available" - self['attachStatus'] = "detached" + self['attachStatus'] = "detached" self.save() def destroy(self): -- cgit From 1bdd2b01de885a8f4d3a62cd1008f067f93c39ee Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:56 +0100 Subject: fix status code printing in cloud --- nova/endpoint/cloud.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 93efa1361..ba90cc6b3 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -228,8 +228,6 @@ class CloudController(object): def get_console_output(self, context, instance_id, **kwargs): # instance_id is passed in as a list of instances instance = self._get_instance(context, instance_id[0]) - if instance['state'] == 'pending': - raise exception.ApiError('Cannot get output for pending instance') return rpc.call('%s.%s' % (FLAGS.compute_topic, instance['node_name']), {"method": "get_console_output", "args" : {"instance_id": instance_id[0]}}) @@ -386,8 +384,8 @@ class CloudController(object): i['instance_id'] = instance.get('instance_id', None) i['image_id'] = instance.get('image_id', None) i['instance_state'] = { - 'code': 42, - 'name': instance.get('state', 'pending') + 'code': instance.get('state', 0), + 'name': instance.get('state_description', 'pending') } i['public_dns_name'] = self.network.get_public_ip_for_instance( i['instance_id']) @@ -547,8 +545,6 @@ class CloudController(object): """instance_id is a list of instance ids""" for i in instance_id: instance = self._get_instance(context, i) - if instance['state'] == 'pending': - raise exception.ApiError('Cannot reboot pending instance') rpc.cast('%s.%s' % (FLAGS.node_topic, instance['node_name']), {"method": "reboot_instance", "args" : {"instance_id": i}}) -- cgit From 38e92818f378ba8a8d9a09791e139d2fdae10ef4 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: fix detach volume --- nova/endpoint/cloud.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index ba90cc6b3..b947f0833 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -340,22 +340,21 @@ class CloudController(object): def detach_volume(self, context, volume_id, **kwargs): volume = self._get_volume(context, volume_id) instance_id = volume.get('instance_id', None) + if not instance_id: + raise exception.Error("Volume isn't attached to anything!") if volume['status'] == "available": raise exception.Error("Volume is already detached") - volume.start_detach() - if instance_id: - try: - instance = self._get_instance(context, instance_id) - rpc.cast('%s.%s' % (FLAGS.compute_topic, instance['node_name']), + try: + volume.start_detach() + instance = self._get_instance(context, instance_id) + rpc.cast('%s.%s' % (FLAGS.compute_topic, instance['node_name']), {"method": "detach_volume", "args" : {"instance_id": instance_id, - "mountpoint": volume['mountpoint']}}) - except exception.NotFound: - # If the instance doesn't exist anymore, - # then we need to call detach blind - volume.finish_detach() - else: - raise exception.Error("Volume isn't attached to anything!") + "volume_id": volume_id}}) + except exception.NotFound: + # If the instance doesn't exist anymore, + # then we need to call detach blind + volume.finish_detach() return defer.succeed({'attachTime' : volume['attachTime'], 'device' : volume['mountpoint'], 'instanceId' : instance_id, -- cgit From 3007901ba821839b94bb163ef7889f4a87fdba93 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: Fix for mpi cpu reporting --- nova/endpoint/cloud.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index b947f0833..434fc5a5f 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -37,6 +37,7 @@ from nova.auth import rbac from nova.auth import users from nova.compute import model from nova.compute import network +from nova.compute import node from nova.endpoint import images from nova.volume import storage @@ -100,7 +101,7 @@ class CloudController(object): result = {} for instance in self.instdir.all: if instance['project_id'] == project_id: - line = '%s slots=%d' % (instance['private_dns_name'], instance.get('vcpus', 0)) + line = '%s slots=%d' % (instance['private_dns_name'], node.INSTANCE_TYPES[instance['instance_type']]['vcpus']) if instance['key_name'] in result: result[instance['key_name']].append(line) else: -- cgit From f7464875752b60b1c1713d7034478bc5e6b83aac Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: Release 0.2.2 --- debian/changelog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index ee326f3a8..204046392 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +nova (0.2.2-1) UNRELEASED; urgency=low + + * First release based on nova/cc + * Major rewrites to volumes and instances + * Addition of cloudpipe and rbac + * Major bugfixes + + -- Vishvananda Ishaya Wed, 02 Jun 2010 17:42:00 -0700 + nova (0.2.1-1) UNRELEASED; urgency=low * Support ephemeral (local) space for instances -- cgit From bb2af5d05e1d5aae3ac643ea110cf51c9702b37c Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: fix default state to be 0 instead of pending --- nova/compute/model.py | 7 ++++--- nova/datastore.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/nova/compute/model.py b/nova/compute/model.py index 14f2461da..6477ac571 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -115,7 +115,8 @@ class Instance(object): if self.state: self.initial_state = self.state else: - self.state = {'state': 'pending', + self.state = {'state': 0, + 'state_description': 'pending', 'instance_id': instance_id, 'node_name': 'unassigned', 'project_id': 'unassigned', @@ -138,13 +139,13 @@ class Instance(object): for item in self.keys(): copyDict[item] = self[item] return copyDict - + def get(self, item, default): return self.state.get(item, default) def update(self, update_dict): return self.state.update(update_dict) - + def setdefault(self, item, default): return self.state.setdefault(item, default) diff --git a/nova/datastore.py b/nova/datastore.py index 61e507cd1..ce9a85ef4 100644 --- a/nova/datastore.py +++ b/nova/datastore.py @@ -76,19 +76,20 @@ class RedisModel(object): self.set_default_state() def set_default_state(self): - self.state = {'state' : 'pending', + self.state = {'state': 0, + 'state_description': 'pending', 'node_name': 'unassigned', 'project_id': 'unassigned', 'user_id': 'unassigned'} self.state[self.object_type+"_id"] = self.object_id self.state["create_time"] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) - + @property def project(self): if self.state.get('project_id', None): return self.state['project_id'] return self.state.get('owner_id', 'unassigned') - + @property def __redis_key(self): """ Magic string for keys """ -- cgit From 49acf8b49accca3f43249e11f3c665b1245f6572 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: Don't use keeper for instances --- nova/compute/model.py | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/nova/compute/model.py b/nova/compute/model.py index 6477ac571..74bf60a3b 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -48,14 +48,9 @@ from nova import utils FLAGS = flags.FLAGS -flags.DEFINE_string('instances_prefix', 'compute-', - 'prefix for keepers for instances') - # TODO(ja): singleton instance of the directory class InstanceDirectory(object): """an api for interacting with the global state of instances """ - def __init__(self): - self.keeper = datastore.Keeper(FLAGS.instances_prefix) def get(self, instance_id): """ returns an instance object for a given id """ @@ -66,7 +61,7 @@ class InstanceDirectory(object): def by_project(self, project): """ returns a list of instance objects for a project """ - for instance_id in self.keeper.smembers('project:%s:instances' % project): + for instance_id in datastore.Redis.instance().smembers('project:%s:instances' % project): yield Instance(instance_id) def by_node(self, node_id): @@ -88,12 +83,12 @@ class InstanceDirectory(object): pass def exists(self, instance_id): - return self.keeper.set_is_member('instances', instance_id) + return datastore.Redis.instance().sismember('instances', instance_id) @property def all(self): """ returns a list of all instances """ - for instance_id in self.keeper.set_members('instances'): + for instance_id in datastore.Redis.instance().smembers('instances'): yield Instance(instance_id) def new(self): @@ -108,10 +103,9 @@ class Instance(object): def __init__(self, instance_id): """ loads an instance from the datastore if exists """ - self.keeper = datastore.Keeper(FLAGS.instances_prefix) self.instance_id = instance_id self.initial_state = {} - self.state = self.keeper[self.__redis_key] + self.state = datastore.Redis.instance().hgetall(self.__redis_key) if self.state: self.initial_state = self.state else: @@ -167,18 +161,14 @@ class Instance(object): """ # TODO(ja): implement hmset in redis-py and use it # instead of multiple calls to hset - state = self.keeper[self.__redis_key] - if not state: - state = {} for key, val in self.state.iteritems(): # if (not self.initial_state.has_key(key) # or self.initial_state[key] != val): - state[key] = val - self.keeper[self.__redis_key] = state + datastore.Redis.instance().hset(self.__redis_key, key, val) if self.initial_state == {}: - self.keeper.set_add('project:%s:instances' % self.project, + datastore.Redis.instance().sadd('project:%s:instances' % self.project, self.instance_id) - self.keeper.set_add('instances', self.instance_id) + datastore.Redis.instance().sadd('instances', self.instance_id) self.initial_state = self.state return True @@ -193,10 +183,9 @@ class Instance(object): does NOT do anything to running libvirt state. """ logging.info("Destroying datamodel for instance %s", self.instance_id) - self.keeper.set_remove('project:%s:instances' % self.project, + datastore.Redis.instance().srem('project:%s:instances' % self.project, self.instance_id) - del self.keeper[self.__redis_key] - self.keeper.set_remove('instances', self.instance_id) + datastore.Redis.instance().srem('instances', self.instance_id) return True @property -- cgit From 090186c12f3b6985fea6e01e23c3366bf130e5ea Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: fix sectors off by one --- nova/compute/disk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/compute/disk.py b/nova/compute/disk.py index f6a716e65..acaac89af 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -56,9 +56,9 @@ def partition(infile, outfile, local_bytes=0, local_type='ext2', execute=None): mbr_last = 62 # a primary_first = mbr_last + 1 # b - primary_last = primary_first + primary_sectors # c + primary_last = primary_first + primary_sectors - 1 # c local_first = primary_last + 1 # d - local_last = local_first + local_sectors # e + local_last = local_first + local_sectors - 1 # e last_sector = local_last # e # create an empty file -- cgit From 9d5f9e12e2bb9e87804459e943a4e3484d5c1f1a Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: fix case for volume attributes --- nova/endpoint/cloud.py | 12 ++++++------ nova/volume/storage.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 434fc5a5f..5c30d6002 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -263,8 +263,8 @@ class CloudController(object): volume.get('instance_id', ''), volume.get('mountpoint', '')) if volume['status'] == 'attached': - v['attachmentSet'] = [{'attachTime': volume['attachTime'], - 'deleteOnTermination': volume['deleteOnTermination'], + v['attachmentSet'] = [{'attachTime': volume['attach_time'], + 'deleteOnTermination': volume['delete_on_termination'], 'device' : volume['mountpoint'], 'instanceId' : volume['instance_id'], 'status' : 'attached', @@ -329,11 +329,11 @@ class CloudController(object): "args" : {"volume_id": volume_id, "instance_id" : instance_id, "mountpoint" : device}}) - return defer.succeed({'attachTime' : volume['attachTime'], + return defer.succeed({'attachTime' : volume['attach_time'], 'device' : volume['mountpoint'], 'instanceId' : instance_id, 'requestId' : context.request_id, - 'status' : volume['attachStatus'], + 'status' : volume['attach_status'], 'volumeId' : volume_id}) @@ -356,11 +356,11 @@ class CloudController(object): # If the instance doesn't exist anymore, # then we need to call detach blind volume.finish_detach() - return defer.succeed({'attachTime' : volume['attachTime'], + return defer.succeed({'attachTime' : volume['attach_time'], 'device' : volume['mountpoint'], 'instanceId' : instance_id, 'requestId' : context.request_id, - 'status' : volume['attachStatus'], + 'status' : volume['attach_status'], 'volumeId' : volume_id}) def _convert_to_set(self, lst, label): diff --git a/nova/volume/storage.py b/nova/volume/storage.py index 7da5afe20..85ba85138 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -186,26 +186,26 @@ class Volume(datastore.RedisModel): self['instance_id'] = instance_id self['mountpoint'] = mountpoint self['status'] = "in-use" - self['attachStatus'] = "attaching" - self['attachTime'] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) - self['deleteOnTermination'] = 'False' + self['attach_status'] = "attaching" + self['attach_time'] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) + self['delete_on_termination'] = 'False' self.save() def finish_attach(self): """ """ - self['attachStatus'] = "attached" + self['attach_status'] = "attached" self.save() def start_detach(self): """ """ - self['attachStatus'] = "detaching" + self['attach_status'] = "detaching" self.save() def finish_detach(self): self['instance_id'] = None self['mountpoint'] = None self['status'] = "available" - self['attachStatus'] = "detached" + self['attach_status'] = "detached" self.save() def destroy(self): -- cgit From 9ebd49fa098c8e5fc21244b1bc6254b39d38752f Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: don't allow volumes to be attached to the same mountpoint --- nova/endpoint/cloud.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 5c30d6002..882ce5784 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -320,7 +320,11 @@ class CloudController(object): def attach_volume(self, context, volume_id, instance_id, device, **kwargs): volume = self._get_volume(context, volume_id) if volume['status'] == "attached": - raise exception.Error("Volume is already attached") + raise exception.ApiError("Volume is already attached") + # TODO(vish): looping through all volumes is slow. We should probably maintain an index + for vol in self.volumes: + if vol['instance_id'] == instance_id and vol['mountpoint'] == device: + raise exception.ApiError("Volume %s is already attachted to %s" % (vol.volume_id, vol['mountpoint'])) volume.start_attach(instance_id, device) instance = self._get_instance(context, instance_id) compute_node = instance['node_name'] -- cgit From 79549993f658c054a519d36d0b9a7c822802c69c Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: removed extraneous .volume_id --- nova/endpoint/cloud.py | 2 +- nova/volume/storage.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 882ce5784..2c848103d 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -324,7 +324,7 @@ class CloudController(object): # TODO(vish): looping through all volumes is slow. We should probably maintain an index for vol in self.volumes: if vol['instance_id'] == instance_id and vol['mountpoint'] == device: - raise exception.ApiError("Volume %s is already attachted to %s" % (vol.volume_id, vol['mountpoint'])) + raise exception.ApiError("Volume %s is already attached to %s" % (vol['volume_id'], vol['mountpoint'])) volume.start_attach(instance_id, device) instance = self._get_instance(context, instance_id) compute_node = instance['node_name'] diff --git a/nova/volume/storage.py b/nova/volume/storage.py index 85ba85138..c9d9d382a 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -151,14 +151,12 @@ class Volume(datastore.RedisModel): object_type = 'volume' def __init__(self, volume_id=None): - self.volume_id = volume_id super(Volume, self).__init__(object_id=volume_id) @classmethod def create(cls, size, user_id, project_id): volume_id = utils.generate_uid('vol') vol = cls(volume_id=volume_id) - #TODO(vish): do we really need to store the volume id as .object_id .volume_id and ['volume_id']? vol['volume_id'] = volume_id vol['node_name'] = FLAGS.storage_name vol['size'] = size @@ -224,7 +222,7 @@ class Volume(datastore.RedisModel): utils.runthis("Creating LV: %s", "sudo lvcreate -L %s -n %s %s" % (sizestr, self['volume_id'], FLAGS.volume_group)) def _delete_lv(self): - utils.runthis("Removing LV: %s", "sudo lvremove -f %s/%s" % (FLAGS.volume_group, self.volume_id)) + utils.runthis("Removing LV: %s", "sudo lvremove -f %s/%s" % (FLAGS.volume_group, self['volume_id'])) def setup_export(self): (shelf_id, blade_id) = get_next_aoe_numbers() @@ -234,7 +232,7 @@ class Volume(datastore.RedisModel): self.save() utils.runthis("Creating AOE export: %s", "sudo vblade-persist setup %s %s %s /dev/%s/%s" % - (shelf_id, blade_id, FLAGS.aoe_eth_dev, FLAGS.volume_group, self.volume_id)) + (shelf_id, blade_id, FLAGS.aoe_eth_dev, FLAGS.volume_group, self['volume_id'])) def _remove_export(self): utils.runthis("Stopped AOE export: %s", "sudo vblade-persist stop %s %s" % (self['shelf_id'], self['blade_id'])) -- cgit From e3b6e0537eadad7587d68aa144e35743bd8a6dcf Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: fix more casing errors and make attachment set print --- nova/endpoint/cloud.py | 2 +- nova/volume/storage.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 2c848103d..281d4d272 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -262,7 +262,7 @@ class CloudController(object): volume.get('node_name', None), volume.get('instance_id', ''), volume.get('mountpoint', '')) - if volume['status'] == 'attached': + if volume['attach_status'] == 'attached': v['attachmentSet'] = [{'attachTime': volume['attach_time'], 'deleteOnTermination': volume['delete_on_termination'], 'device' : volume['mountpoint'], diff --git a/nova/volume/storage.py b/nova/volume/storage.py index c9d9d382a..f52252f2d 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -165,11 +165,11 @@ class Volume(datastore.RedisModel): vol['availability_zone'] = FLAGS.storage_availability_zone vol["instance_id"] = 'none' vol["mountpoint"] = 'none' - vol['attachTime'] = 'none' + vol['attach_time'] = 'none' vol["create_time"] = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) vol['status'] = "creating" # creating | available | in-use - vol['attachStatus'] = "detached" # attaching | attached | detaching | detached - vol['deleteOnTermination'] = 'False' + vol['attach_status'] = "detached" # attaching | attached | detaching | detached + vol['delete_on_termination'] = 'False' vol.save() vol.create_lv() vol.setup_export() -- cgit From 5718e8fca3c4224b529a3403bc9842e156df77b1 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: Release 0.2.2-2 --- debian/changelog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index 204046392..e7bfe0371 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +nova (0.2.2-2) UNRELEASED; urgency=low + + * Bugfixes to volume code + * Instances no longer use keeper + * Sectors off by one fix + * State reported properly by instances + + -- Vishvananda Ishaya Wed, 03 Jun 2010 15:21:00 -0700 + nova (0.2.2-1) UNRELEASED; urgency=low * First release based on nova/cc -- cgit From 46337d36816634a45f2cb7611566bf551ca3bba7 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:57 +0100 Subject: Fix format addresses --- nova/endpoint/cloud.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 281d4d272..c176c4ade 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -288,10 +288,9 @@ class CloudController(object): def _get_address(self, context, public_ip): # FIXME(vish) this should move into network.py - for address in self.network.hosts: - if address['address'] == public_ip: - if context.user.is_admin() or address['project_id'] == context.project.id: - return address + address = self.network.get_host(public_ip) + if address and (context.user.is_admin() or address['project_id'] == context.project.id): + return address raise exception.NotFound("Address at ip %s not found" % public_ip) def _get_image(self, context, image_id): @@ -427,7 +426,7 @@ class CloudController(object): def format_addresses(self, context): addresses = [] # TODO(vish): move authorization checking into network.py - for address in self.network.hosts: + for address in self.network.host_objs: #logging.debug(address_record) address_rv = { 'public_ip': address['address'], -- cgit From 24a68b54d9956c5a8d65d8057aaa8fd58f670a52 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: Give vpns the proper ip address --- nova/endpoint/cloud.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index c176c4ade..4a115fe35 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -500,7 +500,11 @@ class CloudController(object): inst['mac_address'] = utils.generate_mac() inst['ami_launch_index'] = num inst['bridge_name'] = bridge_name - address = network.allocate_ip( + 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 -- cgit From fb36a6ffa6d9835ca5c85c46d7729c755d1627e8 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: add missing import to pipelib --- nova/cloudpipe/pipelib.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index 47a2602a6..df7af7e15 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -24,6 +24,7 @@ import tempfile import base64 from zipfile import ZipFile, ZIP_DEFLATED +from nova import exception from nova import flags from nova.auth import users from nova import utils -- cgit From 3eaab92123f4da98c3b0330653c190604281bc68 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: sensible defaults for instance types --- nova/cloudpipe/pipelib.py | 1 + nova/endpoint/cloud.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index df7af7e15..adbea6878 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -63,6 +63,7 @@ class CloudPipe(object): user_data=zippy.read().encode("base64").encode("base64"), max_count=1, min_count=1, + instance_type='m1.tiny', image_id=FLAGS.vpn_image_id, key_name=key_name, security_groups=["vpn-secgroup"]) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 4a115fe35..8a3604f67 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -490,7 +490,7 @@ class CloudController(object): # TODO(ja): add ari, aki inst['image_id'] = kwargs['image_id'] inst['user_data'] = kwargs.get('user_data', '') - inst['instance_type'] = kwargs.get('instance_type', '') + inst['instance_type'] = kwargs.get('instance_type', 'm1.small') inst['reservation_id'] = reservation_id inst['launch_time'] = launch_time inst['key_data'] = key_data or '' -- cgit From 4fb44e9d9e33953e383e4116f6d0a5c1906a08c0 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: try to ping vpn instances --- bin/nova-manage | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index b1e984096..1b77ede46 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -47,8 +47,15 @@ class VpnCommands(object): vpn = self.__vpn_for(project.id) if vpn: + out, err = utils.execute("ping -c1 -w1 %s > /dev/null; echo $?", vpn['private_dns_name']) + if out.strip() == '0': + net = 'up' + else: + net = 'down' print vpn['instance_id'], - print vpn['state'] + print vpn['state_description'], + print net + else: print None @@ -56,7 +63,7 @@ class VpnCommands(object): for instance in self.instdir.all: if (instance.state.has_key('image_id') and instance['image_id'] == FLAGS.vpn_image_id - and not instance['state'] in ['shutting_down', 'shutdown'] + and not instance['state_description'] in ['shutting_down', 'shutdown'] and instance['project_id'] == project_id): return instance -- cgit From 97c372a3fe288729fe6cd3692c8899ba5a831c8a Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: typo in my ping call --- bin/nova-manage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/nova-manage b/bin/nova-manage index 1b77ede46..8d3e9cd4e 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -47,7 +47,7 @@ class VpnCommands(object): vpn = self.__vpn_for(project.id) if vpn: - out, err = utils.execute("ping -c1 -w1 %s > /dev/null; echo $?", vpn['private_dns_name']) + out, err = utils.execute("ping -c1 -w1 %s > /dev/null; echo $?" % vpn['private_dns_name']) if out.strip() == '0': net = 'up' else: -- cgit From 8475e0b590da9f2ef602005d2e8a51b2286c5052 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: hide vpn instances unless you are an admin and allow run_instances to launch vpn image even if it is private --- nova/endpoint/cloud.py | 78 ++++++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 8a3604f67..0910e41d1 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -381,40 +381,45 @@ class CloudController(object): reservations = {} for instance in self.instdir.all: res_id = instance.get('reservation_id', 'Unknown') - if ((context.user.is_admin() or context.project.id == instance['project_id']) - and (reservation_id == None or reservation_id == res_id)): - i = {} - i['instance_id'] = instance.get('instance_id', None) - i['image_id'] = instance.get('image_id', None) - i['instance_state'] = { - 'code': instance.get('state', 0), - 'name': instance.get('state_description', 'pending') - } - i['public_dns_name'] = self.network.get_public_ip_for_instance( - i['instance_id']) - i['private_dns_name'] = instance.get('private_dns_name', None) - if not i['public_dns_name']: - i['public_dns_name'] = i['private_dns_name'] - i['dns_name'] = instance.get('dns_name', None) - i['key_name'] = instance.get('key_name', None) - if context.user.is_admin(): - i['key_name'] = '%s (%s, %s)' % (i['key_name'], - instance.get('owner_id', None), instance.get('node_name','')) - i['product_codes_set'] = self._convert_to_set( - instance.get('product_codes', None), 'product_code') - i['instance_type'] = instance.get('instance_type', None) - i['launch_time'] = instance.get('launch_time', None) - i['ami_launch_index'] = instance.get('ami_launch_index', - None) - if not reservations.has_key(res_id): - r = {} - r['reservation_id'] = res_id - r['owner_id'] = instance.get('project_id', None) - r['group_set'] = self._convert_to_set( - instance.get('groups', None), 'group_id') - r['instances_set'] = [] - reservations[res_id] = r - reservations[res_id]['instances_set'].append(i) + 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) + i['instance_state'] = { + 'code': instance.get('state', 0), + 'name': instance.get('state_description', 'pending') + } + i['public_dns_name'] = self.network.get_public_ip_for_instance( + i['instance_id']) + i['private_dns_name'] = instance.get('private_dns_name', None) + if not i['public_dns_name']: + i['public_dns_name'] = i['private_dns_name'] + i['dns_name'] = instance.get('dns_name', None) + i['key_name'] = instance.get('key_name', None) + if context.user.is_admin(): + i['key_name'] = '%s (%s, %s)' % (i['key_name'], + instance.get('owner_id', None), instance.get('node_name','')) + i['product_codes_set'] = self._convert_to_set( + instance.get('product_codes', None), 'product_code') + i['instance_type'] = instance.get('instance_type', None) + i['launch_time'] = instance.get('launch_time', None) + i['ami_launch_index'] = instance.get('ami_launch_index', + None) + if not reservations.has_key(res_id): + r = {} + r['reservation_id'] = res_id + r['owner_id'] = instance.get('project_id', None) + r['group_set'] = self._convert_to_set( + instance.get('groups', None), 'group_id') + r['instances_set'] = [] + reservations[res_id] = r + reservations[res_id]['instances_set'].append(i) instance_response = {'reservationSet' : list(reservations.values()) } return instance_response @@ -471,7 +476,10 @@ class CloudController(object): @rbac.allow('projectmanager', 'sysadmin') def run_instances(self, context, **kwargs): - image = self._get_image(context, kwargs['image_id']) + # make sure user can access the image + # vpn image is private so it doesn't show up on lists + if kwargs['image_id'] != FLAGS.vpn_image_id: + image = self._get_image(context, kwargs['image_id']) logging.debug("Going to run instances...") reservation_id = utils.generate_uid('r') launch_time = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) -- cgit From 4f36ee72cb13ad4416cbdd891bb1c43638c17f1b Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: Added admin command to restart networks --- bin/nova-manage | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/nova-manage b/bin/nova-manage index 8d3e9cd4e..c96ae7e83 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -25,12 +25,17 @@ from nova import flags from nova import utils from nova.auth import users from nova.compute import model +from nova.compute import network from nova.cloudpipe import pipelib from nova.endpoint import cloud import time FLAGS = flags.FLAGS +class NetworkCommands(object): + def restart(self): + network.restart_nets() + class VpnCommands(object): def __init__(self): self.manager = users.UserManager.instance() @@ -154,6 +159,7 @@ def usage(script_name): categories = [ + ('network', NetworkCommands), ('user', UserCommands), ('project', ProjectCommands), ('vpn', VpnCommands), -- cgit From fe4f0d3ffd0ba1730598cb4b592e2c6a07719ef3 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: allow multiple vpn connections with the same credentials --- nova/cloudpipe/bootscript.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/nova/cloudpipe/bootscript.sh b/nova/cloudpipe/bootscript.sh index bb710617e..7adacc067 100755 --- a/nova/cloudpipe/bootscript.sh +++ b/nova/cloudpipe/bootscript.sh @@ -54,5 +54,6 @@ sed -i -e s/max-clients\ 1/max-clients\ 10/g server.conf echo "\npush \"route 10.255.255.1 255.255.255.255 $GATEWAY\"\n" >> server.conf echo "\npush \"route 10.255.255.253 255.255.255.255 $GATEWAY\"\n" >> server.conf +echo "\nduplicate-cn\n" >> server.conf /etc/init.d/openvpn start -- cgit From 933157bdc595b093d89de0da2cca5b021fadf0f6 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: filter keypairs for vpn keys --- nova/endpoint/cloud.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 0910e41d1..2500a7f6e 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -166,24 +166,20 @@ class CloudController(object): @rbac.allow('all') def describe_key_pairs(self, context, key_name=None, **kwargs): - key_pairs = [] - key_names = key_name and key_name or [] - if len(key_names) > 0: - for key_name in key_names: - key_pair = context.user.get_key_pair(key_name) - if key_pair != None: - key_pairs.append({ - 'keyName': key_pair.name, - 'keyFingerprint': key_pair.fingerprint, - }) - else: - for key_pair in context.user.get_key_pairs(): - key_pairs.append({ + key_pairs = context.user.get_key_pairs() + if not key_name is None: + key_pairs = [x for x in key_pairs if x.name in key_name] + + result = [] + for key_pair in key_pairs: + # filter out the vpn keys + if not context.user.is_admin() and not key_pair.name.endswith('-key'): + result.append({ 'keyName': key_pair.name, 'keyFingerprint': key_pair.fingerprint, }) - return { 'keypairsSet': key_pairs } + return { 'keypairsSet': result } @rbac.allow('all') def create_key_pair(self, context, key_name, **kwargs): -- cgit From 9862d03914a60359b7823bc4dec6d5449931dfad Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: fixed reversed filtering logic --- 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 2500a7f6e..fe784164e 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -173,7 +173,7 @@ class CloudController(object): result = [] for key_pair in key_pairs: # filter out the vpn keys - if not context.user.is_admin() and not key_pair.name.endswith('-key'): + if context.user.is_admin() or not key_pair.name.endswith('-key'): result.append({ 'keyName': key_pair.name, 'keyFingerprint': key_pair.fingerprint, -- cgit From e9e767ac1b4e42d77b6ecc025e48a5505c040aa2 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: fix error in disassociate address --- 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 fe784164e..3ff0364b0 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -465,7 +465,7 @@ class CloudController(object): @rbac.allow('netadmin') def disassociate_address(self, context, public_ip, **kwargs): - address = self._get_address(public_ip) + address = self._get_address(context, public_ip) self.network.disassociate_address(public_ip) # TODO - Strip the IP from the instance return defer.succeed({'disassociateResponse': ["Address disassociated."]}) -- cgit From 08619dd37a1bc00423a1f09859f7e5d8ba4f3ced Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:58 +0100 Subject: make sure to deexpress before we remove the host since deexpress uses the host --- nova/compute/network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/compute/network.py b/nova/compute/network.py index 15373cb20..acc153677 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -160,8 +160,8 @@ class BaseNetwork(datastore.RedisModel): def deallocate_ip(self, ip_str): if not ip_str in self.assigned: raise exception.AddressNotAllocated() - self._rem_host(ip_str) self.deexpress(address=ip_str) + self._rem_host(ip_str) def list_addresses(self): for address in self.hosts: -- cgit From 2793fc76e92a8779b5789f7b5f5b5918fa20eda8 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: fix display of project name for admin in describe instances --- 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 3ff0364b0..9903328dc 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -400,7 +400,7 @@ class CloudController(object): i['key_name'] = instance.get('key_name', None) if context.user.is_admin(): i['key_name'] = '%s (%s, %s)' % (i['key_name'], - instance.get('owner_id', None), instance.get('node_name','')) + instance.get('project_id', None), instance.get('node_name','')) i['product_codes_set'] = self._convert_to_set( instance.get('product_codes', None), 'product_code') i['instance_type'] = instance.get('instance_type', None) -- cgit From 4338f30114407049874112cfaef8e8ea6d9f32b3 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: Fix to volume smoketests --- smoketests/novatestcase.py | 4 +- smoketests/smoketest.py | 101 ++++++++++++++++----------------------------- 2 files changed, 38 insertions(+), 67 deletions(-) diff --git a/smoketests/novatestcase.py b/smoketests/novatestcase.py index d83359920..ff89b2682 100644 --- a/smoketests/novatestcase.py +++ b/smoketests/novatestcase.py @@ -2,7 +2,7 @@ import os, unittest, sys from commands import getstatusoutput -from paramiko import SSHClient, RSAKey, AutoAddPolicy +from paramiko import SSHClient, RSAKey, WarningPolicy import random BUCKET_NAME = 'smoketest' @@ -33,7 +33,7 @@ class NovaTestCase(unittest.TestCase): key = RSAKey.from_private_key_file('/tmp/%s.pem' % key_name) client = SSHClient() client.load_system_host_keys() - client.set_missing_host_key_policy(AutoAddPolicy()) + client.set_missing_host_key_policy(WarningPolicy()) client.connect(ip, username='ubuntu', pkey=key) stdin, stdout, stderr = client.exec_command('uptime') print 'uptime: ', stdout.read() diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index dc653dc9f..66f4fd640 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -358,7 +358,7 @@ class ElasticIPTests(NovaTestCase): def test_000_setUp(self): data['kernel_id'] = 'aki-EAB510D9' data['image_id'] = 'ami-25CB1213' - + self.create_user('me') conn = self.connection_for('me') self.create_key_pair(conn, 'mykey') @@ -402,71 +402,42 @@ class ElasticIPTests(NovaTestCase): ZONE = 'nova' DEVICE = '/dev/vdb' -vol_key = test_key + 'volumekey' # Test iscsi volumes class VolumeTests(NovaTestCase): def test_000_setUp(self): - self.create_user('me') - data['kernel_id'] = 'aki-EAB510D9' - data['image_id'] = 'ami-25CB1213' # A7370FE3 + self.create_user(test_username) + data['image_id'] = 'ami-tiny' # A7370FE3 - conn = self.connection_for('me') - self.create_key_pair(conn, vol_key) - reservation = conn.run_instances(data['image_id'], key_name=vol_key) - data['my_instance_id'] = reservation.instances[0].id - data['my_private_ip'] = reservation.instances[0].private_dns_name - - time.sleep(60) - """ + conn = self.connection_for(test_username) + self.create_key_pair(conn, test_key) + reservation = conn.run_instances(data['image_id'], size='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 = getstatusoutput("ping -c1 -w1 %s" % data['my_private_ip']) + status, output = getstatusoutput("ping -c1 -w1 %s" % data['private_ip']) if status == 0: - break + break else: - self.assertTrue(False) - """ + self.fail('unable to ping instance') + def test_001_me_can_create_volume(self): - conn = self.connection_for('me') + conn = self.connection_for(test_username) volume = conn.create_volume(1, ZONE) self.assertEqual(volume.size, 1) data['volume_id'] = volume.id def test_002_me_can_attach_volume(self): - # Wait for the volume to be reported to cloud - - time.sleep(30) - conn = self.connection_for('me') - for x in xrange(20): - try: - conn.attach_volume( - volume_id = data['volume_id'], - instance_id = data['my_instance_id'], - device = DEVICE - ) - break - except: - time.sleep(1) - else: - self.assertTrue(False) - - # fixme: test cannot delete attached volume! + conn = self.connection_for(test_username) + conn.attach_volume( + volume_id = data['volume_id'], + instance_id = data['instance_id'], + device = DEVICE + ) def test_003_me_can_mount_volume(self): - # Wait for the instance to ACTUALLY have ssh running - time.sleep(20) - for x in xrange(5): - try: - conn = self.connect_ssh(data['my_private_ip'], vol_key) - break - except: - time.sleep(5) - else: - self.assertTrue(False) - if conn: - conn.close() - return + conn = self.connect_ssh(data['private_ip'], test_key) stdin, stdout, stderr = conn.exec_command('sudo bash -c "mkdir -p /mnt/vol && mkfs.ext3 %s && mount %s /mnt/vol && echo success"' % (DEVICE, DEVICE)) out = stdout.read() conn.close() @@ -474,16 +445,16 @@ class VolumeTests(NovaTestCase): self.fail('Unable to mount: %s %s' % (out, stderr.read())) def test_004_me_can_write_to_volume(self): - conn = self.connect_ssh(data['my_private_ip'], vol_key) - # FIXME: This doesn't fail if the volume hasn't been mounted - stdin, stdout, stderr = conn.exec_command('sudo bash -c "echo hello > /mnt/vol/test.txt"') - err = stderr.read() - conn.close() - if len(err) > 0: - self.fail('Unable to write to mount: %s' % (err)) + 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('sudo bash -c "echo hello > /mnt/vol/test.txt"') + err = stderr.read() + conn.close() + if len(err) > 0: + self.fail('Unable to write to mount: %s' % (err)) def test_005_volume_is_correct_size(self): - conn = self.connect_ssh(data['my_private_ip'], vol_key) + 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("df -h | grep %s | awk {'print $2'}" % DEVICE) out = stdout.read() @@ -492,7 +463,7 @@ class VolumeTests(NovaTestCase): self.fail('Volume is not the right size: %s %s' % (out, stderr.read())) def test_006_me_can_umount_volume(self): - conn = self.connect_ssh(data['my_private_ip'], vol_key) + conn = self.connect_ssh(data['private_ip'], test_key) stdin, stdout, stderr = conn.exec_command('sudo umount /mnt/vol') err = stderr.read() conn.close() @@ -500,20 +471,20 @@ class VolumeTests(NovaTestCase): self.fail('Unable to unmount: %s' % (err)) def test_007_me_can_detach_volume(self): - conn = self.connection_for('me') + conn = self.connection_for(test_username) self.assertTrue(conn.detach_volume(volume_id = data['volume_id'])) def test_008_me_can_delete_volume(self): - conn = self.connection_for('me') + conn = self.connection_for(test_username) self.assertTrue(conn.delete_volume(data['volume_id'])) def test_999_tearDown(self): global data - conn = self.connection_for('me') - self.delete_key_pair(conn, vol_key) - if data.has_key('my_instance_id'): - conn.terminate_instances([data['my_instance_id']]) - self.delete_user('me') + conn = self.connection_for(test_username) + self.delete_key_pair(conn, test_key) + if data.has_key('instance_id'): + conn.terminate_instances([data['instance_id']]) + self.delete_user(test_username) data = {} def build_suites(): -- cgit From 042eba030857cf36462c0f8c24d45094935e9c52 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: boto uses instance_type not size --- smoketests/smoketest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index 66f4fd640..2027dd2aa 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -410,7 +410,7 @@ class VolumeTests(NovaTestCase): conn = self.connection_for(test_username) self.create_key_pair(conn, test_key) - reservation = conn.run_instances(data['image_id'], size='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 -- cgit From 4bc38342cbb5424f0b32145d1c068ef342ef047f Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: Cleaning up smoketests --- smoketests/novatestcase.py | 2 +- smoketests/smoketest.py | 31 ++++++++----------------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/smoketests/novatestcase.py b/smoketests/novatestcase.py index ff89b2682..e046fc488 100644 --- a/smoketests/novatestcase.py +++ b/smoketests/novatestcase.py @@ -34,7 +34,7 @@ class NovaTestCase(unittest.TestCase): client = SSHClient() client.load_system_host_keys() client.set_missing_host_key_policy(WarningPolicy()) - client.connect(ip, username='ubuntu', pkey=key) + client.connect(ip, username='root', pkey=key) stdin, stdout, stderr = client.exec_command('uptime') print 'uptime: ', stdout.read() return client diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index 2027dd2aa..1319e361a 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -163,8 +163,7 @@ class SecurityTests(NovaTestCase): def test_000_setUp(self): self.create_user(test_username + '_me') self.create_user(test_username + '_you') - data['kernel_id'] = 'aki-EAB510D9' - data['image_id'] = 'ami-25CB1213' + data['image_id'] = 'ami-tiny' def test_001_me_can_create_keypair(self): conn = self.connection_for(test_username + '_me') @@ -178,7 +177,7 @@ class SecurityTests(NovaTestCase): def test_003_me_can_create_instance_with_keypair(self): conn = self.connection_for(test_username + '_me') - reservation = conn.run_instances(data['image_id'], kernel_id=data['kernel_id'], key_name=test_key) + reservation = conn.run_instances(data['image_id'], key_name=test_key) self.assertEqual(len(reservation.instances), 1) data['my_instance_id'] = reservation.instances[0].id @@ -201,15 +200,13 @@ class SecurityTests(NovaTestCase): print data['my_private_ip'], def test_005_can_ping_private_ip(self): - # allow 30 seconds for PING to work - print "ping -c1 -w1 %s" % data['my_private_ip'] for x in xrange(120): # ping waits for 1 second status, output = getstatusoutput("ping -c1 -w1 %s" % data['my_private_ip']) if status == 0: break else: - self.assert_(False) + self.assert_("could not ping instance") #def test_005_me_cannot_ssh_when_unauthorized(self): # self.assertRaises(SSHException, self.connect_ssh, data['my_private_ip'], 'mykey') @@ -226,16 +223,8 @@ class SecurityTests(NovaTestCase): # ) def test_007_me_can_ssh_when_authorized(self): - # Wait for the instance to ACTUALLY have ssh ru/nning - for x in xrange(120): - try: - conn = self.connect_ssh(data['my_private_ip'], test_key) - conn.close() - break - except: - time.sleep(1) - else: - self.assertTrue(False) + conn = self.connect_ssh(data['my_private_ip'], test_key) + conn.close() #def test_008_me_can_revoke_ssh_authorization(self): # conn = self.connection_for('me') @@ -275,7 +264,6 @@ class SecurityTests(NovaTestCase): self.delete_user(test_username + '_me') self.delete_user(test_username + '_you') #self.tearDown_test_image(conn, data['image_id']) - #self.tearDown_test_image(conn, data['kernel_id']) # TODO: verify wrt image boots # build python into wrt image @@ -323,10 +311,10 @@ class RebundlingTests(NovaTestCase): conn = self.connect_ssh(data['my_private_ip'], 'mykey') stdin, stdout = conn.exec_command('python ~/smoketests/register-image.py') conn.close() - if re.matches('emi-{\w+}', stdout): + if re.matches('ami-{\w+}', stdout): data['my_image_id'] = stdout.strip() else: - self.fail('expected emi-nnnnnn, got:\n ' + stdout) + self.fail('expected ami-nnnnnn, got:\n ' + stdout) def test_005_you_cannot_see_my_private_image(self): conn = self.connection_for('you') @@ -356,15 +344,13 @@ class RebundlingTests(NovaTestCase): # Test elastic IPs class ElasticIPTests(NovaTestCase): def test_000_setUp(self): - data['kernel_id'] = 'aki-EAB510D9' - data['image_id'] = 'ami-25CB1213' + data['image_id'] = 'ami-tiny' self.create_user('me') conn = self.connection_for('me') self.create_key_pair(conn, 'mykey') conn = self.connection_for('admin') - #data['kernel_id'] = self.setUp_test_image(KERNEL_FILENAME, kernel=True) #data['image_id'] = self.setUp_test_image(IMAGE_FILENAME) def test_001_me_can_launch_image_with_keypair(self): @@ -397,7 +383,6 @@ class ElasticIPTests(NovaTestCase): conn = self.connection_for('admin') #self.tearDown_test_image(conn, data['image_id']) - #self.tearDown_test_image(conn, data['kernel_id']) data = {} ZONE = 'nova' -- cgit From f8f408c06a0cd670a87dbe114f3bca212549b825 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: don't need sudo anymore --- smoketests/smoketest.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index 1319e361a..66de274b1 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -423,24 +423,23 @@ class VolumeTests(NovaTestCase): def test_003_me_can_mount_volume(self): conn = self.connect_ssh(data['private_ip'], test_key) - stdin, stdout, stderr = conn.exec_command('sudo bash -c "mkdir -p /mnt/vol && mkfs.ext3 %s && mount %s /mnt/vol && echo success"' % (DEVICE, DEVICE)) + stdin, stdout, stderr = conn.exec_command('mkdir -p /mnt/vol && mkfs.ext3 %s && mount %s /mnt/vol && echo success' % (DEVICE, DEVICE)) out = stdout.read() conn.close() if not out.strip().endswith('success'): self.fail('Unable to mount: %s %s' % (out, stderr.read())) 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('sudo bash -c "echo hello > /mnt/vol/test.txt"') - err = stderr.read() - conn.close() - if len(err) > 0: - self.fail('Unable to write to mount: %s' % (err)) + 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') + err = stderr.read() + conn.close() + if len(err) > 0: + self.fail('Unable to write to mount: %s' % (err)) def test_005_volume_is_correct_size(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("df -h | grep %s | awk {'print $2'}" % DEVICE) out = stdout.read() conn.close() @@ -449,7 +448,7 @@ class VolumeTests(NovaTestCase): def test_006_me_can_umount_volume(self): conn = self.connect_ssh(data['private_ip'], test_key) - stdin, stdout, stderr = conn.exec_command('sudo umount /mnt/vol') + stdin, stdout, stderr = conn.exec_command('umount /mnt/vol') err = stderr.read() conn.close() if len(err) > 0: -- cgit From 1c9c2ce22726dd460f486f10a2fcb9f14cc23286 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: Fix mount of drive for test image --- smoketests/smoketest.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index 66de274b1..09cb37b3a 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -386,7 +386,7 @@ class ElasticIPTests(NovaTestCase): data = {} ZONE = 'nova' -DEVICE = '/dev/vdb' +DEVICE = 'vdb' # Test iscsi volumes class VolumeTests(NovaTestCase): def test_000_setUp(self): @@ -418,12 +418,20 @@ class VolumeTests(NovaTestCase): conn.attach_volume( volume_id = data['volume_id'], instance_id = data['instance_id'], - device = DEVICE + device = '/dev/%s' % DEVICE ) def test_003_me_can_mount_volume(self): conn = self.connect_ssh(data['private_ip'], test_key) - stdin, stdout, stderr = conn.exec_command('mkdir -p /mnt/vol && mkfs.ext3 %s && mount %s /mnt/vol && echo success' % (DEVICE, DEVICE)) + # 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) + commands = [] + commands.append('mkdir -p /mnt/vol') + commands.append('mkfs.ext3 %s' % DEVICE) + commands.append('mount %s /mnt/vol' % DEVICE) + commands.append('echo success') + stdin, stdout, stderr = conn.exec_command(commands.join(' && ')) out = stdout.read() conn.close() if not out.strip().endswith('success'): -- cgit From 20bc71348d67c361af04de7cff7517573fe5f366 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: typo in reboot instances --- 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 9903328dc..afd48aa14 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -556,7 +556,7 @@ class CloudController(object): """instance_id is a list of instance ids""" for i in instance_id: instance = self._get_instance(context, i) - rpc.cast('%s.%s' % (FLAGS.node_topic, instance['node_name']), + rpc.cast('%s.%s' % (FLAGS.compute_topic, instance['node_name']), {"method": "reboot_instance", "args" : {"instance_id": i}}) return defer.succeed(True) -- cgit From fc5492bf3fff5360f6ffe85c85540e1f0d6a7a10 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: More volume test fixes --- smoketests/smoketest.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index 09cb37b3a..aa03037de 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -412,6 +412,8 @@ class VolumeTests(NovaTestCase): volume = conn.create_volume(1, ZONE) self.assertEqual(volume.size, 1) data['volume_id'] = volume.id + # give network time to find volume + time.sleep(5) def test_002_me_can_attach_volume(self): conn = self.connection_for(test_username) @@ -420,6 +422,8 @@ class VolumeTests(NovaTestCase): instance_id = data['instance_id'], device = '/dev/%s' % DEVICE ) + # give instance time to recognize volume + time.sleep(5) def test_003_me_can_mount_volume(self): conn = self.connect_ssh(data['private_ip'], test_key) @@ -428,10 +432,10 @@ class VolumeTests(NovaTestCase): 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.ext3 %s' % DEVICE) - commands.append('mount %s /mnt/vol' % DEVICE) + commands.append('mkfs.ext2 /dev/%s' % DEVICE) + commands.append('mount /dev/%s /mnt/vol' % DEVICE) commands.append('echo success') - stdin, stdout, stderr = conn.exec_command(commands.join(' && ')) + stdin, stdout, stderr = conn.exec_command(' && '.join(commands)) out = stdout.read() conn.close() if not out.strip().endswith('success'): @@ -451,7 +455,7 @@ class VolumeTests(NovaTestCase): stdin, stdout, stderr = conn.exec_command("df -h | grep %s | awk {'print $2'}" % DEVICE) out = stdout.read() conn.close() - if not out.strip() == '1008M': + if not out.strip() == '1007.9M': self.fail('Volume is not the right size: %s %s' % (out, stderr.read())) def test_006_me_can_umount_volume(self): -- cgit From c32625c4bd6862797ff8432a946dd097462e78b8 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: more commands in nova-manage for projects and roles Conflicts: bin/nova-manage --- bin/nova-manage | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/bin/nova-manage b/bin/nova-manage index c96ae7e83..e3ffb58cd 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -82,6 +82,28 @@ class VpnCommands(object): def run(self, project_id): self.pipe.launch_vpn_instance(project_id) +class RoleCommands(object): + def __init__(self): + self.manager = users.UserManager.instance() + + def add(self, user, role, project=None): + """adds role to user + if project is specified, adds project specific role + arguments: user, role [project]""" + self.manager.add_role(user, role, project) + + def has(self, user, role, project=None): + """checks to see if user has role + if project is specified, returns True if user has + the global role and the project role + arguments: user, role [project]""" + print self.manager.has_role(user, role, project) + + def remove(self, user, role, project=None): + """removes role from user + if project is specified, removes project specific role + arguments: user, role [project]""" + self.manager.remove_role(user, role, project) class UserCommands(object): def __init__(self): @@ -127,6 +149,11 @@ class ProjectCommands(object): def __init__(self): self.manager = users.UserManager.instance() + def add(self, project, user): + """adds user to project + arguments: project user""" + self.manager.add_to_project(user, project) + def create(self, name, project_manager, description=None): """creates a new project arguments: name project_manager [description]""" @@ -143,7 +170,12 @@ class ProjectCommands(object): for project in self.manager.get_projects(): print project.name - def zip(self, project_id, user_id, filename='nova.zip'): + def remove(self, project, user): + """removes user from project + arguments: project user""" + self.manager.remove_from_project(user, project) + +def zip(self, project_id, user_id, filename='nova.zip'): """exports credentials for user to a zip file arguments: project_id user_id [filename='nova.zip]""" project = self.manager.get_project(project_id) @@ -162,6 +194,7 @@ categories = [ ('network', NetworkCommands), ('user', UserCommands), ('project', ProjectCommands), + ('role', RoleCommands), ('vpn', VpnCommands), ] -- cgit From c4c3167178819fdf3e34fc9e81a6d2361aef7605 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: fix is_running failing because state was stored as a string --- nova/compute/node.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nova/compute/node.py b/nova/compute/node.py index e2263f671..9d95f7e00 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -323,7 +323,8 @@ class Instance(object): @property def state(self): - return self.datamodel['state'] + # it is a string in datamodel + return int(self.datamodel['state']) @property def name(self): -- cgit From 3dcc46bc5cea6011e578bf67391daef2789a8505 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:11:59 +0100 Subject: fix fakeldap so it can use redis keeper --- nova/auth/fakeldap.py | 2 +- nova/test.py | 37 +++++++++++++++---------------------- run_tests.py | 8 ++++++++ 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/nova/auth/fakeldap.py b/nova/auth/fakeldap.py index 33003f057..feb2ac14a 100644 --- a/nova/auth/fakeldap.py +++ b/nova/auth/fakeldap.py @@ -40,7 +40,7 @@ def initialize(uri): class FakeLDAP(object): def __init__(self, _uri): - self.keeper = datastore.SqliteKeeper('fakeldap') #Redis keeper never works here... + self.keeper = datastore.Keeper('fakeldap') if self.keeper['objects'] is None: self.keeper['objects'] = {} diff --git a/nova/test.py b/nova/test.py index 05cb5b504..4b9a9f8a9 100644 --- a/nova/test.py +++ b/nova/test.py @@ -1,12 +1,12 @@ # 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 -# +# # 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. @@ -15,7 +15,7 @@ """ Base classes for our unit tests. -Allows overriding of flags for use of fakes, +Allows overriding of flags for use of fakes, and some black magic for inline callbacks. """ @@ -47,13 +47,13 @@ def skip_if_fake(f): raise trial_unittest.SkipTest('Test cannot be run in fake mode') else: return f(*args, **kw) - + _skipper.func_name = f.func_name return _skipper class TrialTestCase(trial_unittest.TestCase): - flush_db = True + def setUp(self): super(TrialTestCase, self).setUp() @@ -62,11 +62,6 @@ class TrialTestCase(trial_unittest.TestCase): self.mox = mox.Mox() self.stubs = stubout.StubOutForTesting() self.flag_overrides = {} - self.flags(redis_db=8) - if self.flush_db: - logging.info("Flushing redis datastore") - r = datastore.Redis.instance() - r.flushdb() def tearDown(self): super(TrialTestCase, self).tearDown() @@ -78,7 +73,7 @@ class TrialTestCase(trial_unittest.TestCase): if FLAGS.fake_rabbit: fakerabbit.reset_all() - + # attempt to wipe all keepers #keeper = datastore.Keeper() #keeper.clear_all() @@ -96,7 +91,7 @@ class TrialTestCase(trial_unittest.TestCase): for k, v in self.flag_overrides.iteritems(): setattr(FLAGS, k, v) - + class BaseTestCase(TrialTestCase): def setUp(self): @@ -105,7 +100,7 @@ class BaseTestCase(TrialTestCase): # the injected listeners... this is fine for now though self.injected = [] self.ioloop = ioloop.IOLoop.instance() - + self._waiting = None self._doneWaiting = False self._timedOut = False @@ -124,8 +119,6 @@ class BaseTestCase(TrialTestCase): if FLAGS.fake_rabbit: fakerabbit.reset_all() self.tear_down() - r = datastore.Redis.instance() - r.flushdb() def _waitForTest(self, timeout=60): """ Push the ioloop along to wait for our test to complete. """ @@ -152,10 +145,10 @@ class BaseTestCase(TrialTestCase): pass self._waiting = None self._doneWaiting = True - + def _maybeInlineCallbacks(self, f): """ If we're doing async calls in our tests, wait on them. - + This is probably the most complicated hunk of code we have so far. First up, if the function is normal (not async) we just act normal @@ -166,7 +159,7 @@ class BaseTestCase(TrialTestCase): of making epic callback chains. Example (callback chain, ugly): - + d = self.node.terminate_instance(instance_id) # a Deferred instance def _describe(_): d_desc = self.node.describe_instances() # another Deferred instance @@ -177,7 +170,7 @@ class BaseTestCase(TrialTestCase): d.addCallback(_checkDescribe) d.addCallback(lambda x: self._done()) self._waitForTest() - + Example (inline callbacks! yay!): yield self.node.terminate_instance(instance_id) @@ -194,11 +187,11 @@ class BaseTestCase(TrialTestCase): if not hasattr(g, 'send'): self._done() return defer.succeed(g) - + inlined = defer.inlineCallbacks(f) d = inlined() return d - + def _catchExceptions(self, result, failure): exc = (failure.type, failure.value, failure.getTracebackObject()) if isinstance(failure.value, self.failureException): diff --git a/run_tests.py b/run_tests.py index 957e5d208..d03dbb987 100644 --- a/run_tests.py +++ b/run_tests.py @@ -60,6 +60,8 @@ from nova.tests.validator_unittest import * FLAGS = flags.FLAGS +flags.DEFINE_bool('flush_db', True, + 'Flush the database before running fake tests') if __name__ == '__main__': OptionsClass = twistd.WrapTwistedOptions(trial_script.Options) @@ -71,6 +73,12 @@ if __name__ == '__main__': # TODO(termie): these should make a call instead of doing work on import if FLAGS.fake_tests: from nova.tests.fake_flags import * + # use db 8 for fake tests + FLAGS.redis_db = 8 + if FLAGS.flush_db: + logging.info("Flushing redis datastore") + r = datastore.Redis.instance() + r.flushdb() else: from nova.tests.real_flags import * -- cgit From 86f813862069d58963540222730dce5ad89974a8 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: add exit status to nova-manage --- bin/nova-manage | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/nova-manage b/bin/nova-manage index e3ffb58cd..29aa0547e 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -260,7 +260,9 @@ if __name__ == '__main__': # call the action with the remaining arguments try: fn(*argv) + sys.exit(0) except TypeError: print "Wrong number of arguments supplied" print "%s %s: %s" % (category, action, fn.__doc__) + sys.exit(2) -- cgit From b1f4c7b2d3956fd4eec318d7d8a0defcb96e8355 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: use logger to print trace of unhandled exceptions --- nova/exception.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nova/exception.py b/nova/exception.py index 82d08e840..d78db696b 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -47,9 +47,9 @@ def wrap_exception(f): return f(*args, **kw) except Exception, e: if not isinstance(e, Error): - # exc_type, exc_value, exc_traceback = sys.exc_info() - logging.exception('Uncaught exception') - # logging.debug(traceback.extract_stack(exc_traceback)) + exc_type, exc_value, exc_traceback = sys.exc_info() + logging.error('Uncaught exception') + logging.error(traceback.extract_stack(exc_traceback)) raise Error(str(e)) raise _wrap.func_name = f.func_name -- cgit From c04e43bece8f996345e4dd07f308bca6d6e85fed Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: Release 2.2-3 --- debian/changelog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index e7bfe0371..481661c43 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +nova (0.2.2-3) UNRELEASED; urgency=low + + * Fixes to api calls + * More accurate documentation + * Removal of buggy multiprocessing + * Asynchronus execution of shell commands + * Fix of messaging race condition + * Test redis database cleaned out on each run of tests + * Smoketest updates + + -- Vishvananda Ishaya Wed, 03 Jun 2010 15:21:00 -0700 + nova (0.2.2-2) UNRELEASED; urgency=low * Bugfixes to volume code -- cgit From 89e184767130fcdc8fd7c471eda9945ed71ce598 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: fix missing tab in nova-manage --- bin/nova-manage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/nova-manage b/bin/nova-manage index 29aa0547e..d25de6cda 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -175,7 +175,7 @@ class ProjectCommands(object): arguments: project user""" self.manager.remove_from_project(user, project) -def zip(self, project_id, user_id, filename='nova.zip'): + def zip(self, project_id, user_id, filename='nova.zip'): """exports credentials for user to a zip file arguments: project_id user_id [filename='nova.zip]""" project = self.manager.get_project(project_id) -- cgit From 57c7bb9f45251d36b95d81a55ce60cf9e57ec602 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: documentation updates Conflicts: README --- docs/getting.started.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/getting.started.rst b/docs/getting.started.rst index d6d76031b..8e3848113 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -58,11 +58,11 @@ Installation :: # system libraries and tools - apt-get install -y libvirt-bin aoetools vlan + apt-get install -y aoetools vlan modprobe aoe # python libraries - apt-get install -y python-libvirt python-setuptools python-dev python-pycurl python-m2crypto + apt-get install -y python-setuptools python-dev python-pycurl python-m2crypto # ON THE CLOUD CONTROLLER apt-get install -y rabbitmq-server dnsmasq nginx @@ -75,7 +75,8 @@ Installation apt-get install -y vblade-persist # ON THE COMPUTE NODE: - apt-get install -y kpartx kvm + apt-get install -y python-libvirt + apt-get install -y kpartx kvm libvirt-bin # optional packages apt-get install -y euca2ools -- cgit From 3c8efde48753e005e0103fcc9d837163477103db Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: trackback formatting isn't logging correctly --- nova/exception.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nova/exception.py b/nova/exception.py index d78db696b..381419101 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -47,9 +47,9 @@ def wrap_exception(f): return f(*args, **kw) except Exception, e: if not isinstance(e, Error): - exc_type, exc_value, exc_traceback = sys.exc_info() - logging.error('Uncaught exception') - logging.error(traceback.extract_stack(exc_traceback)) + #exc_type, exc_value, exc_traceback = sys.exc_info() + logging.exception('Uncaught exception') + #logging.error(traceback.extract_stack(exc_traceback)) raise Error(str(e)) raise _wrap.func_name = f.func_name -- cgit From b21e811048b272576ea209b8706abea05041f062 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: Merge of fix to stop twisted threads from interuppting system calls http://twistedmatrix.com/trac/changeset/28447 --- vendor/Twisted-10.0.0/twisted/internet/base.py | 34 +---- .../Twisted-10.0.0/twisted/internet/gtk2reactor.py | 27 +++- .../Twisted-10.0.0/twisted/internet/posixbase.py | 140 +++++++++++++++++---- .../twisted/internet/test/reactormixins.py | 15 ++- .../twisted/internet/test/test_process.py | 49 +++++++- vendor/Twisted-10.0.0/twisted/topfiles/setup.py | 8 +- 6 files changed, 209 insertions(+), 64 deletions(-) diff --git a/vendor/Twisted-10.0.0/twisted/internet/base.py b/vendor/Twisted-10.0.0/twisted/internet/base.py index 7513f6ddd..370de7605 100644 --- a/vendor/Twisted-10.0.0/twisted/internet/base.py +++ b/vendor/Twisted-10.0.0/twisted/internet/base.py @@ -1,5 +1,5 @@ # -*- test-case-name: twisted.test.test_internet -*- -# Copyright (c) 2001-2009 Twisted Matrix Laboratories. +# Copyright (c) 2001-2010 Twisted Matrix Laboratories. # See LICENSE for details. """ @@ -22,7 +22,7 @@ from twisted.internet.interfaces import IResolverSimple, IReactorPluggableResolv from twisted.internet.interfaces import IConnector, IDelayedCall from twisted.internet import fdesc, main, error, abstract, defer, threads from twisted.python import log, failure, reflect -from twisted.python.runtime import seconds as runtimeSeconds, platform, platformType +from twisted.python.runtime import seconds as runtimeSeconds, platform from twisted.internet.defer import Deferred, DeferredList from twisted.persisted import styles @@ -468,6 +468,7 @@ class ReactorBase(object): if platform.supportsThreads(): self._initThreads() + self.installWaker() # override in subclasses @@ -889,7 +890,6 @@ class ReactorBase(object): def _initThreads(self): self.usingThreads = True self.resolver = ThreadedResolver(self) - self.installWaker() def callFromThread(self, f, *args, **kw): """ @@ -914,6 +914,9 @@ class ReactorBase(object): self.threadpoolShutdownID = self.addSystemEventTrigger( 'during', 'shutdown', self._stopThreadPool) + def _uninstallHandler(self): + pass + def _stopThreadPool(self): """ Stop the reactor threadpool. This method is only valid if there @@ -1109,31 +1112,6 @@ class _SignalReactorMixin: if hasattr(signal, "SIGBREAK"): signal.signal(signal.SIGBREAK, self.sigBreak) - if platformType == 'posix': - signal.signal(signal.SIGCHLD, self._handleSigchld) - # Also call the signal handler right now, in case we missed any - # signals before we installed it. This should only happen if - # someone used spawnProcess before calling reactor.run (and the - # process also exited already). - self._handleSigchld(signal.SIGCHLD, None) - - - def _handleSigchld(self, signum, frame, _threadSupport=platform.supportsThreads()): - """ - Reap all processes on SIGCHLD. - - This gets called on SIGCHLD. We do no processing inside a signal - handler, as the calls we make here could occur between any two - python bytecode instructions. Deferring processing to the next - eventloop round prevents us from violating the state constraints - of arbitrary classes. - """ - from twisted.internet.process import reapAllProcesses - if _threadSupport: - self.callFromThread(reapAllProcesses) - else: - self.callLater(0, reapAllProcesses) - def startRunning(self, installSignalHandlers=True): """ diff --git a/vendor/Twisted-10.0.0/twisted/internet/gtk2reactor.py b/vendor/Twisted-10.0.0/twisted/internet/gtk2reactor.py index bd979bcac..52796d429 100644 --- a/vendor/Twisted-10.0.0/twisted/internet/gtk2reactor.py +++ b/vendor/Twisted-10.0.0/twisted/internet/gtk2reactor.py @@ -1,4 +1,4 @@ -# -*- test-case-name: twisted.internet.test.test_gtk2reactor -*- +# -*- test-case-name: twisted.internet.test -*- # Copyright (c) 2001-2010 Twisted Matrix Laboratories. # See LICENSE for details. @@ -21,8 +21,10 @@ integration. """ # System Imports -import sys +import sys, signal + from zope.interface import implements + try: if not hasattr(sys, 'frozen'): # Don't want to check this for py2exe @@ -41,7 +43,7 @@ if hasattr(gobject, "threads_init"): from twisted.python import log, runtime, failure from twisted.python.compat import set from twisted.internet.interfaces import IReactorFDSet -from twisted.internet import main, posixbase, error, selectreactor +from twisted.internet import main, base, posixbase, error, selectreactor POLL_DISCONNECTED = gobject.IO_HUP | gobject.IO_ERR | gobject.IO_NVAL @@ -104,6 +106,25 @@ class Gtk2Reactor(posixbase.PosixReactorBase): self.__crash = _our_mainquit self.__run = gtk.main + + if runtime.platformType == 'posix': + def _handleSignals(self): + # Let the base class do its thing, but pygtk is probably + # going to stomp on us so go beyond that and set up some + # signal handling which pygtk won't mess with. This would + # be better done by letting this reactor select a + # different implementation of installHandler for + # _SIGCHLDWaker to use. Then, at least, we could fall + # back to our extension module. See #4286. + from twisted.internet.process import reapAllProcesses as _reapAllProcesses + base._SignalReactorMixin._handleSignals(self) + signal.signal(signal.SIGCHLD, lambda *a: self.callFromThread(_reapAllProcesses)) + if getattr(signal, "siginterrupt", None) is not None: + signal.siginterrupt(signal.SIGCHLD, False) + # Like the base, reap processes now in case a process + # exited before the handlers above were installed. + _reapAllProcesses() + # The input_add function in pygtk1 checks for objects with a # 'fileno' method and, if present, uses the result of that method # as the input source. The pygtk2 input_add does not do this. The diff --git a/vendor/Twisted-10.0.0/twisted/internet/posixbase.py b/vendor/Twisted-10.0.0/twisted/internet/posixbase.py index b410a4ee5..6ab044842 100644 --- a/vendor/Twisted-10.0.0/twisted/internet/posixbase.py +++ b/vendor/Twisted-10.0.0/twisted/internet/posixbase.py @@ -41,8 +41,7 @@ except ImportError: processEnabled = False if platformType == 'posix': - from twisted.internet import fdesc - import process + from twisted.internet import fdesc, process, _signals processEnabled = True if platform.isWindows(): @@ -103,10 +102,19 @@ class _SocketWaker(log.Logger, styles.Ephemeral): -class _PipeWaker(log.Logger, styles.Ephemeral): +class _FDWaker(object, log.Logger, styles.Ephemeral): """ The I{self-pipe trick}, used to wake up the main loop from another thread or a signal handler. + + L{_FDWaker} is a base class for waker implementations based on + writing to a pipe being monitored by the reactor. + + @ivar o: The file descriptor for the end of the pipe which can be + written to to wake up a reactor monitoring this waker. + + @ivar i: The file descriptor which should be monitored in order to + be awoken by this waker. """ disconnected = 0 @@ -124,22 +132,13 @@ class _PipeWaker(log.Logger, styles.Ephemeral): fdesc._setCloseOnExec(self.o) self.fileno = lambda: self.i + def doRead(self): - """Read some bytes from the pipe. + """ + Read some bytes from the pipe and discard them. """ fdesc.readFromFD(self.fileno(), lambda data: None) - def wakeUp(self): - """Write one byte to the pipe, and flush it. - """ - # We don't use fdesc.writeToFD since we need to distinguish - # between EINTR (try again) and EAGAIN (do nothing). - if self.o is not None: - try: - util.untilConcludes(os.write, self.o, 'x') - except OSError, e: - if e.errno != errno.EAGAIN: - raise def connectionLost(self, reason): """Close both ends of my pipe. @@ -154,25 +153,85 @@ class _PipeWaker(log.Logger, styles.Ephemeral): del self.i, self.o + +class _UnixWaker(_FDWaker): + """ + This class provides a simple interface to wake up the event loop. + + This is used by threads or signals to wake up the event loop. + """ + + def wakeUp(self): + """Write one byte to the pipe, and flush it. + """ + # We don't use fdesc.writeToFD since we need to distinguish + # between EINTR (try again) and EAGAIN (do nothing). + if self.o is not None: + try: + util.untilConcludes(os.write, self.o, 'x') + except OSError, e: + # XXX There is no unit test for raising the exception + # for other errnos. See #4285. + if e.errno != errno.EAGAIN: + raise + + + if platformType == 'posix': - _Waker = _PipeWaker + _Waker = _UnixWaker else: # Primarily Windows and Jython. _Waker = _SocketWaker +class _SIGCHLDWaker(_FDWaker): + """ + L{_SIGCHLDWaker} can wake up a reactor whenever C{SIGCHLD} is + received. + + @see: L{twisted.internet._signals} + """ + def __init__(self, reactor): + _FDWaker.__init__(self, reactor) + + + def install(self): + """ + Install the handler necessary to make this waker active. + """ + _signals.installHandler(self.o) + + + def uninstall(self): + """ + Remove the handler which makes this waker active. + """ + _signals.installHandler(-1) + + + def doRead(self): + """ + Having woken up the reactor in response to receipt of + C{SIGCHLD}, reap the process which exited. + + This is called whenever the reactor notices the waker pipe is + writeable, which happens soon after any call to the C{wakeUp} + method. + """ + _FDWaker.doRead(self) + process.reapAllProcesses() + + + class PosixReactorBase(_SignalReactorMixin, ReactorBase): """ A basis for reactors that use file descriptors. + + @ivar _childWaker: C{None} or a reference to the L{_SIGCHLDWaker} + which is used to properly notice child process termination. """ implements(IReactorArbitrary, IReactorTCP, IReactorUDP, IReactorMulticast) - def __init__(self): - ReactorBase.__init__(self) - if self.usingThreads or platformType == "posix": - self.installWaker() - - def _disconnectSelectable(self, selectable, why, isRead, faildict={ error.ConnectionDone: failure.Failure(error.ConnectionDone()), error.ConnectionLost: failure.Failure(error.ConnectionLost()) @@ -209,6 +268,43 @@ class PosixReactorBase(_SignalReactorMixin, ReactorBase): self.addReader(self.waker) + _childWaker = None + def _handleSignals(self): + """ + Extend the basic signal handling logic to also support + handling SIGCHLD to know when to try to reap child processes. + """ + _SignalReactorMixin._handleSignals(self) + if platformType == 'posix': + if not self._childWaker: + self._childWaker = _SIGCHLDWaker(self) + self._internalReaders.add(self._childWaker) + self.addReader(self._childWaker) + self._childWaker.install() + # Also reap all processes right now, in case we missed any + # signals before we installed the SIGCHLD waker/handler. + # This should only happen if someone used spawnProcess + # before calling reactor.run (and the process also exited + # already). + process.reapAllProcesses() + + def _uninstallHandler(self): + """ + If a child waker was created and installed, uninstall it now. + + Since this disables reactor functionality and is only called + when the reactor is stopping, it doesn't provide any directly + useful functionality, but the cleanup of reactor-related + process-global state that it does helps in unit tests + involving multiple reactors and is generally just a nice + thing. + """ + # XXX This would probably be an alright place to put all of + # the cleanup code for all internal readers (here and in the + # base class, anyway). See #3063 for that cleanup task. + if self._childWaker: + self._childWaker.uninstall() + # IReactorProcess def spawnProcess(self, processProtocol, executable, args=(), diff --git a/vendor/Twisted-10.0.0/twisted/internet/test/reactormixins.py b/vendor/Twisted-10.0.0/twisted/internet/test/reactormixins.py index 2895daf25..09e6e55e9 100644 --- a/vendor/Twisted-10.0.0/twisted/internet/test/reactormixins.py +++ b/vendor/Twisted-10.0.0/twisted/internet/test/reactormixins.py @@ -1,4 +1,4 @@ -# Copyright (c) 2008-2009 Twisted Matrix Laboratories. +# Copyright (c) 2008-2010 Twisted Matrix Laboratories. # See LICENSE for details. """ @@ -95,6 +95,7 @@ class ReactorBuilder: # branch that fixes it. # # -exarkun + reactor._uninstallHandler() if getattr(reactor, '_internalReaders', None) is not None: for reader in reactor._internalReaders: reactor.removeReader(reader) @@ -119,10 +120,14 @@ class ReactorBuilder: try: reactor = self.reactorFactory() except: - # Unfortunately, not all errors which result in a reactor being - # unusable are detectable without actually instantiating the - # reactor. So we catch some more here and skip the test if - # necessary. + # Unfortunately, not all errors which result in a reactor + # being unusable are detectable without actually + # instantiating the reactor. So we catch some more here + # and skip the test if necessary. We also log it to aid + # with debugging, but flush the logged error so the test + # doesn't fail. + log.err(None, "Failed to install reactor") + self.flushLoggedErrors() raise SkipTest(Failure().getErrorMessage()) else: if self.requiredInterface is not None: diff --git a/vendor/Twisted-10.0.0/twisted/internet/test/test_process.py b/vendor/Twisted-10.0.0/twisted/internet/test/test_process.py index fbfb788cd..06197c05d 100644 --- a/vendor/Twisted-10.0.0/twisted/internet/test/test_process.py +++ b/vendor/Twisted-10.0.0/twisted/internet/test/test_process.py @@ -1,4 +1,4 @@ -# Copyright (c) 2008-2009 Twisted Matrix Laboratories. +# Copyright (c) 2008-2010 Twisted Matrix Laboratories. # See LICENSE for details. """ @@ -9,7 +9,7 @@ __metaclass__ = type import os, sys, signal, threading -from twisted.trial.unittest import TestCase +from twisted.trial.unittest import TestCase, SkipTest from twisted.internet.test.reactormixins import ReactorBuilder from twisted.python.compat import set from twisted.python.log import msg, err @@ -22,6 +22,7 @@ from twisted.internet.protocol import ProcessProtocol from twisted.internet.error import ProcessDone, ProcessTerminated + class _ShutdownCallbackProcessProtocol(ProcessProtocol): """ An L{IProcessProtocol} which fires a Deferred when the process it is @@ -174,6 +175,50 @@ class ProcessTestsBuilderBase(ReactorBuilder): self.runReactor(reactor) + def test_systemCallUninterruptedByChildExit(self): + """ + If a child process exits while a system call is in progress, the system + call should not be interfered with. In particular, it should not fail + with EINTR. + + Older versions of Twisted installed a SIGCHLD handler on POSIX without + using the feature exposed by the SA_RESTART flag to sigaction(2). The + most noticable problem this caused was for blocking reads and writes to + sometimes fail with EINTR. + """ + reactor = self.buildReactor() + + # XXX Since pygobject/pygtk wants to use signal.set_wakeup_fd, + # we aren't actually providing this functionality on the glib2 + # or gtk2 reactors yet. See #4286 for the possibility of + # improving this. + skippedReactors = ["Glib2Reactor", "Gtk2Reactor"] + hasSigInterrupt = getattr(signal, "siginterrupt", None) is not None + reactorClassName = reactor.__class__.__name__ + if reactorClassName in skippedReactors and not hasSigInterrupt: + raise SkipTest( + "%s is not supported without siginterrupt" % reactorClassName) + + result = [] + + def f(): + try: + f1 = os.popen('%s -c "import time; time.sleep(0.1)"' % + (sys.executable,)) + f2 = os.popen('%s -c "import time; time.sleep(0.5); print \'Foo\'"' % + (sys.executable,)) + # The read call below will blow up with an EINTR from the + # SIGCHLD from the first process exiting if we install a + # SIGCHLD handler without SA_RESTART. (which we used to do) + result.append(f2.read()) + finally: + reactor.stop() + + reactor.callWhenRunning(f) + self.runReactor(reactor) + self.assertEqual(result, ["Foo\n"]) + + class ProcessTestsBuilder(ProcessTestsBuilderBase): """ diff --git a/vendor/Twisted-10.0.0/twisted/topfiles/setup.py b/vendor/Twisted-10.0.0/twisted/topfiles/setup.py index a135c77fb..90ba24484 100644 --- a/vendor/Twisted-10.0.0/twisted/topfiles/setup.py +++ b/vendor/Twisted-10.0.0/twisted/topfiles/setup.py @@ -1,9 +1,7 @@ #!/usr/bin/env python - -# Copyright (c) 2001-2009 Twisted Matrix Laboratories. +# Copyright (c) 2001-2010 Twisted Matrix Laboratories. # See LICENSE for details. - """ Distutils installer for Twisted. """ @@ -47,9 +45,11 @@ extensions = [ '-framework','CoreServices', '-framework','Carbon'], condition=lambda builder: sys.platform == "darwin"), - Extension("twisted.python._initgroups", ["twisted/python/_initgroups.c"]), + Extension("twisted.internet._sigchld", + ["twisted/internet/_sigchld.c"], + condition=lambda builder: sys.platform != "win32"), ] # Figure out which plugins to include: all plugins except subproject ones -- cgit From 9cf1fe03b121db1682dda4941b4d4b6d010829b4 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: release 2.2-4 --- debian/changelog | 9 +++++++++ debian/control | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 481661c43..36e9a6c9b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +nova (0.2.2-4) UNRELEASED; urgency=low + + * Documentation fixes + * Uncaught exceptions now log properly + * Nova Manage zip exporting works again + * Twisted threads no longer interrupt system calls + + -- Vishvananda Ishaya Wed, 03 Jun 2010 15:21:00 -0700 + nova (0.2.2-3) UNRELEASED; urgency=low * Fixes to api calls diff --git a/debian/control b/debian/control index 81af9f4e9..a50e6ecf8 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 (>= 10.0.0-2ubuntu2nebula1), python-daemon, python-redis, python-carrot, python-lockfile, python-gflags, python-tornado, ${misc:Depends} Provides: ${python:Provides} Conflicts: nova Description: Nova is a cloud -- cgit From bace12d17abcbb0a972e4e29cc4275925bb03153 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: message checking callbacks only need to run 10 times a second --- nova/rpc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/rpc.py b/nova/rpc.py index ca622daef..711aad9fa 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -68,7 +68,7 @@ class Consumer(messaging.Consumer): io_inst = ioloop.IOLoop.instance() injected = ioloop.PeriodicCallback( - lambda: self.fetch(enable_callbacks=True), 1, io_loop=io_inst) + lambda: self.fetch(enable_callbacks=True), 100, io_loop=io_inst) injected.start() return injected @@ -80,7 +80,7 @@ class Consumer(messaging.Consumer): def attach_to_twisted(self): loop = task.LoopingCall(self.fetch, enable_callbacks=True) - loop.start(interval=0.01) + loop.start(interval=0.1) class Publisher(messaging.Publisher): pass -- cgit From b3417505c28d7205c726715ebf231cb4c291a88a Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: release 2.2-5 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 36e9a6c9b..ef2ab1dd3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nova (0.2.2-5) UNRELEASED; urgency=low + + * Lowered message callback frequency to stop compute and volume + from eating tons of cpu + + -- Vishvananda Ishaya Wed, 03 Jun 2010 15:21:00 -0700 + nova (0.2.2-4) UNRELEASED; urgency=low * Documentation fixes -- cgit From 6fec8caaeb8bfc1fcc7a91be75850d81ff4e5aa6 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: disk.py needed input for key injection to work Conflicts: nova/compute/node.py --- nova/compute/node.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nova/compute/node.py b/nova/compute/node.py index 9d95f7e00..3de93d96c 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -475,8 +475,9 @@ class Instance(object): yield _fetch_file(data['kernel_id'], basepath('kernel')) if not os.path.exists(basepath('ramdisk')): yield _fetch_file(data['ramdisk_id'], basepath('ramdisk')) - - execute = lambda x: self._pool.simpleExecute(x, error_ok=1) + + 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( -- cgit From 59bfa3a64d46b8a625e3b288f50a2f521c19e329 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Jun 2010 04:12:00 +0100 Subject: release 0.2.2-6 --- debian/changelog | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index ef2ab1dd3..789dad36d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,15 @@ +nova (0.2.2-6) UNRELEASED; urgency=low + + * Fix to make Key Injection work again + + -- Vishvananda Ishaya Mon, 14 Jun 2010 21:35:00 -0700 + nova (0.2.2-5) UNRELEASED; urgency=low * Lowered message callback frequency to stop compute and volume from eating tons of cpu - -- Vishvananda Ishaya Wed, 03 Jun 2010 15:21:00 -0700 + -- Vishvananda Ishaya Mon, 14 Jun 2010 14:15:00 -0700 nova (0.2.2-4) UNRELEASED; urgency=low @@ -12,7 +18,7 @@ nova (0.2.2-4) UNRELEASED; urgency=low * Nova Manage zip exporting works again * Twisted threads no longer interrupt system calls - -- Vishvananda Ishaya Wed, 03 Jun 2010 15:21:00 -0700 + -- Vishvananda Ishaya Sun, 13 Jun 2010 01:40:00 -0700 nova (0.2.2-3) UNRELEASED; urgency=low @@ -24,7 +30,7 @@ nova (0.2.2-3) UNRELEASED; urgency=low * Test redis database cleaned out on each run of tests * Smoketest updates - -- Vishvananda Ishaya Wed, 03 Jun 2010 15:21:00 -0700 + -- Vishvananda Ishaya Fri, 12 Jun 2010 20:10:00 -0700 nova (0.2.2-2) UNRELEASED; urgency=low -- cgit From 029a5510f69fa71b1a520cb5e9468b653dcde6dc Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:12:01 +0100 Subject: Create DescribeImageAttribute api method Conflicts: nova/endpoint/cloud.py --- nova/endpoint/cloud.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index afd48aa14..2eee5cb39 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -593,6 +593,7 @@ class CloudController(object): return defer.succeed({'imageId': image_id}) + @rbac.allow('all') def describe_image_attribute(self, context, image_id, attribute, **kwargs): if attribute != 'launchPermission': raise exception.ApiError('attribute not supported: %s' % attribute) @@ -613,8 +614,8 @@ class CloudController(object): raise exception.ApiError('attribute not supported: %s' % attribute) if len(kwargs['user_group']) != 1 and kwargs['user_group'][0] != 'all': raise exception.ApiError('only group "all" is supported') - if not operation_type in ['add', 'delete']: - raise exception.ApiError('operation_type must be add or delete') + if not operation_type in ['add', 'remove']: + raise exception.ApiError('operation_type must be add or remove') result = images.modify(context, image_id, operation_type) return defer.succeed(result) -- cgit From 9b5c06c339a68046a8eef399583778892eed75bd Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Jun 2010 04:12:01 +0100 Subject: Initial commit of nodemonitor Conflicts: bin/nova-instancemonitor nova/compute/monitor.py --- bin/nova-instancemonitor | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor index 2cfd5fc35..c44a2279c 100755 --- a/bin/nova-instancemonitor +++ b/bin/nova-instancemonitor @@ -24,6 +24,7 @@ from nova import vendor from twisted.internet import task from twisted.application import service +from nova import flags from nova import twistd from nova.compute import monitor -- cgit From 487bb6abc3a66c93f440ae532ae92d5192624ffd Mon Sep 17 00:00:00 2001 From: Devin Carlen Date: Thu, 24 Jun 2010 04:12:01 +0100 Subject: Tweaks to get instancemonitor running --- bin/nova-instancemonitor | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor index c44a2279c..2cfd5fc35 100755 --- a/bin/nova-instancemonitor +++ b/bin/nova-instancemonitor @@ -24,7 +24,6 @@ from nova import vendor from twisted.internet import task from twisted.application import service -from nova import flags from nova import twistd from nova.compute import monitor -- cgit From 8767608e335752fea4be6bebd6298bb49782f6d6 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 24 Jun 2010 04:12:01 +0100 Subject: A few missing files from the twisted patch --- vendor/Twisted-10.0.0/twisted/internet/_sigchld.c | 101 +++++++++++ vendor/Twisted-10.0.0/twisted/internet/_signals.py | 184 +++++++++++++++++++ .../twisted/internet/test/test_sigchld.py | 194 +++++++++++++++++++++ vendor/Twisted-10.0.0/twisted/topfiles/733.bugfix | 4 + 4 files changed, 483 insertions(+) create mode 100644 vendor/Twisted-10.0.0/twisted/internet/_sigchld.c create mode 100644 vendor/Twisted-10.0.0/twisted/internet/_signals.py create mode 100644 vendor/Twisted-10.0.0/twisted/internet/test/test_sigchld.py create mode 100644 vendor/Twisted-10.0.0/twisted/topfiles/733.bugfix diff --git a/vendor/Twisted-10.0.0/twisted/internet/_sigchld.c b/vendor/Twisted-10.0.0/twisted/internet/_sigchld.c new file mode 100644 index 000000000..660182bd2 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/internet/_sigchld.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2010 Twisted Matrix Laboratories. + * See LICENSE for details. + */ + +#include +#include + +#include "Python.h" + +static int sigchld_pipe_fd = -1; + +static void got_signal(int sig) { + int saved_errno = errno; + int ignored_result; + + /* write() errors are unhandled. If the buffer is full, we don't + * care. What about other errors? */ + ignored_result = write(sigchld_pipe_fd, "x", 1); + + errno = saved_errno; +} + +PyDoc_STRVAR(install_sigchld_handler_doc, "\ +install_sigchld_handler(fd)\n\ +\n\ +Installs a SIGCHLD handler which will write a byte to the given fd\n\ +whenever a SIGCHLD occurs. This is done in C code because the python\n\ +signal handling system is not reliable, and additionally cannot\n\ +specify SA_RESTART.\n\ +\n\ +Please ensure fd is in non-blocking mode.\n\ +"); + +static PyObject * +install_sigchld_handler(PyObject *self, PyObject *args) { + int fd, old_fd; + struct sigaction sa; + + if (!PyArg_ParseTuple(args, "i:install_sigchld_handler", &fd)) { + return NULL; + } + old_fd = sigchld_pipe_fd; + sigchld_pipe_fd = fd; + + if (fd == -1) { + sa.sa_handler = SIG_DFL; + } else { + sa.sa_handler = got_signal; + sa.sa_flags = SA_RESTART; + /* mask all signals so I don't worry about EINTR from the write. */ + sigfillset(&sa.sa_mask); + } + if (sigaction(SIGCHLD, &sa, 0) != 0) { + sigchld_pipe_fd = old_fd; + return PyErr_SetFromErrno(PyExc_OSError); + } + return PyLong_FromLong(old_fd); +} + +PyDoc_STRVAR(is_default_handler_doc, "\ +Return 1 if the SIGCHLD handler is SIG_DFL, 0 otherwise.\n\ +"); + +static PyObject * +is_default_handler(PyObject *self, PyObject *args) { + /* + * This implementation is necessary since the install_sigchld_handler + * function above bypasses the Python signal handler installation API, so + * CPython doesn't notice that the handler has changed and signal.getsignal + * won't return an accurate result. + */ + struct sigaction sa; + + if (sigaction(SIGCHLD, NULL, &sa) != 0) { + return PyErr_SetFromErrno(PyExc_OSError); + } + + return PyLong_FromLong(sa.sa_handler == SIG_DFL); +} + +static PyMethodDef sigchld_methods[] = { + {"installHandler", install_sigchld_handler, METH_VARARGS, + install_sigchld_handler_doc}, + {"isDefaultHandler", is_default_handler, METH_NOARGS, + is_default_handler_doc}, + /* sentinel */ + {NULL, NULL, 0, NULL} +}; + + +static const char _sigchld_doc[] = "\n\ +This module contains an API for receiving SIGCHLD via a file descriptor.\n\ +"; + +PyMODINIT_FUNC +init_sigchld(void) { + /* Create the module and add the functions */ + Py_InitModule3( + "twisted.internet._sigchld", sigchld_methods, _sigchld_doc); +} diff --git a/vendor/Twisted-10.0.0/twisted/internet/_signals.py b/vendor/Twisted-10.0.0/twisted/internet/_signals.py new file mode 100644 index 000000000..faf2e2445 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/internet/_signals.py @@ -0,0 +1,184 @@ +# -*- test-case-name: twisted.test.test_process,twisted.internet.test.test_process -*- +# Copyright (c) 2010 Twisted Matrix Laboratories. +# See LICENSE for details. + +""" +This module provides a uniform interface to the several mechanisms which are +possibly available for dealing with signals. + +This module is used to integrate child process termination into a +reactor event loop. This is a challenging feature to provide because +most platforms indicate process termination via SIGCHLD and do not +provide a way to wait for that signal and arbitrary I/O events at the +same time. The naive implementation involves installing a Python +SIGCHLD handler; unfortunately this leads to other syscalls being +interrupted (whenever SIGCHLD is received) and failing with EINTR +(which almost no one is prepared to handle). This interruption can be +disabled via siginterrupt(2) (or one of the equivalent mechanisms); +however, if the SIGCHLD is delivered by the platform to a non-main +thread (not a common occurrence, but difficult to prove impossible), +the main thread (waiting on select() or another event notification +API) may not wake up leading to an arbitrary delay before the child +termination is noticed. + +The basic solution to all these issues involves enabling SA_RESTART +(ie, disabling system call interruption) and registering a C signal +handler which writes a byte to a pipe. The other end of the pipe is +registered with the event loop, allowing it to wake up shortly after +SIGCHLD is received. See L{twisted.internet.posixbase._SIGCHLDWaker} +for the implementation of the event loop side of this solution. The +use of a pipe this way is known as the U{self-pipe +trick}. + +The actual solution implemented in this module depends on the version +of Python. From version 2.6, C{signal.siginterrupt} and +C{signal.set_wakeup_fd} allow the necessary C signal handler which +writes to the pipe to be registered with C{SA_RESTART}. Prior to 2.6, +the L{twisted.internet._sigchld} extension module provides similar +functionality. + +If neither of these is available, a Python signal handler is used +instead. This is essentially the naive solution mentioned above and +has the problems described there. +""" + +import os + +try: + from signal import set_wakeup_fd, siginterrupt +except ImportError: + set_wakeup_fd = siginterrupt = None + +try: + import signal +except ImportError: + signal = None + +from twisted.python.log import msg + +try: + from twisted.internet._sigchld import installHandler as _extInstallHandler, \ + isDefaultHandler as _extIsDefaultHandler +except ImportError: + _extInstallHandler = _extIsDefaultHandler = None + + +class _Handler(object): + """ + L{_Handler} is a signal handler which writes a byte to a file descriptor + whenever it is invoked. + + @ivar fd: The file descriptor to which to write. If this is C{None}, + nothing will be written. + """ + def __init__(self, fd): + self.fd = fd + + + def __call__(self, *args): + """ + L{_Handler.__call__} is the signal handler. It will write a byte to + the wrapped file descriptor, if there is one. + """ + if self.fd is not None: + try: + os.write(self.fd, '\0') + except: + pass + + + +def _installHandlerUsingSignal(fd): + """ + Install a signal handler which will write a byte to C{fd} when + I{SIGCHLD} is received. + + This is implemented by creating an instance of L{_Handler} with C{fd} + and installing it as the signal handler. + + @param fd: The file descriptor to which to write when I{SIGCHLD} is + received. + @type fd: C{int} + """ + if fd == -1: + previous = signal.signal(signal.SIGCHLD, signal.SIG_DFL) + else: + previous = signal.signal(signal.SIGCHLD, _Handler(fd)) + if isinstance(previous, _Handler): + return previous.fd + return -1 + + + +def _installHandlerUsingSetWakeup(fd): + """ + Install a signal handler which will write a byte to C{fd} when + I{SIGCHLD} is received. + + This is implemented by installing an instance of L{_Handler} wrapped + around C{None}, setting the I{SIGCHLD} handler as not allowed to + interrupt system calls, and using L{signal.set_wakeup_fd} to do the + actual writing. + + @param fd: The file descriptor to which to write when I{SIGCHLD} is + received. + @type fd: C{int} + """ + if fd == -1: + signal.signal(signal.SIGCHLD, signal.SIG_DFL) + else: + signal.signal(signal.SIGCHLD, _Handler(None)) + siginterrupt(signal.SIGCHLD, False) + return set_wakeup_fd(fd) + + + +def _isDefaultHandler(): + """ + Determine whether the I{SIGCHLD} handler is the default or not. + """ + return signal.getsignal(signal.SIGCHLD) == signal.SIG_DFL + + + +def _cannotInstallHandler(fd): + """ + Fail to install a signal handler for I{SIGCHLD}. + + This implementation is used when the supporting code for the other + implementations is unavailable (on Python versions 2.5 and older where + neither the L{twisted.internet._sigchld} extension nor the standard + L{signal} module is available). + + @param fd: Ignored; only for compatibility with the other + implementations of this interface. + + @raise RuntimeError: Always raised to indicate no I{SIGCHLD} handler can + be installed. + """ + raise RuntimeError("Cannot install a SIGCHLD handler") + + + +def _cannotDetermineDefault(): + raise RuntimeError("No usable signal API available") + + + +if set_wakeup_fd is not None: + msg('using set_wakeup_fd') + installHandler = _installHandlerUsingSetWakeup + isDefaultHandler = _isDefaultHandler +elif _extInstallHandler is not None: + msg('using _sigchld') + installHandler = _extInstallHandler + isDefaultHandler = _extIsDefaultHandler +elif signal is not None: + msg('using signal module') + installHandler = _installHandlerUsingSignal + isDefaultHandler = _isDefaultHandler +else: + msg('nothing unavailable') + installHandler = _cannotInstallHandler + isDefaultHandler = _cannotDetermineDefault + diff --git a/vendor/Twisted-10.0.0/twisted/internet/test/test_sigchld.py b/vendor/Twisted-10.0.0/twisted/internet/test/test_sigchld.py new file mode 100644 index 000000000..b7e492127 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/internet/test/test_sigchld.py @@ -0,0 +1,194 @@ +# Copyright (c) 2010 Twisted Matrix Laboratories. +# See LICENSE for details. + +""" +Tests for L{twisted.internet._sigchld}, an alternate, superior SIGCHLD +monitoring API. +""" + +import os, signal, errno + +from twisted.python.log import msg +from twisted.trial.unittest import TestCase +from twisted.internet.fdesc import setNonBlocking +from twisted.internet._signals import installHandler, isDefaultHandler +from twisted.internet._signals import _extInstallHandler, _extIsDefaultHandler +from twisted.internet._signals import _installHandlerUsingSetWakeup, \ + _installHandlerUsingSignal, _isDefaultHandler + + +class SIGCHLDTestsMixin: + """ + Mixin for L{TestCase} subclasses which defines several tests for + I{installHandler} and I{isDefaultHandler}. Subclasses are expected to + define C{self.installHandler} and C{self.isDefaultHandler} to invoke the + implementation to be tested. + """ + + if getattr(signal, 'SIGCHLD', None) is None: + skip = "Platform does not have SIGCHLD" + + def installHandler(self, fd): + """ + Override in a subclass to install a SIGCHLD handler which writes a byte + to the given file descriptor. Return the previously registered file + descriptor. + """ + raise NotImplementedError() + + + def isDefaultHandler(self): + """ + Override in a subclass to determine if the current SIGCHLD handler is + SIG_DFL or not. Return True if it is SIG_DFL, False otherwise. + """ + raise NotImplementedError() + + + def pipe(self): + """ + Create a non-blocking pipe which will be closed after the currently + running test. + """ + read, write = os.pipe() + self.addCleanup(os.close, read) + self.addCleanup(os.close, write) + setNonBlocking(read) + setNonBlocking(write) + return read, write + + + def setUp(self): + """ + Save the current SIGCHLD handler as reported by L{signal.signal} and + the current file descriptor registered with L{installHandler}. + """ + handler = signal.getsignal(signal.SIGCHLD) + if handler != signal.SIG_DFL: + self.signalModuleHandler = handler + signal.signal(signal.SIGCHLD, signal.SIG_DFL) + else: + self.signalModuleHandler = None + + self.oldFD = self.installHandler(-1) + + if self.signalModuleHandler is not None and self.oldFD != -1: + msg("SIGCHLD setup issue: %r %r" % (self.signalModuleHandler, self.oldFD)) + raise RuntimeError("You used some signal APIs wrong! Try again.") + + + def tearDown(self): + """ + Restore whatever signal handler was present when setUp ran. + """ + # If tests set up any kind of handlers, clear them out. + self.installHandler(-1) + signal.signal(signal.SIGCHLD, signal.SIG_DFL) + + # Now restore whatever the setup was before the test ran. + if self.signalModuleHandler is not None: + signal.signal(signal.SIGCHLD, self.signalModuleHandler) + elif self.oldFD != -1: + self.installHandler(self.oldFD) + + + def test_isDefaultHandler(self): + """ + L{isDefaultHandler} returns true if the SIGCHLD handler is SIG_DFL, + false otherwise. + """ + self.assertTrue(self.isDefaultHandler()) + signal.signal(signal.SIGCHLD, signal.SIG_IGN) + self.assertFalse(self.isDefaultHandler()) + signal.signal(signal.SIGCHLD, signal.SIG_DFL) + self.assertTrue(self.isDefaultHandler()) + signal.signal(signal.SIGCHLD, lambda *args: None) + self.assertFalse(self.isDefaultHandler()) + + + def test_returnOldFD(self): + """ + L{installHandler} returns the previously registered file descriptor. + """ + read, write = self.pipe() + oldFD = self.installHandler(write) + self.assertEqual(self.installHandler(oldFD), write) + + + def test_uninstallHandler(self): + """ + C{installHandler(-1)} removes the SIGCHLD handler completely. + """ + read, write = self.pipe() + self.assertTrue(self.isDefaultHandler()) + self.installHandler(write) + self.assertFalse(self.isDefaultHandler()) + self.installHandler(-1) + self.assertTrue(self.isDefaultHandler()) + + + def test_installHandler(self): + """ + The file descriptor passed to L{installHandler} has a byte written to + it when SIGCHLD is delivered to the process. + """ + read, write = self.pipe() + self.installHandler(write) + + exc = self.assertRaises(OSError, os.read, read, 1) + self.assertEqual(exc.errno, errno.EAGAIN) + + os.kill(os.getpid(), signal.SIGCHLD) + + self.assertEqual(len(os.read(read, 5)), 1) + + + +class DefaultSIGCHLDTests(SIGCHLDTestsMixin, TestCase): + """ + Tests for whatever implementation is selected for the L{installHandler} + and L{isDefaultHandler} APIs. + """ + installHandler = staticmethod(installHandler) + isDefaultHandler = staticmethod(isDefaultHandler) + + + +class ExtensionSIGCHLDTests(SIGCHLDTestsMixin, TestCase): + """ + Tests for the L{twisted.internet._sigchld} implementation of the + L{installHandler} and L{isDefaultHandler} APIs. + """ + try: + import twisted.internet._sigchld + except ImportError: + skip = "twisted.internet._sigchld is not available" + + installHandler = _extInstallHandler + isDefaultHandler = _extIsDefaultHandler + + + +class SetWakeupSIGCHLDTests(SIGCHLDTestsMixin, TestCase): + """ + Tests for the L{signal.set_wakeup_fd} implementation of the + L{installHandler} and L{isDefaultHandler} APIs. + """ + # Check both of these. On Ubuntu 9.10 (to take an example completely at + # random), Python 2.5 has set_wakeup_fd but not siginterrupt. + if (getattr(signal, 'set_wakeup_fd', None) is None + or getattr(signal, 'siginterrupt', None) is None): + skip = "signal.set_wakeup_fd is not available" + + installHandler = staticmethod(_installHandlerUsingSetWakeup) + isDefaultHandler = staticmethod(_isDefaultHandler) + + + +class PlainSignalModuleSIGCHLDTests(SIGCHLDTestsMixin, TestCase): + """ + Tests for the L{signal.signal} implementation of the L{installHandler} + and L{isDefaultHandler} APIs. + """ + installHandler = staticmethod(_installHandlerUsingSignal) + isDefaultHandler = staticmethod(_isDefaultHandler) diff --git a/vendor/Twisted-10.0.0/twisted/topfiles/733.bugfix b/vendor/Twisted-10.0.0/twisted/topfiles/733.bugfix new file mode 100644 index 000000000..22d80032c --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/topfiles/733.bugfix @@ -0,0 +1,4 @@ +On POSIX platforms, reactors now support child processes in a way +which doesn't cause other syscalls to sometimes fail with EINTR (if +running on Python 2.6 or if Twisted's extension modules have been +built). -- cgit From 8572e639ac681b9efe408821d9da19aa8d6e0bc9 Mon Sep 17 00:00:00 2001 From: Devin Carlen Date: Wed, 23 Jun 2010 21:19:08 -0700 Subject: Added flags to smoketests. General cleanup --- smoketests/README | 6 --- smoketests/__init__.py | 30 +++++++++++ smoketests/flags.py | 42 +++++++++++++++ smoketests/novatestcase.py | 74 +++++++++++++------------ smoketests/smoketest.py | 132 ++++++++++++++++++++++++++++----------------- 5 files changed, 195 insertions(+), 89 deletions(-) delete mode 100644 smoketests/README create mode 100644 smoketests/__init__.py create mode 100644 smoketests/flags.py diff --git a/smoketests/README b/smoketests/README deleted file mode 100644 index 1a357c672..000000000 --- a/smoketests/README +++ /dev/null @@ -1,6 +0,0 @@ -a test suite to run against a deployed cloud - -THIS IS NASA CODE! - -It will need to be opensourced by the NASA legal process before it is in the open source -release diff --git a/smoketests/__init__.py b/smoketests/__init__.py new file mode 100644 index 000000000..907545460 --- /dev/null +++ b/smoketests/__init__.py @@ -0,0 +1,30 @@ +# 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. +# +# 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. + +""" +:mod:`smoketests` -- Nova Integration "Smoke" Tests +===================================================== + +.. automodule:: nova.volume + :platform: Unix +.. moduleauthor:: Jesse Andrews +.. moduleauthor:: Devin Carlen +.. moduleauthor:: Vishvananda Ishaya +.. moduleauthor:: Joshua McKenty +.. moduleauthor:: Manish Singh +.. moduleauthor:: Andy Smith +""" \ No newline at end of file diff --git a/smoketests/flags.py b/smoketests/flags.py new file mode 100644 index 000000000..7c35f5253 --- /dev/null +++ b/smoketests/flags.py @@ -0,0 +1,42 @@ +# 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. +# +# 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 + +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') diff --git a/smoketests/novatestcase.py b/smoketests/novatestcase.py index e046fc488..306e2320d 100644 --- a/smoketests/novatestcase.py +++ b/smoketests/novatestcase.py @@ -1,25 +1,33 @@ -# COPYRIGHT NASA - -import os, unittest, sys -from commands import getstatusoutput -from paramiko import SSHClient, RSAKey, WarningPolicy +# 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. +# +# 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. + +import commands +import os import random +import sys +import unittest -BUCKET_NAME = 'smoketest' +from nova.adminclient import NovaAdminClient +from nova.smoketests import flags -try: - # pulling from environment means euca-bundle and other shell commands - # are runable without futzing with the environment and zip files - access_key = os.environ['EC2_ACCESS_KEY'] - secret_key = os.environ['EC2_SECRET_KEY'] - endpoint = os.environ['EC2_URL'] - host = endpoint.split('/')[2].split(':')[0] # http://HOST:8773/services/Cloud -except: - print 'you need to source admin rc before running smoketests' - sys.exit(2) +from nova import vendor +import paramiko -from nova.adminclient import NovaAdminClient -admin = NovaAdminClient(access_key=access_key, secret_key=secret_key, clc_ip=host) +nova_admin = NovaAdminClient(access_key=flags.admin_access_key, secret_key=flags.admin_secret_key, clc_ip=host) class NovaTestCase(unittest.TestCase): def setUp(self): @@ -29,37 +37,37 @@ class NovaTestCase(unittest.TestCase): pass def connect_ssh(self, ip, key_name): - # TODO: set a more reasonable connection timeout time - key = RSAKey.from_private_key_file('/tmp/%s.pem' % key_name) - client = SSHClient() + # TODO(devcamcar): set a more reasonable connection timeout time + key = paramiko.RSAKey.from_private_key_file('/tmp/%s.pem' % key_name) + client = paramiko.SSHClient() client.load_system_host_keys() - client.set_missing_host_key_policy(WarningPolicy()) + client.set_missing_host_key_policy(paramiko.WarningPolicy()) client.connect(ip, username='root', pkey=key) stdin, stdout, stderr = client.exec_command('uptime') print 'uptime: ', stdout.read() return client def can_ping(self, ip): - return getstatusoutput('ping -c 1 %s' % ip)[0] == 0 + return commands.getstatusoutput('ping -c 1 %s' % ip)[0] == 0 @property def admin(self): - return admin.connection_for('admin') + return nova_admin.connection_for('admin') def connection_for(self, username): - return admin.connection_for(username) + return nova_admin.connection_for(username) def create_user(self, username): - return admin.create_user(username) + return nova_admin.create_user(username) def get_user(self, username): - return admin.get_user(username) + return nova_admin.get_user(username) def delete_user(self, username): - return admin.delete_user(username) + return nova_admin.delete_user(username) def get_signed_zip(self, username): - return admin.get_zip(username) + return nova_admin.get_zip(username) def create_key_pair(self, conn, key_name): try: @@ -81,7 +89,7 @@ class NovaTestCase(unittest.TestCase): cmd = 'euca-bundle-image -i %s' % image if kernel: cmd += ' --kernel true' - status, output = getstatusoutput(cmd) + status, output = commands.getstatusoutput(cmd) if status != 0: print '%s -> \n %s' % (cmd, output) raise Exception(output) @@ -89,7 +97,7 @@ class NovaTestCase(unittest.TestCase): def upload_image(self, bucket_name, image): cmd = 'euca-upload-bundle -b %s -m /tmp/%s.manifest.xml' % (bucket_name, image) - status, output = getstatusoutput(cmd) + status, output = commands.getstatusoutput(cmd) if status != 0: print '%s -> \n %s' % (cmd, output) raise Exception(output) @@ -97,14 +105,14 @@ class NovaTestCase(unittest.TestCase): def delete_bundle_bucket(self, bucket_name): cmd = 'euca-delete-bundle --clear -b %s' % (bucket_name) - status, output = getstatusoutput(cmd) + status, output = commands.getstatusoutput(cmd) if status != 0: print '%s -> \n%s' % (cmd, output) raise Exception(output) return True def register_image(self, bucket_name, manifest): - conn = admin.connection_for('admin') + conn = nova_admin.connection_for('admin') return conn.register_image("%s/%s.manifest.xml" % (bucket_name, manifest)) def setUp_test_image(self, image, kernel=False): diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index aa03037de..ba8a7764a 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -1,19 +1,43 @@ -# COPYRIGHT NASA - -import os, re, sys, time, unittest, random -from novatestcase import NovaTestCase -from commands import getstatusoutput -from paramiko import SSHException -from zipfile import ZipFile, ZIP_DEFLATED - -# TODO: Make endpoint configurable - -DEBUG = True - -KERNEL_FILENAME = 'openwrt-x86-vmlinuz' -IMAGE_FILENAME = 'openwrt-x86-ext2.image' - -ZIP_FILENAME = '/tmp/nova-x509.zip' +# 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. +# +# 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. + +import commands +import os +import random +import re +import sys +import time +import unittest +import zipfile + +from nova.smoketests import flags +from nova.smoketests.novatestcase import NovaTestCase + +from nova import vendor +import paramiko + +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', + 'Local image file to use for bundling tests') + +# TODO(devamcar): Use random tempfile +ZIP_FILENAME = '/tmp/euca-me-x509.zip' data = {} @@ -38,7 +62,7 @@ class UserTests(NovaTestCase): output.write(buf) output.close() - zip = ZipFile(ZIP_FILENAME, 'a', ZIP_DEFLATED) + zip = zipfile.ZipFile(ZIP_FILENAME, 'a', zipfile.ZIP_DEFLATED) bad = zip.testzip() zip.close() @@ -70,14 +94,14 @@ class ImageTests(NovaTestCase): data['image_id'] = image_id def test_004_admin_can_bundle_kernel(self): - self.assertTrue(self.bundle_image(KERNEL_FILENAME, 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, KERNEL_FILENAME)) + self.assertTrue(self.upload_image(test_bucket, flags.bundle_kernel)) def test_006_admin_can_register_kernel(self): - # FIXME: registeration should verify that bucket/manifest exists before returning successfully! - kernel_id = self.register_image(test_bucket, KERNEL_FILENAME) + # FIXME: 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 @@ -101,56 +125,61 @@ class ImageTests(NovaTestCase): self.assert_(False) # wasn't available within 10 seconds self.assert_(kernel.type == 'kernel') - def test_008_images_not_public_by_default(self): + def test_008_admin_can_describe_image_attribute(self): + 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): conn = self.connection_for(test_username) images = conn.get_all_images(image_ids=[data['image_id']]) self.assertEqual(len(images), 0) - images = conn.get_all_images(image_ids=[data['kernel_id']]) - self.assertEqual(len(images), 0) - def test_009_images_can_be_made_public(self): - userconn = self.connection_for(test_username) + def test_010_admin_can_modify_image_launch_permission(self): + conn = self.connection_for(test_username) self.admin.modify_image_attribute(image_id=data['image_id'], operation='add', attribute='launchPermission', groups='all') - image = userconn.get_image(data['image_id']) + image = conn.get_image(data['image_id']) self.assertEqual(image.id, data['image_id']) - self.admin.modify_image_attribute(image_id=data['kernel_id'], - operation='add', - attribute='launchPermission', - groups='all') - - image = userconn.get_image(data['kernel_id']) - self.assertEqual(image.id, data['kernel_id']) - + def test_011_me_can_list_public_images(self): + conn = self.connection_for(test_username) + images = conn.get_all_images(image_ids=[data['image_id']]) + self.assertEqual(len(images), 1) + pass + + 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') + # FIXME: add tests that user can launch image -# def test_010_user_can_launch_admin_public_image(self): +# def test_013_user_can_launch_admin_public_image(self): # # TODO: Use openwrt kernel instead of default kernel # conn = self.connection_for(test_username) # reservation = conn.run_instances(data['image_id']) # self.assertEqual(len(reservation.instances), 1) # data['my_instance_id'] = reservation.instances[0].id -# def test_011_instances_launch_within_30_seconds(self): +# def test_014_instances_launch_within_30_seconds(self): # pass -# def test_012_user_can_terminate(self): +# def test_015_user_can_terminate(self): # conn = self.connection_for(test_username) # terminated = conn.terminate_instances(instance_ids=[data['my_instance_id']]) # self.assertEqual(len(terminated), 1) - def test_013_admin_can_deregister_kernel(self): + def test_016_admin_can_deregister_kernel(self): self.assertTrue(self.admin.deregister_image(data['kernel_id'])) - def test_014_admin_can_deregister_image(self): + def test_017_admin_can_deregister_image(self): self.assertTrue(self.admin.deregister_image(data['image_id'])) - def test_015_admin_can_delete_bundle(self): + def test_018_admin_can_delete_bundle(self): self.assertTrue(self.delete_bundle_bucket(test_bucket)) def test_999_tearDown(self): @@ -202,13 +231,13 @@ class SecurityTests(NovaTestCase): def test_005_can_ping_private_ip(self): for x in xrange(120): # ping waits for 1 second - status, output = 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") #def test_005_me_cannot_ssh_when_unauthorized(self): - # self.assertRaises(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') @@ -246,7 +275,7 @@ class SecurityTests(NovaTestCase): try: conn = self.connect_ssh(data['my_private_ip'], test_key + 'yourkey') conn.close() - except SSHException: + except paramiko.SSHException: pass else: self.fail("expected SSHException") @@ -274,7 +303,7 @@ class SecurityTests(NovaTestCase): # build a script to bundle the instance # build a script to upload the bundle -# status, output = getstatusoutput('cmd') +# status, output = commands.getstatusoutput('cmd') # if status == 0: # print 'ok' # else: @@ -321,10 +350,13 @@ class RebundlingTests(NovaTestCase): image = conn.get_image(data['my_image_id']) self.assertEqual(image, None) -# def test_006_me_can_make_image_public(self): -# # TODO: research this -# self.assert_(False) -# + 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') + def test_007_you_can_see_my_public_image(self): conn = self.connection_for('you') image = conn.get_image(data['my_image_id']) @@ -401,7 +433,7 @@ class VolumeTests(NovaTestCase): # wait for instance to show up for x in xrange(120): # ping waits for 1 second - status, output = getstatusoutput("ping -c1 -w1 %s" % data['private_ip']) + status, output = commands.getstatusoutput("ping -c1 -w1 %s" % data['private_ip']) if status == 0: break else: -- cgit From caeece6e3783692dd6af6e3bec092eddb2b3e2fc Mon Sep 17 00:00:00 2001 From: Devin Carlen Date: Wed, 23 Jun 2010 22:04:16 -0700 Subject: Updated licenses --- bin/nova-api | 29 +++++++++++++---------- bin/nova-compute | 23 +++++++++++-------- bin/nova-instancemonitor | 29 +++++++++++++---------- bin/nova-manage | 23 +++++++++++-------- bin/nova-objectstore | 29 +++++++++++++---------- bin/nova-volume | 33 +++++++++++++++------------ builddeb.sh | 30 ++++++++++++++---------- docs/architecture.rst | 26 ++++++++++++--------- docs/auth.rst | 26 ++++++++++++--------- docs/binaries.rst | 26 ++++++++++++--------- docs/compute.rst | 26 ++++++++++++--------- docs/endpoint.rst | 26 ++++++++++++--------- docs/fakes.rst | 26 ++++++++++++--------- docs/getting.started.rst | 20 +++++++++------- docs/index.rst | 27 ++++++++++++---------- docs/modules.rst | 26 ++++++++++++--------- docs/network.rst | 26 ++++++++++++--------- docs/nova.rst | 26 ++++++++++++--------- docs/objectstore.rst | 26 ++++++++++++--------- docs/packages.rst | 26 ++++++++++++--------- docs/storage.rst | 26 ++++++++++++--------- docs/volume.rst | 26 ++++++++++++--------- nova/__init__.py | 30 ++++++++++++++---------- nova/adminclient.py | 25 ++++++++++++-------- nova/auth/__init__.py | 31 ++++++++++++++----------- nova/auth/fakeldap.py | 24 +++++++++++-------- nova/auth/novarc.template | 24 +++++++++++-------- nova/auth/rbac.py | 20 ++++++++++++++++ nova/auth/signer.py | 32 +++++++++++++++----------- nova/auth/slap.sh | 25 ++++++++++++-------- nova/auth/users.py | 23 +++++++++++-------- nova/cloudpipe/__init__.py | 23 +++++++++++-------- nova/cloudpipe/api.py | 24 +++++++++++-------- nova/cloudpipe/bootscript.sh | 24 +++++++++++-------- nova/cloudpipe/client.ovpn.template | 24 +++++++++++-------- nova/cloudpipe/pipelib.py | 24 +++++++++++-------- nova/compute/__init__.py | 30 ++++++++++++++---------- nova/compute/disk.py | 23 +++++++++++-------- nova/compute/exception.py | 30 ++++++++++++++---------- nova/compute/fakevirtinstance.xml | 30 +++++++++++++----------- nova/compute/libvirt.xml.template | 30 +++++++++++++----------- nova/compute/linux_net.py | 18 +++++++++++++++ nova/compute/model.py | 23 +++++++++++-------- nova/compute/monitor.py | 23 +++++++++++-------- nova/compute/network.py | 23 +++++++++++-------- nova/compute/node.py | 23 +++++++++++-------- nova/crypto.py | 23 +++++++++++-------- nova/datastore.py | 22 ++++++++++-------- nova/endpoint/__init__.py | 30 ++++++++++++++---------- nova/endpoint/admin.py | 23 +++++++++++-------- nova/endpoint/api.py | 24 +++++++++++-------- nova/endpoint/cloud.py | 23 +++++++++++-------- nova/endpoint/images.py | 23 +++++++++++-------- nova/exception.py | 23 +++++++++++-------- nova/fakerabbit.py | 23 +++++++++++-------- nova/fakevirt.py | 23 +++++++++++-------- nova/flags.py | 23 +++++++++++-------- nova/objectstore/__init__.py | 30 ++++++++++++++---------- nova/objectstore/bucket.py | 23 +++++++++++-------- nova/objectstore/handler.py | 26 +++++++++++++-------- nova/objectstore/image.py | 23 +++++++++++-------- nova/objectstore/stored.py | 30 ++++++++++++++---------- nova/process.py | 23 +++++++++++-------- nova/rpc.py | 23 +++++++++++-------- nova/server.py | 29 +++++++++++++---------- nova/test.py | 23 +++++++++++-------- nova/tests/__init__.py | 30 ++++++++++++++---------- nova/tests/access_unittest.py | 23 +++++++++++-------- nova/tests/api_integration.py | 24 +++++++++++-------- nova/tests/api_unittest.py | 23 +++++++++++-------- nova/tests/cloud_unittest.py | 23 +++++++++++-------- nova/tests/datastore_unittest.py | 20 ++++++++++++++++ nova/tests/fake_flags.py | 30 ++++++++++++++---------- nova/tests/future_unittest.py | 29 +++++++++++++---------- nova/tests/keeper_unittest.py | 19 +++++++++++++++ nova/tests/network_unittest.py | 23 +++++++++++-------- nova/tests/node_unittest.py | 23 +++++++++++-------- nova/tests/objectstore_unittest.py | 23 +++++++++++-------- nova/tests/process_unittest.py | 23 +++++++++++-------- nova/tests/real_flags.py | 30 ++++++++++++++---------- nova/tests/storage_unittest.py | 23 +++++++++++-------- nova/tests/users_unittest.py | 23 +++++++++++-------- nova/tests/validator_unittest.py | 23 +++++++++++-------- nova/twistd.py | 29 +++++++++++++---------- nova/utils.py | 29 +++++++++++++---------- nova/validate.py | 23 +++++++++++-------- nova/vendor.py | 29 +++++++++++++---------- nova/volume/__init__.py | 30 ++++++++++++++---------- nova/volume/storage.py | 23 +++++++++++-------- run_tests.py | 23 +++++++++++-------- setup.py | 31 ++++++++++++++----------- smoketests/__init__.py | 25 +++++++++++--------- smoketests/flags.py | 25 +++++++++++--------- smoketests/novatestcase.py | 25 +++++++++++--------- smoketests/smoketest.py | 25 +++++++++++--------- tools/clean-vlans | 19 +++++++++++++++ vendor/tornado/demos/appengine/blog.py | 18 +++++++-------- vendor/tornado/demos/auth/authdemo.py | 18 +++++++-------- vendor/tornado/demos/blog/blog.py | 18 +++++++-------- vendor/tornado/demos/chat/chatdemo.py | 18 +++++++-------- vendor/tornado/demos/facebook/facebook.py | 18 +++++++-------- vendor/tornado/demos/facebook/uimodules.py | 18 +++++++-------- vendor/tornado/demos/helloworld/helloworld.py | 18 +++++++-------- vendor/tornado/setup.py | 18 +++++++-------- vendor/tornado/tornado/__init__.py | 18 +++++++-------- vendor/tornado/tornado/auth.py | 18 +++++++-------- vendor/tornado/tornado/autoreload.py | 18 +++++++-------- vendor/tornado/tornado/database.py | 18 +++++++-------- vendor/tornado/tornado/escape.py | 18 +++++++-------- vendor/tornado/tornado/httpclient.py | 18 +++++++-------- vendor/tornado/tornado/httpserver.py | 18 +++++++-------- vendor/tornado/tornado/ioloop.py | 18 +++++++-------- vendor/tornado/tornado/iostream.py | 18 +++++++-------- vendor/tornado/tornado/locale.py | 18 +++++++-------- vendor/tornado/tornado/options.py | 18 +++++++-------- vendor/tornado/tornado/s3server.py | 18 +++++++-------- vendor/tornado/tornado/template.py | 18 +++++++-------- vendor/tornado/tornado/web.py | 18 +++++++-------- vendor/tornado/tornado/websocket.py | 18 +++++++-------- vendor/tornado/tornado/wsgi.py | 18 +++++++-------- vendor/tornado/website/website.py | 18 +++++++-------- 121 files changed, 1707 insertions(+), 1168 deletions(-) diff --git a/bin/nova-api b/bin/nova-api index 8fea1da4d..5ea49692c 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -1,19 +1,24 @@ #!/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. + """ Tornado daemon for the main API endpoint. """ diff --git a/bin/nova-compute b/bin/nova-compute index f89bc86b1..b1a6354b8 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -1,19 +1,24 @@ #!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] +# Copyright 2010 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. # -# 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 +# Copyright 2010 Anso Labs, LLC # -# http://www.apache.org/licenses/LICENSE-2.0 +# 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. + """ Twistd daemon for the nova compute nodes. Receives messages via AMQP, manages pool of worker threads diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor index 2cfd5fc35..d21732a15 100755 --- a/bin/nova-instancemonitor +++ b/bin/nova-instancemonitor @@ -1,19 +1,24 @@ #!/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. + """ Daemon for Nova RRD based instance resource monitoring. """ diff --git a/bin/nova-manage b/bin/nova-manage index d25de6cda..c9f36ad32 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -1,19 +1,24 @@ #!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] +# Copyright 2010 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. # -# 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 +# Copyright 2010 Anso Labs, LLC # -# http://www.apache.org/licenses/LICENSE-2.0 +# 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. + """ CLI interface for nova management. Connects to the running ADMIN api in the api daemon. diff --git a/bin/nova-objectstore b/bin/nova-objectstore index 38a23f1ff..26dcd2676 100755 --- a/bin/nova-objectstore +++ b/bin/nova-objectstore @@ -1,19 +1,24 @@ #!/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. + """ Tornado daemon for nova objectstore. Supports S3 API. """ diff --git a/bin/nova-volume b/bin/nova-volume index e36954cd3..f3f8cb9a4 100755 --- a/bin/nova-volume +++ b/bin/nova-volume @@ -1,19 +1,24 @@ #!/usr/bin/env python -# vim: tabstop=4 shiftwidth=4 softtabstop - -# 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 -# +# 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. +# 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. + """ Tornado Storage daemon manages AoE volumes via AMQP messaging. """ diff --git a/builddeb.sh b/builddeb.sh index 88e1477d7..5055dd332 100755 --- a/builddeb.sh +++ b/builddeb.sh @@ -1,16 +1,22 @@ #!/bin/sh -# 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 -# +# 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. +# 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. dpkg-buildpackage -b -rfakeroot -tc -uc -D diff --git a/docs/architecture.rst b/docs/architecture.rst index 9aab7afbf..0000a02dd 100644 --- a/docs/architecture.rst +++ b/docs/architecture.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. nova System Architecture ======================== diff --git a/docs/auth.rst b/docs/auth.rst index ba001cfec..c906a481f 100644 --- a/docs/auth.rst +++ b/docs/auth.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. Auth Documentation ================== diff --git a/docs/binaries.rst b/docs/binaries.rst index eee089164..fa6127bb7 100644 --- a/docs/binaries.rst +++ b/docs/binaries.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. Nova Binaries =============== diff --git a/docs/compute.rst b/docs/compute.rst index e2b32fae0..7b4f82a3b 100644 --- a/docs/compute.rst +++ b/docs/compute.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. Compute Documentation ===================== diff --git a/docs/endpoint.rst b/docs/endpoint.rst index 86a1a3be0..830c99665 100644 --- a/docs/endpoint.rst +++ b/docs/endpoint.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. Endpoint Documentation ====================== diff --git a/docs/fakes.rst b/docs/fakes.rst index f105c6b8d..1454ca7b5 100644 --- a/docs/fakes.rst +++ b/docs/fakes.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. Nova Fakes ========== diff --git a/docs/getting.started.rst b/docs/getting.started.rst index 8e3848113..ffa396e08 100644 --- a/docs/getting.started.rst +++ b/docs/getting.started.rst @@ -1,17 +1,21 @@ .. - Copyright [2010] [Anso Labs, LLC] + Copyright 2010 United States Government as represented by the + Administrator of the National Aeronautics and Space Administration. + All Rights Reserved. - 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 + 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. Getting Started with Nova ========================= diff --git a/docs/index.rst b/docs/index.rst index b86f14324..9a5fa32ae 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,18 +1,21 @@ .. - 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 - + 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. + 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. Welcome to nova's documentation! ================================ diff --git a/docs/modules.rst b/docs/modules.rst index f927a52d0..11e1eef7d 100644 --- a/docs/modules.rst +++ b/docs/modules.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. Nova Documentation ================== diff --git a/docs/network.rst b/docs/network.rst index 49e36170d..2787ae458 100644 --- a/docs/network.rst +++ b/docs/network.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. nova Networking ================ diff --git a/docs/nova.rst b/docs/nova.rst index 7f1feda10..01da34414 100644 --- a/docs/nova.rst +++ b/docs/nova.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. NOVA Libraries =============== diff --git a/docs/objectstore.rst b/docs/objectstore.rst index 64122c9b7..70048354a 100644 --- a/docs/objectstore.rst +++ b/docs/objectstore.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. Objectstore Documentation ========================= diff --git a/docs/packages.rst b/docs/packages.rst index ad1386f19..fb28e850b 100644 --- a/docs/packages.rst +++ b/docs/packages.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. nova Packages & Dependencies ============================ diff --git a/docs/storage.rst b/docs/storage.rst index 94d7bdeea..f8c98b18d 100644 --- a/docs/storage.rst +++ b/docs/storage.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. Storage in the Nova Cloud ========================= diff --git a/docs/volume.rst b/docs/volume.rst index 18ce70a3a..3981daf92 100644 --- a/docs/volume.rst +++ b/docs/volume.rst @@ -1,17 +1,21 @@ .. - 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 - + 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. Volume Documentation ==================== diff --git a/nova/__init__.py b/nova/__init__.py index 2b25d1628..1151ee639 100644 --- a/nova/__init__.py +++ b/nova/__init__.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ :mod:`nova` -- Cloud IaaS Platform diff --git a/nova/adminclient.py b/nova/adminclient.py index 2cc592b9f..ef1ee03c0 100644 --- a/nova/adminclient.py +++ b/nova/adminclient.py @@ -1,17 +1,22 @@ -# Copyright [2010] [Anso Labs, LLC] +# 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 +# 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 +# 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. """ Nova User API client library. """ diff --git a/nova/auth/__init__.py b/nova/auth/__init__.py index 7cd6c618d..bfc5ef4d5 100644 --- a/nova/auth/__init__.py +++ b/nova/auth/__init__.py @@ -1,17 +1,22 @@ -# 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. +# 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. """ :mod:`nova.auth` -- Authentication and Access Control ===================================================== diff --git a/nova/auth/fakeldap.py b/nova/auth/fakeldap.py index feb2ac14a..13b2435dd 100644 --- a/nova/auth/fakeldap.py +++ b/nova/auth/fakeldap.py @@ -1,18 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Fake LDAP server for test harnesses. """ diff --git a/nova/auth/novarc.template b/nova/auth/novarc.template index ee1bc75f2..91a3c68c8 100644 --- a/nova/auth/novarc.template +++ b/nova/auth/novarc.template @@ -1,16 +1,22 @@ -# Copyright [2010] [Anso Labs, LLC] +# 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 +# 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 +# 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. NOVA_KEY_DIR=$(pushd $(dirname $BASH_SOURCE)>/dev/null; pwd; popd>/dev/null) export EC2_ACCESS_KEY="%(access)s:%(project)s" diff --git a/nova/auth/rbac.py b/nova/auth/rbac.py index 2283a7cd2..eb85a3de1 100644 --- a/nova/auth/rbac.py +++ b/nova/auth/rbac.py @@ -1,3 +1,23 @@ +# 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. + from nova import exception from nova.auth import users diff --git a/nova/auth/signer.py b/nova/auth/signer.py index 4b0169652..526a54262 100644 --- a/nova/auth/signer.py +++ b/nova/auth/signer.py @@ -1,17 +1,23 @@ -# 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. +# 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. +# # PORTIONS OF THIS FILE ARE FROM: # http://code.google.com/p/boto # Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ diff --git a/nova/auth/slap.sh b/nova/auth/slap.sh index 44a041d74..ac2af422f 100755 --- a/nova/auth/slap.sh +++ b/nova/auth/slap.sh @@ -1,18 +1,23 @@ #!/usr/bin/env bash -# Copyright [2010] [Anso Labs, LLC] +# 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 +# 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 +# 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. # LDAP INSTALL SCRIPT - SHOULD BE IDEMPOTENT, but it SCRUBS all USERS apt-get install -y slapd ldap-utils python-ldap diff --git a/nova/auth/users.py b/nova/auth/users.py index e165c3ff0..72c3c8466 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -1,18 +1,23 @@ #!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Nova users and user management, including RBAC hooks. diff --git a/nova/cloudpipe/__init__.py b/nova/cloudpipe/__init__.py index e8ac53976..5c35d696c 100644 --- a/nova/cloudpipe/__init__.py +++ b/nova/cloudpipe/__init__.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ :mod:`nova.cloudpipe` -- VPN Server Management diff --git a/nova/cloudpipe/api.py b/nova/cloudpipe/api.py index a8ecbd285..87283ef07 100644 --- a/nova/cloudpipe/api.py +++ b/nova/cloudpipe/api.py @@ -1,18 +1,22 @@ -#!/usr/bin/python # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Tornado REST API Request Handlers for CloudPipe diff --git a/nova/cloudpipe/bootscript.sh b/nova/cloudpipe/bootscript.sh index 7adacc067..312258c22 100755 --- a/nova/cloudpipe/bootscript.sh +++ b/nova/cloudpipe/bootscript.sh @@ -1,17 +1,23 @@ #!/bin/bash -# Copyright [2010] [Anso Labs, LLC] +# 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 +# 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 +# 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. # This gets zipped and run on the cloudpipe-managed OpenVPN server diff --git a/nova/cloudpipe/client.ovpn.template b/nova/cloudpipe/client.ovpn.template index d6cf8e19c..80b5dab26 100644 --- a/nova/cloudpipe/client.ovpn.template +++ b/nova/cloudpipe/client.ovpn.template @@ -1,16 +1,22 @@ -# Copyright [2010] [Anso Labs, LLC] +# 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 +# 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 +# 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. # NOVA user connection # Edit the following lines to point to your cert files: diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index adbea6878..106a31368 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -1,16 +1,22 @@ -# Copyright [2010] [Anso Labs, LLC] +# 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 +# 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 +# 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. """ CloudPipe - Build a user-data payload zip file, and launch diff --git a/nova/compute/__init__.py b/nova/compute/__init__.py index e8a6921e7..fe8d357a3 100644 --- a/nova/compute/__init__.py +++ b/nova/compute/__init__.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ :mod:`nova.compute` -- Compute Nodes using LibVirt diff --git a/nova/compute/disk.py b/nova/compute/disk.py index acaac89af..84329ae55 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Utility methods to resize, repartition, and modify disk images. diff --git a/nova/compute/exception.py b/nova/compute/exception.py index 6fe8e381f..829810bb0 100644 --- a/nova/compute/exception.py +++ b/nova/compute/exception.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ Exceptions for Compute Node errors, mostly network addressing. diff --git a/nova/compute/fakevirtinstance.xml b/nova/compute/fakevirtinstance.xml index 6036516bb..88cc623a8 100644 --- a/nova/compute/fakevirtinstance.xml +++ b/nova/compute/fakevirtinstance.xml @@ -1,18 +1,22 @@ +# 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. +--> i-A9B8C7D6 12a345bc-67c8-901d-2e34-56f7g89012h3 diff --git a/nova/compute/libvirt.xml.template b/nova/compute/libvirt.xml.template index 4cf6e8b10..9f40365a3 100644 --- a/nova/compute/libvirt.xml.template +++ b/nova/compute/libvirt.xml.template @@ -1,18 +1,22 @@ +# 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. +--> %(name)s diff --git a/nova/compute/linux_net.py b/nova/compute/linux_net.py index b9f775aa3..2ec1fe183 100644 --- a/nova/compute/linux_net.py +++ b/nova/compute/linux_net.py @@ -1,5 +1,23 @@ # 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. + import logging import signal import os diff --git a/nova/compute/model.py b/nova/compute/model.py index 74bf60a3b..cd5ab4047 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Datastore Model objects for Compute Instances, with diff --git a/nova/compute/monitor.py b/nova/compute/monitor.py index 4a3b43991..2d6911a89 100644 --- a/nova/compute/monitor.py +++ b/nova/compute/monitor.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Instance Monitoring: diff --git a/nova/compute/network.py b/nova/compute/network.py index acc153677..dc2ff7760 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Classes for network control, including VLANs, DHCP, and IP allocation. diff --git a/nova/compute/node.py b/nova/compute/node.py index 3de93d96c..1dd1621b0 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Compute Node: diff --git a/nova/crypto.py b/nova/crypto.py index 1f35ffa39..1afe9a025 100644 --- a/nova/crypto.py +++ b/nova/crypto.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Wrappers around standard crypto, including root and intermediate CAs, diff --git a/nova/datastore.py b/nova/datastore.py index ce9a85ef4..82a507468 100644 --- a/nova/datastore.py +++ b/nova/datastore.py @@ -1,18 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] +# Copyright 2010 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. # -# 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 +# Copyright 2010 Anso Labs, LLC # -# http://www.apache.org/licenses/LICENSE-2.0 +# 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. """ Datastore: diff --git a/nova/endpoint/__init__.py b/nova/endpoint/__init__.py index dbf15d259..4f98051a8 100644 --- a/nova/endpoint/__init__.py +++ b/nova/endpoint/__init__.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ :mod:`nova.endpoint` -- Main NOVA Api endpoints diff --git a/nova/endpoint/admin.py b/nova/endpoint/admin.py index b51929a83..d88882039 100644 --- a/nova/endpoint/admin.py +++ b/nova/endpoint/admin.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Admin API controller, exposed through http via the api worker. diff --git a/nova/endpoint/api.py b/nova/endpoint/api.py index 977daff27..8cd10b954 100755 --- a/nova/endpoint/api.py +++ b/nova/endpoint/api.py @@ -1,18 +1,22 @@ -#!/usr/bin/python # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Tornado REST API Request Handlers for Nova functions diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 2eee5cb39..193046c89 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Cloud Controller: Implementation of EC2 REST API calls, which are diff --git a/nova/endpoint/images.py b/nova/endpoint/images.py index 673a108e9..ba1c101c3 100644 --- a/nova/endpoint/images.py +++ b/nova/endpoint/images.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Proxy AMI-related calls from the cloud controller, to the running diff --git a/nova/exception.py b/nova/exception.py index 381419101..88fac4471 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Nova base exception handling, including decorator for re-raising diff --git a/nova/fakerabbit.py b/nova/fakerabbit.py index 13d432b45..b2852bc50 100644 --- a/nova/fakerabbit.py +++ b/nova/fakerabbit.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Based a bit on the carrot.backeds.queue backend... but a lot better """ diff --git a/nova/fakevirt.py b/nova/fakevirt.py index 2b918d388..726df3024 100644 --- a/nova/fakevirt.py +++ b/nova/fakevirt.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ A fake (in-memory) hypervisor+api. Allows nova testing w/o KVM and libvirt. diff --git a/nova/flags.py b/nova/flags.py index 84a670e6b..1ed0785fb 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Package-level global flags are defined here, the rest are defined diff --git a/nova/objectstore/__init__.py b/nova/objectstore/__init__.py index c6c09e53e..b4aa6f928 100644 --- a/nova/objectstore/__init__.py +++ b/nova/objectstore/__init__.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ :mod:`nova.objectstore` -- S3-type object store diff --git a/nova/objectstore/bucket.py b/nova/objectstore/bucket.py index 0bf102867..fc8c1a0f3 100644 --- a/nova/objectstore/bucket.py +++ b/nova/objectstore/bucket.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Simple object store using Blobs and JSON files on disk. diff --git a/nova/objectstore/handler.py b/nova/objectstore/handler.py index 97c4eeb36..cb062d146 100644 --- a/nova/objectstore/handler.py +++ b/nova/objectstore/handler.py @@ -1,18 +1,24 @@ -#!/usr/bin/env python +# 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 # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """ Implementation of an S3-like storage server based on local files. diff --git a/nova/objectstore/image.py b/nova/objectstore/image.py index b8dae4077..9cbe54a1a 100644 --- a/nova/objectstore/image.py +++ b/nova/objectstore/image.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Take uploaded bucket contents and register them as disk images (AMIs). diff --git a/nova/objectstore/stored.py b/nova/objectstore/stored.py index 05a7a1102..4c6ea649b 100644 --- a/nova/objectstore/stored.py +++ b/nova/objectstore/stored.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ Properties of an object stored within a bucket. diff --git a/nova/process.py b/nova/process.py index 8e7efd4ee..4792b26e7 100644 --- a/nova/process.py +++ b/nova/process.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Process pool, still buggy right now. diff --git a/nova/rpc.py b/nova/rpc.py index 711aad9fa..c7347156e 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ AMQP-based RPC. Queues have consumers and publishers. diff --git a/nova/server.py b/nova/server.py index 227f7fddc..376dbb1da 100644 --- a/nova/server.py +++ b/nova/server.py @@ -1,17 +1,22 @@ # 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. """ Base functionality for nova daemons - gradually being replaced with twistd.py. diff --git a/nova/test.py b/nova/test.py index 4b9a9f8a9..4dd3775ef 100644 --- a/nova/test.py +++ b/nova/test.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Base classes for our unit tests. diff --git a/nova/tests/__init__.py b/nova/tests/__init__.py index a4ccbbaeb..3c24deeb3 100644 --- a/nova/tests/__init__.py +++ b/nova/tests/__init__.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ :mod:`nova.tests` -- Nova Unittests diff --git a/nova/tests/access_unittest.py b/nova/tests/access_unittest.py index 9eb528555..5b5bc7834 100644 --- a/nova/tests/access_unittest.py +++ b/nova/tests/access_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import unittest import logging diff --git a/nova/tests/api_integration.py b/nova/tests/api_integration.py index cf84b9907..02aec7120 100644 --- a/nova/tests/api_integration.py +++ b/nova/tests/api_integration.py @@ -1,16 +1,22 @@ -# Copyright [2010] [Anso Labs, LLC] +# 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 +# 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 +# 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. import unittest diff --git a/nova/tests/api_unittest.py b/nova/tests/api_unittest.py index 29834a840..d6a1d09de 100644 --- a/nova/tests/api_unittest.py +++ b/nova/tests/api_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import httplib import random diff --git a/nova/tests/cloud_unittest.py b/nova/tests/cloud_unittest.py index 24472451f..0a518de7a 100644 --- a/nova/tests/cloud_unittest.py +++ b/nova/tests/cloud_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging import StringIO diff --git a/nova/tests/datastore_unittest.py b/nova/tests/datastore_unittest.py index 4e4d8586a..78ea56f24 100644 --- a/nova/tests/datastore_unittest.py +++ b/nova/tests/datastore_unittest.py @@ -1,3 +1,23 @@ +# 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. + from nova import test from nova import datastore import random diff --git a/nova/tests/fake_flags.py b/nova/tests/fake_flags.py index b7ec73601..5614f6af8 100644 --- a/nova/tests/fake_flags.py +++ b/nova/tests/fake_flags.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. from nova import flags diff --git a/nova/tests/future_unittest.py b/nova/tests/future_unittest.py index 81d69dfff..4a46d8506 100644 --- a/nova/tests/future_unittest.py +++ b/nova/tests/future_unittest.py @@ -1,17 +1,22 @@ # 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. import logging import StringIO diff --git a/nova/tests/keeper_unittest.py b/nova/tests/keeper_unittest.py index 3896c9e57..f53b1fe56 100644 --- a/nova/tests/keeper_unittest.py +++ b/nova/tests/keeper_unittest.py @@ -1,4 +1,23 @@ # 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. + import random from nova import datastore diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index a5d80875d..410fdf7a2 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging import unittest diff --git a/nova/tests/node_unittest.py b/nova/tests/node_unittest.py index 0666730af..91927c35a 100644 --- a/nova/tests/node_unittest.py +++ b/nova/tests/node_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging import time diff --git a/nova/tests/objectstore_unittest.py b/nova/tests/objectstore_unittest.py index 812f5418b..1f468dcfe 100644 --- a/nova/tests/objectstore_unittest.py +++ b/nova/tests/objectstore_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import glob import hashlib diff --git a/nova/tests/process_unittest.py b/nova/tests/process_unittest.py index 50368dd3f..24fad4d1d 100644 --- a/nova/tests/process_unittest.py +++ b/nova/tests/process_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging from xml.etree import ElementTree diff --git a/nova/tests/real_flags.py b/nova/tests/real_flags.py index 68fe8dc5b..c7ab10d6f 100644 --- a/nova/tests/real_flags.py +++ b/nova/tests/real_flags.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. from nova import flags diff --git a/nova/tests/storage_unittest.py b/nova/tests/storage_unittest.py index d2daccf6f..593ac16f1 100644 --- a/nova/tests/storage_unittest.py +++ b/nova/tests/storage_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging diff --git a/nova/tests/users_unittest.py b/nova/tests/users_unittest.py index 850d59026..d42095f0c 100644 --- a/nova/tests/users_unittest.py +++ b/nova/tests/users_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging import unittest diff --git a/nova/tests/validator_unittest.py b/nova/tests/validator_unittest.py index e605f86cb..032162dff 100644 --- a/nova/tests/validator_unittest.py +++ b/nova/tests/validator_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging import unittest diff --git a/nova/twistd.py b/nova/twistd.py index ea3c9c168..566b50c56 100644 --- a/nova/twistd.py +++ b/nova/twistd.py @@ -1,17 +1,22 @@ # 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. """ Twisted daemon helpers, specifically to parse out gFlags from twisted flags, diff --git a/nova/utils.py b/nova/utils.py index 4acd23101..3339bc940 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -1,17 +1,22 @@ # 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. """ System-level utilities and helper functions. diff --git a/nova/validate.py b/nova/validate.py index adf2d147c..9d89836a1 100644 --- a/nova/validate.py +++ b/nova/validate.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Decorators for argument validation, courtesy of diff --git a/nova/vendor.py b/nova/vendor.py index 758adeb3c..bb17fe129 100644 --- a/nova/vendor.py +++ b/nova/vendor.py @@ -1,17 +1,22 @@ # 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. """ Get our vendor folders into the system path. diff --git a/nova/volume/__init__.py b/nova/volume/__init__.py index 1c569f383..82e387a4a 100644 --- a/nova/volume/__init__.py +++ b/nova/volume/__init__.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ :mod:`nova.volume` -- Nova Block Storage diff --git a/nova/volume/storage.py b/nova/volume/storage.py index f52252f2d..f2c250e86 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Nova Storage manages creating, attaching, detaching, and diff --git a/run_tests.py b/run_tests.py index d03dbb987..bcbb29c62 100644 --- a/run_tests.py +++ b/run_tests.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ This is our basic test running framework based on Twisted's Trial. diff --git a/setup.py b/setup.py index a25ae0c8c..327e455c5 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,22 @@ -#!/usr/bin/env 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 -# +# 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. +# 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. import glob import os diff --git a/smoketests/__init__.py b/smoketests/__init__.py index 907545460..288c1a42c 100644 --- a/smoketests/__init__.py +++ b/smoketests/__init__.py @@ -1,19 +1,22 @@ # 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. -# -# 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 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. """ :mod:`smoketests` -- Nova Integration "Smoke" Tests diff --git a/smoketests/flags.py b/smoketests/flags.py index 7c35f5253..c08ba5a75 100644 --- a/smoketests/flags.py +++ b/smoketests/flags.py @@ -1,19 +1,22 @@ # 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. -# -# 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 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. """ Package-level global flags are defined here, the rest are defined diff --git a/smoketests/novatestcase.py b/smoketests/novatestcase.py index 306e2320d..7de4288f3 100644 --- a/smoketests/novatestcase.py +++ b/smoketests/novatestcase.py @@ -1,19 +1,22 @@ # 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. -# -# 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 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. import commands import os diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index ba8a7764a..47c34ef6f 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -1,19 +1,22 @@ # 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. -# -# 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 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. import commands import os diff --git a/tools/clean-vlans b/tools/clean-vlans index 39010ba1d..7e4f5e538 100755 --- a/tools/clean-vlans +++ b/tools/clean-vlans @@ -1,4 +1,23 @@ #!/usr/bin/env bash +# 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. sudo ifconfig -a | grep br | grep -v bridge | cut -f1 -d" " | xargs -n1 -ifoo ifconfig foo down sudo ifconfig -a | grep br | grep -v bridge | cut -f1 -d" " | xargs -n1 -ifoo brctl delbr foo diff --git a/vendor/tornado/demos/appengine/blog.py b/vendor/tornado/demos/appengine/blog.py index ccaabd539..ee7e5b8af 100644 --- a/vendor/tornado/demos/appengine/blog.py +++ b/vendor/tornado/demos/appengine/blog.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. import functools import markdown diff --git a/vendor/tornado/demos/auth/authdemo.py b/vendor/tornado/demos/auth/authdemo.py index e6136d1b5..f1b3c83af 100755 --- a/vendor/tornado/demos/auth/authdemo.py +++ b/vendor/tornado/demos/auth/authdemo.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. import tornado.auth import tornado.escape diff --git a/vendor/tornado/demos/blog/blog.py b/vendor/tornado/demos/blog/blog.py index 808a9afc5..b6242af78 100755 --- a/vendor/tornado/demos/blog/blog.py +++ b/vendor/tornado/demos/blog/blog.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. import markdown import os.path diff --git a/vendor/tornado/demos/chat/chatdemo.py b/vendor/tornado/demos/chat/chatdemo.py index 7086592ec..9843b0657 100755 --- a/vendor/tornado/demos/chat/chatdemo.py +++ b/vendor/tornado/demos/chat/chatdemo.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. import logging import tornado.auth diff --git a/vendor/tornado/demos/facebook/facebook.py b/vendor/tornado/demos/facebook/facebook.py index 0c984ddaa..19b4d1a48 100755 --- a/vendor/tornado/demos/facebook/facebook.py +++ b/vendor/tornado/demos/facebook/facebook.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. import logging import os.path diff --git a/vendor/tornado/demos/facebook/uimodules.py b/vendor/tornado/demos/facebook/uimodules.py index 1173db634..b4c65440b 100644 --- a/vendor/tornado/demos/facebook/uimodules.py +++ b/vendor/tornado/demos/facebook/uimodules.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. import tornado.web diff --git a/vendor/tornado/demos/helloworld/helloworld.py b/vendor/tornado/demos/helloworld/helloworld.py index 0f1ed61ff..e97fe68b3 100755 --- a/vendor/tornado/demos/helloworld/helloworld.py +++ b/vendor/tornado/demos/helloworld/helloworld.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. import tornado.httpserver import tornado.ioloop diff --git a/vendor/tornado/setup.py b/vendor/tornado/setup.py index 5cb69df2d..444beb718 100644 --- a/vendor/tornado/setup.py +++ b/vendor/tornado/setup.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. import distutils.core import sys diff --git a/vendor/tornado/tornado/__init__.py b/vendor/tornado/tornado/__init__.py index 8f73764eb..fdad0561d 100644 --- a/vendor/tornado/tornado/__init__.py +++ b/vendor/tornado/tornado/__init__.py @@ -2,16 +2,16 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """The Tornado web server and tools.""" diff --git a/vendor/tornado/tornado/auth.py b/vendor/tornado/tornado/auth.py index f67d9e548..635bc218b 100644 --- a/vendor/tornado/tornado/auth.py +++ b/vendor/tornado/tornado/auth.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """Implementations of various third-party authentication schemes. diff --git a/vendor/tornado/tornado/autoreload.py b/vendor/tornado/tornado/autoreload.py index 231cfe892..1e9b38b13 100644 --- a/vendor/tornado/tornado/autoreload.py +++ b/vendor/tornado/tornado/autoreload.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """A module to automatically restart the server when a module is modified. diff --git a/vendor/tornado/tornado/database.py b/vendor/tornado/tornado/database.py index 3f78e00b9..d933c1671 100644 --- a/vendor/tornado/tornado/database.py +++ b/vendor/tornado/tornado/database.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """A lightweight wrapper around MySQLdb.""" diff --git a/vendor/tornado/tornado/escape.py b/vendor/tornado/tornado/escape.py index bacb1c51d..9471e7e61 100644 --- a/vendor/tornado/tornado/escape.py +++ b/vendor/tornado/tornado/escape.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """Escaping/unescaping methods for HTML, JSON, URLs, and others.""" diff --git a/vendor/tornado/tornado/httpclient.py b/vendor/tornado/tornado/httpclient.py index 2c9155eb9..fa4917ea3 100644 --- a/vendor/tornado/tornado/httpclient.py +++ b/vendor/tornado/tornado/httpclient.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """Blocking and non-blocking HTTP client implementations using pycurl.""" diff --git a/vendor/tornado/tornado/httpserver.py b/vendor/tornado/tornado/httpserver.py index a7ec57eec..801c68aff 100644 --- a/vendor/tornado/tornado/httpserver.py +++ b/vendor/tornado/tornado/httpserver.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """A non-blocking, single-threaded HTTP server.""" diff --git a/vendor/tornado/tornado/ioloop.py b/vendor/tornado/tornado/ioloop.py index e94c17372..6d502dc41 100644 --- a/vendor/tornado/tornado/ioloop.py +++ b/vendor/tornado/tornado/ioloop.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """A level-triggered I/O loop for non-blocking sockets.""" diff --git a/vendor/tornado/tornado/iostream.py b/vendor/tornado/tornado/iostream.py index af7c6edbf..063fe76a5 100644 --- a/vendor/tornado/tornado/iostream.py +++ b/vendor/tornado/tornado/iostream.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """A utility class to write to and read from a non-blocking socket.""" diff --git a/vendor/tornado/tornado/locale.py b/vendor/tornado/tornado/locale.py index 6a8537d75..b819f6cfe 100644 --- a/vendor/tornado/tornado/locale.py +++ b/vendor/tornado/tornado/locale.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """Translation methods for generating localized strings. diff --git a/vendor/tornado/tornado/options.py b/vendor/tornado/tornado/options.py index 66bce091e..c2c393615 100644 --- a/vendor/tornado/tornado/options.py +++ b/vendor/tornado/tornado/options.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """A command line parsing module that lets modules define their own options. diff --git a/vendor/tornado/tornado/s3server.py b/vendor/tornado/tornado/s3server.py index 2e8a97de2..bfbce65b9 100644 --- a/vendor/tornado/tornado/s3server.py +++ b/vendor/tornado/tornado/s3server.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """Implementation of an S3-like storage server based on local files. diff --git a/vendor/tornado/tornado/template.py b/vendor/tornado/tornado/template.py index 7ed56cfa6..25c00be05 100644 --- a/vendor/tornado/tornado/template.py +++ b/vendor/tornado/tornado/template.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """A simple template system that compiles templates to Python code. diff --git a/vendor/tornado/tornado/web.py b/vendor/tornado/tornado/web.py index 7559fae8a..06b8e9e82 100644 --- a/vendor/tornado/tornado/web.py +++ b/vendor/tornado/tornado/web.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """The Tornado web framework. diff --git a/vendor/tornado/tornado/websocket.py b/vendor/tornado/tornado/websocket.py index 38a58012c..5bab75c8f 100644 --- a/vendor/tornado/tornado/websocket.py +++ b/vendor/tornado/tornado/websocket.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. import functools import logging diff --git a/vendor/tornado/tornado/wsgi.py b/vendor/tornado/tornado/wsgi.py index 69fa0988e..b65eaed9b 100644 --- a/vendor/tornado/tornado/wsgi.py +++ b/vendor/tornado/tornado/wsgi.py @@ -2,17 +2,17 @@ # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """WSGI support for the Tornado web framework. diff --git a/vendor/tornado/website/website.py b/vendor/tornado/website/website.py index f073b67e6..a07710eed 100644 --- a/vendor/tornado/website/website.py +++ b/vendor/tornado/website/website.py @@ -2,17 +2,17 @@ # # Copyright 2009 Bret Taylor # -# 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 +# 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 +# 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. +# 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. import markdown import os -- cgit From 8726fc061b53b361207cb38e88cd5b1d2e401637 Mon Sep 17 00:00:00 2001 From: Devin Carlen Date: Wed, 23 Jun 2010 22:56:50 -0700 Subject: added nova-instancemonitor debian config --- debian/control | 5 +++ debian/nova-instancemonitor.init | 69 +++++++++++++++++++++++++++++++++++++ debian/nova-instancemonitor.install | 1 + 3 files changed, 75 insertions(+) create mode 100644 debian/nova-instancemonitor.init create mode 100644 debian/nova-instancemonitor.install diff --git a/debian/control b/debian/control index a50e6ecf8..bb2071234 100644 --- a/debian/control +++ b/debian/control @@ -34,6 +34,11 @@ Architecture: all Depends: nova-common (= ${binary:Version}), ${python:Depends}, ${misc:Depends} Description: Nova object store +Package: nova-instancemonitor +Architecture: all +Depends: nova-common (= ${binary:Version}), ${python:Depends}, ${misc:Depends} +Description: Nova instance monitor + Package: nova-tools Architecture: all Depends: python-boto, ${python:Depends}, ${misc:Depends} diff --git a/debian/nova-instancemonitor.init b/debian/nova-instancemonitor.init new file mode 100644 index 000000000..2865fc334 --- /dev/null +++ b/debian/nova-instancemonitor.init @@ -0,0 +1,69 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: nova-instancemonitor +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: nova-instancemonitor +# Description: nova-instancemonitor +### END INIT INFO + + +set -e + +DAEMON=/usr/bin/nova-instancemonitor +DAEMON_ARGS="--flagfile=/etc/nova.conf" +PIDFILE=/var/run/nova-instancemonitor.pid + +ENABLED=false + +if test -f /etc/default/nova-instancemonitor; then + . /etc/default/nova-instancemonitor +fi + +. /lib/lsb/init-functions + +export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" + +case "$1" in + start) + test "$ENABLED" = "true" || exit 0 + log_daemon_msg "Starting nova compute" "nova-instancemonitor" + cd /var/run + if $DAEMON $DAEMON_ARGS start; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + stop) + test "$ENABLED" = "true" || exit 0 + log_daemon_msg "Stopping nova compute" "nova-instancemonitor" + cd /var/run + if $DAEMON $DAEMON_ARGS stop; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + restart|force-reload) + test "$ENABLED" = "true" || exit 1 + cd /var/run + if $DAEMON $DAEMON_ARGS restart; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + status) + test "$ENABLED" = "true" || exit 0 + status_of_proc -p $PIDFILE $DAEMON nova-instancemonitor && exit 0 || exit $? + ;; + *) + log_action_msg "Usage: /etc/init.d/nova-instancemonitor {start|stop|restart|force-reload|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/debian/nova-instancemonitor.install b/debian/nova-instancemonitor.install new file mode 100644 index 000000000..48e7884b4 --- /dev/null +++ b/debian/nova-instancemonitor.install @@ -0,0 +1 @@ +bin/nova-instancemonitor usr/bin -- cgit From 4ba6802ae5d6fb4e0d8ed7bbbaf2cca94a6d1118 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 23 Jun 2010 23:15:06 -0700 Subject: Removed trailing whitespace from header --- bin/nova-api | 2 +- bin/nova-compute | 2 +- bin/nova-instancemonitor | 2 +- bin/nova-manage | 2 +- bin/nova-objectstore | 2 +- bin/nova-volume | 2 +- builddeb.sh | 2 +- nova/__init__.py | 2 +- nova/adminclient.py | 2 +- nova/auth/__init__.py | 2 +- nova/auth/fakeldap.py | 2 +- nova/auth/novarc.template | 2 +- nova/auth/rbac.py | 2 +- nova/auth/signer.py | 2 +- nova/auth/slap.sh | 2 +- nova/auth/users.py | 2 +- nova/cloudpipe/__init__.py | 2 +- nova/cloudpipe/api.py | 2 +- nova/cloudpipe/bootscript.sh | 2 +- nova/cloudpipe/client.ovpn.template | 2 +- nova/cloudpipe/pipelib.py | 2 +- nova/compute/__init__.py | 2 +- nova/compute/disk.py | 2 +- nova/compute/exception.py | 2 +- nova/compute/fakevirtinstance.xml | 2 +- nova/compute/libvirt.xml.template | 2 +- nova/compute/linux_net.py | 2 +- nova/compute/model.py | 2 +- nova/compute/monitor.py | 2 +- nova/compute/network.py | 2 +- nova/compute/node.py | 2 +- nova/crypto.py | 2 +- nova/datastore.py | 2 +- nova/endpoint/__init__.py | 2 +- nova/endpoint/admin.py | 2 +- nova/endpoint/api.py | 2 +- nova/endpoint/cloud.py | 2 +- nova/endpoint/images.py | 2 +- nova/exception.py | 2 +- nova/fakerabbit.py | 2 +- nova/fakevirt.py | 2 +- nova/flags.py | 2 +- nova/objectstore/__init__.py | 2 +- nova/objectstore/bucket.py | 2 +- nova/objectstore/handler.py | 2 +- nova/objectstore/image.py | 2 +- nova/objectstore/stored.py | 2 +- nova/process.py | 2 +- nova/rpc.py | 2 +- nova/server.py | 2 +- nova/test.py | 2 +- nova/tests/__init__.py | 2 +- nova/tests/access_unittest.py | 2 +- nova/tests/api_integration.py | 2 +- nova/tests/api_unittest.py | 2 +- nova/tests/cloud_unittest.py | 2 +- nova/tests/datastore_unittest.py | 2 +- nova/tests/fake_flags.py | 2 +- nova/tests/future_unittest.py | 2 +- nova/tests/keeper_unittest.py | 2 +- nova/tests/network_unittest.py | 2 +- nova/tests/node_unittest.py | 2 +- nova/tests/objectstore_unittest.py | 2 +- nova/tests/process_unittest.py | 2 +- nova/tests/real_flags.py | 2 +- nova/tests/storage_unittest.py | 2 +- nova/tests/users_unittest.py | 2 +- nova/tests/validator_unittest.py | 2 +- nova/twistd.py | 2 +- nova/utils.py | 2 +- nova/validate.py | 2 +- nova/vendor.py | 2 +- nova/volume/__init__.py | 2 +- nova/volume/storage.py | 2 +- run_tests.py | 2 +- setup.py | 2 +- smoketests/__init__.py | 2 +- smoketests/flags.py | 2 +- smoketests/novatestcase.py | 2 +- smoketests/smoketest.py | 2 +- tools/clean-vlans | 2 +- 81 files changed, 81 insertions(+), 81 deletions(-) diff --git a/bin/nova-api b/bin/nova-api index 5ea49692c..e9772ec81 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/bin/nova-compute b/bin/nova-compute index b1a6354b8..cc738e87f 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor index d21732a15..1f22b424e 100755 --- a/bin/nova-instancemonitor +++ b/bin/nova-instancemonitor @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/bin/nova-manage b/bin/nova-manage index c9f36ad32..f418e162b 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/bin/nova-objectstore b/bin/nova-objectstore index 26dcd2676..f6d7b1270 100755 --- a/bin/nova-objectstore +++ b/bin/nova-objectstore @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/bin/nova-volume b/bin/nova-volume index f3f8cb9a4..2720e12cd 100755 --- a/bin/nova-volume +++ b/bin/nova-volume @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/builddeb.sh b/builddeb.sh index 5055dd332..2fb20da2a 100755 --- a/builddeb.sh +++ b/builddeb.sh @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/__init__.py b/nova/__init__.py index 1151ee639..1c886716f 100644 --- a/nova/__init__.py +++ b/nova/__init__.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/adminclient.py b/nova/adminclient.py index ef1ee03c0..fe873b8f7 100644 --- a/nova/adminclient.py +++ b/nova/adminclient.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/__init__.py b/nova/auth/__init__.py index bfc5ef4d5..0d115e9d9 100644 --- a/nova/auth/__init__.py +++ b/nova/auth/__init__.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/fakeldap.py b/nova/auth/fakeldap.py index 13b2435dd..27dde314d 100644 --- a/nova/auth/fakeldap.py +++ b/nova/auth/fakeldap.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/novarc.template b/nova/auth/novarc.template index 91a3c68c8..b6d65297a 100644 --- a/nova/auth/novarc.template +++ b/nova/auth/novarc.template @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/rbac.py b/nova/auth/rbac.py index eb85a3de1..f4abd1075 100644 --- a/nova/auth/rbac.py +++ b/nova/auth/rbac.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/signer.py b/nova/auth/signer.py index 526a54262..4f7ac43bc 100644 --- a/nova/auth/signer.py +++ b/nova/auth/signer.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/slap.sh b/nova/auth/slap.sh index ac2af422f..277ae2bcd 100755 --- a/nova/auth/slap.sh +++ b/nova/auth/slap.sh @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/users.py b/nova/auth/users.py index 72c3c8466..6997596aa 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/cloudpipe/__init__.py b/nova/cloudpipe/__init__.py index 5c35d696c..57ef14651 100644 --- a/nova/cloudpipe/__init__.py +++ b/nova/cloudpipe/__init__.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/cloudpipe/api.py b/nova/cloudpipe/api.py index 87283ef07..610239c2e 100644 --- a/nova/cloudpipe/api.py +++ b/nova/cloudpipe/api.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/cloudpipe/bootscript.sh b/nova/cloudpipe/bootscript.sh index 312258c22..639aad66f 100755 --- a/nova/cloudpipe/bootscript.sh +++ b/nova/cloudpipe/bootscript.sh @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/cloudpipe/client.ovpn.template b/nova/cloudpipe/client.ovpn.template index 80b5dab26..a8ec5dc6e 100644 --- a/nova/cloudpipe/client.ovpn.template +++ b/nova/cloudpipe/client.ovpn.template @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index 106a31368..09da71c64 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/compute/__init__.py b/nova/compute/__init__.py index fe8d357a3..1c688c100 100644 --- a/nova/compute/__init__.py +++ b/nova/compute/__init__.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/compute/disk.py b/nova/compute/disk.py index 84329ae55..e7090dad3 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/compute/exception.py b/nova/compute/exception.py index 829810bb0..b2bfc39e6 100644 --- a/nova/compute/exception.py +++ b/nova/compute/exception.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/compute/fakevirtinstance.xml b/nova/compute/fakevirtinstance.xml index 88cc623a8..0df76f5ef 100644 --- a/nova/compute/fakevirtinstance.xml +++ b/nova/compute/fakevirtinstance.xml @@ -1,6 +1,6 @@ +# 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. +--> i-A9B8C7D6 12a345bc-67c8-901d-2e34-56f7g89012h3 diff --git a/nova/compute/libvirt.xml.template b/nova/compute/libvirt.xml.template index 4cf6e8b10..9f40365a3 100644 --- a/nova/compute/libvirt.xml.template +++ b/nova/compute/libvirt.xml.template @@ -1,18 +1,22 @@ +# 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. +--> %(name)s diff --git a/nova/compute/linux_net.py b/nova/compute/linux_net.py index b9f775aa3..2ec1fe183 100644 --- a/nova/compute/linux_net.py +++ b/nova/compute/linux_net.py @@ -1,5 +1,23 @@ # 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. + import logging import signal import os diff --git a/nova/compute/model.py b/nova/compute/model.py index 74bf60a3b..cd5ab4047 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Datastore Model objects for Compute Instances, with diff --git a/nova/compute/monitor.py b/nova/compute/monitor.py index 4a3b43991..2d6911a89 100644 --- a/nova/compute/monitor.py +++ b/nova/compute/monitor.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Instance Monitoring: diff --git a/nova/compute/network.py b/nova/compute/network.py index acc153677..dc2ff7760 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Classes for network control, including VLANs, DHCP, and IP allocation. diff --git a/nova/compute/node.py b/nova/compute/node.py index 3de93d96c..1dd1621b0 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Compute Node: diff --git a/nova/crypto.py b/nova/crypto.py index 1f35ffa39..1afe9a025 100644 --- a/nova/crypto.py +++ b/nova/crypto.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Wrappers around standard crypto, including root and intermediate CAs, diff --git a/nova/datastore.py b/nova/datastore.py index ce9a85ef4..82a507468 100644 --- a/nova/datastore.py +++ b/nova/datastore.py @@ -1,18 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] +# Copyright 2010 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. # -# 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 +# Copyright 2010 Anso Labs, LLC # -# http://www.apache.org/licenses/LICENSE-2.0 +# 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. """ Datastore: diff --git a/nova/endpoint/__init__.py b/nova/endpoint/__init__.py index dbf15d259..4f98051a8 100644 --- a/nova/endpoint/__init__.py +++ b/nova/endpoint/__init__.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ :mod:`nova.endpoint` -- Main NOVA Api endpoints diff --git a/nova/endpoint/admin.py b/nova/endpoint/admin.py index b51929a83..d88882039 100644 --- a/nova/endpoint/admin.py +++ b/nova/endpoint/admin.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Admin API controller, exposed through http via the api worker. diff --git a/nova/endpoint/api.py b/nova/endpoint/api.py index 977daff27..8cd10b954 100755 --- a/nova/endpoint/api.py +++ b/nova/endpoint/api.py @@ -1,18 +1,22 @@ -#!/usr/bin/python # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Tornado REST API Request Handlers for Nova functions diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index afd48aa14..2b4795982 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Cloud Controller: Implementation of EC2 REST API calls, which are diff --git a/nova/endpoint/images.py b/nova/endpoint/images.py index 673a108e9..ba1c101c3 100644 --- a/nova/endpoint/images.py +++ b/nova/endpoint/images.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Proxy AMI-related calls from the cloud controller, to the running diff --git a/nova/exception.py b/nova/exception.py index 381419101..88fac4471 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Nova base exception handling, including decorator for re-raising diff --git a/nova/fakerabbit.py b/nova/fakerabbit.py index 13d432b45..b2852bc50 100644 --- a/nova/fakerabbit.py +++ b/nova/fakerabbit.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Based a bit on the carrot.backeds.queue backend... but a lot better """ diff --git a/nova/fakevirt.py b/nova/fakevirt.py index 2b918d388..726df3024 100644 --- a/nova/fakevirt.py +++ b/nova/fakevirt.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ A fake (in-memory) hypervisor+api. Allows nova testing w/o KVM and libvirt. diff --git a/nova/flags.py b/nova/flags.py index 84a670e6b..1ed0785fb 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Package-level global flags are defined here, the rest are defined diff --git a/nova/objectstore/__init__.py b/nova/objectstore/__init__.py index c6c09e53e..b4aa6f928 100644 --- a/nova/objectstore/__init__.py +++ b/nova/objectstore/__init__.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ :mod:`nova.objectstore` -- S3-type object store diff --git a/nova/objectstore/bucket.py b/nova/objectstore/bucket.py index 0bf102867..fc8c1a0f3 100644 --- a/nova/objectstore/bucket.py +++ b/nova/objectstore/bucket.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Simple object store using Blobs and JSON files on disk. diff --git a/nova/objectstore/handler.py b/nova/objectstore/handler.py index 97c4eeb36..cb062d146 100644 --- a/nova/objectstore/handler.py +++ b/nova/objectstore/handler.py @@ -1,18 +1,24 @@ -#!/usr/bin/env python +# 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 # # Copyright 2009 Facebook # -# 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 +# 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 +# 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. +# 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. """ Implementation of an S3-like storage server based on local files. diff --git a/nova/objectstore/image.py b/nova/objectstore/image.py index b8dae4077..9cbe54a1a 100644 --- a/nova/objectstore/image.py +++ b/nova/objectstore/image.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Take uploaded bucket contents and register them as disk images (AMIs). diff --git a/nova/objectstore/stored.py b/nova/objectstore/stored.py index 05a7a1102..4c6ea649b 100644 --- a/nova/objectstore/stored.py +++ b/nova/objectstore/stored.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ Properties of an object stored within a bucket. diff --git a/nova/process.py b/nova/process.py index 8e7efd4ee..4792b26e7 100644 --- a/nova/process.py +++ b/nova/process.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Process pool, still buggy right now. diff --git a/nova/rpc.py b/nova/rpc.py index 711aad9fa..c7347156e 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ AMQP-based RPC. Queues have consumers and publishers. diff --git a/nova/server.py b/nova/server.py index 227f7fddc..376dbb1da 100644 --- a/nova/server.py +++ b/nova/server.py @@ -1,17 +1,22 @@ # 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. """ Base functionality for nova daemons - gradually being replaced with twistd.py. diff --git a/nova/test.py b/nova/test.py index 4b9a9f8a9..4dd3775ef 100644 --- a/nova/test.py +++ b/nova/test.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Base classes for our unit tests. diff --git a/nova/tests/__init__.py b/nova/tests/__init__.py index a4ccbbaeb..3c24deeb3 100644 --- a/nova/tests/__init__.py +++ b/nova/tests/__init__.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ :mod:`nova.tests` -- Nova Unittests diff --git a/nova/tests/access_unittest.py b/nova/tests/access_unittest.py index 9eb528555..5b5bc7834 100644 --- a/nova/tests/access_unittest.py +++ b/nova/tests/access_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import unittest import logging diff --git a/nova/tests/api_integration.py b/nova/tests/api_integration.py index cf84b9907..02aec7120 100644 --- a/nova/tests/api_integration.py +++ b/nova/tests/api_integration.py @@ -1,16 +1,22 @@ -# Copyright [2010] [Anso Labs, LLC] +# 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 +# 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 +# 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. import unittest diff --git a/nova/tests/api_unittest.py b/nova/tests/api_unittest.py index 29834a840..d6a1d09de 100644 --- a/nova/tests/api_unittest.py +++ b/nova/tests/api_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import httplib import random diff --git a/nova/tests/cloud_unittest.py b/nova/tests/cloud_unittest.py index 24472451f..0a518de7a 100644 --- a/nova/tests/cloud_unittest.py +++ b/nova/tests/cloud_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging import StringIO diff --git a/nova/tests/datastore_unittest.py b/nova/tests/datastore_unittest.py index 4e4d8586a..78ea56f24 100644 --- a/nova/tests/datastore_unittest.py +++ b/nova/tests/datastore_unittest.py @@ -1,3 +1,23 @@ +# 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. + from nova import test from nova import datastore import random diff --git a/nova/tests/fake_flags.py b/nova/tests/fake_flags.py index b7ec73601..5614f6af8 100644 --- a/nova/tests/fake_flags.py +++ b/nova/tests/fake_flags.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. from nova import flags diff --git a/nova/tests/future_unittest.py b/nova/tests/future_unittest.py index 81d69dfff..4a46d8506 100644 --- a/nova/tests/future_unittest.py +++ b/nova/tests/future_unittest.py @@ -1,17 +1,22 @@ # 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. import logging import StringIO diff --git a/nova/tests/keeper_unittest.py b/nova/tests/keeper_unittest.py index 3896c9e57..f53b1fe56 100644 --- a/nova/tests/keeper_unittest.py +++ b/nova/tests/keeper_unittest.py @@ -1,4 +1,23 @@ # 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. + import random from nova import datastore diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index a5d80875d..410fdf7a2 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging import unittest diff --git a/nova/tests/node_unittest.py b/nova/tests/node_unittest.py index 0666730af..91927c35a 100644 --- a/nova/tests/node_unittest.py +++ b/nova/tests/node_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging import time diff --git a/nova/tests/objectstore_unittest.py b/nova/tests/objectstore_unittest.py index 812f5418b..1f468dcfe 100644 --- a/nova/tests/objectstore_unittest.py +++ b/nova/tests/objectstore_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import glob import hashlib diff --git a/nova/tests/process_unittest.py b/nova/tests/process_unittest.py index 50368dd3f..24fad4d1d 100644 --- a/nova/tests/process_unittest.py +++ b/nova/tests/process_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging from xml.etree import ElementTree diff --git a/nova/tests/real_flags.py b/nova/tests/real_flags.py index 68fe8dc5b..c7ab10d6f 100644 --- a/nova/tests/real_flags.py +++ b/nova/tests/real_flags.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. from nova import flags diff --git a/nova/tests/storage_unittest.py b/nova/tests/storage_unittest.py index d2daccf6f..593ac16f1 100644 --- a/nova/tests/storage_unittest.py +++ b/nova/tests/storage_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging diff --git a/nova/tests/users_unittest.py b/nova/tests/users_unittest.py index 850d59026..d42095f0c 100644 --- a/nova/tests/users_unittest.py +++ b/nova/tests/users_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging import unittest diff --git a/nova/tests/validator_unittest.py b/nova/tests/validator_unittest.py index e605f86cb..032162dff 100644 --- a/nova/tests/validator_unittest.py +++ b/nova/tests/validator_unittest.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. import logging import unittest diff --git a/nova/twistd.py b/nova/twistd.py index ea3c9c168..566b50c56 100644 --- a/nova/twistd.py +++ b/nova/twistd.py @@ -1,17 +1,22 @@ # 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. """ Twisted daemon helpers, specifically to parse out gFlags from twisted flags, diff --git a/nova/utils.py b/nova/utils.py index 4acd23101..3339bc940 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -1,17 +1,22 @@ # 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. """ System-level utilities and helper functions. diff --git a/nova/validate.py b/nova/validate.py index adf2d147c..9d89836a1 100644 --- a/nova/validate.py +++ b/nova/validate.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Decorators for argument validation, courtesy of diff --git a/nova/vendor.py b/nova/vendor.py index 758adeb3c..bb17fe129 100644 --- a/nova/vendor.py +++ b/nova/vendor.py @@ -1,17 +1,22 @@ # 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. """ Get our vendor folders into the system path. diff --git a/nova/volume/__init__.py b/nova/volume/__init__.py index 1c569f383..82e387a4a 100644 --- a/nova/volume/__init__.py +++ b/nova/volume/__init__.py @@ -1,16 +1,22 @@ -# 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 -# +# 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. +# 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. """ :mod:`nova.volume` -- Nova Block Storage diff --git a/nova/volume/storage.py b/nova/volume/storage.py index f52252f2d..f2c250e86 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ Nova Storage manages creating, attaching, detaching, and diff --git a/run_tests.py b/run_tests.py index d03dbb987..bcbb29c62 100644 --- a/run_tests.py +++ b/run_tests.py @@ -1,17 +1,22 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright [2010] [Anso Labs, LLC] + +# 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 +# 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 +# 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. """ This is our basic test running framework based on Twisted's Trial. diff --git a/setup.py b/setup.py index a25ae0c8c..327e455c5 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,22 @@ -#!/usr/bin/env 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 -# +# 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. +# 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. import glob import os diff --git a/smoketests/__init__.py b/smoketests/__init__.py index 907545460..288c1a42c 100644 --- a/smoketests/__init__.py +++ b/smoketests/__init__.py @@ -1,19 +1,22 @@ # 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. -# -# 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 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. """ :mod:`smoketests` -- Nova Integration "Smoke" Tests diff --git a/smoketests/flags.py b/smoketests/flags.py index 7c35f5253..c08ba5a75 100644 --- a/smoketests/flags.py +++ b/smoketests/flags.py @@ -1,19 +1,22 @@ # 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. -# -# 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 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. """ Package-level global flags are defined here, the rest are defined diff --git a/smoketests/novatestcase.py b/smoketests/novatestcase.py index 306e2320d..7de4288f3 100644 --- a/smoketests/novatestcase.py +++ b/smoketests/novatestcase.py @@ -1,19 +1,22 @@ # 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. -# -# 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 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. import commands import os diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index ba8a7764a..47c34ef6f 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -1,19 +1,22 @@ # 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. -# -# 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 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. import commands import os diff --git a/tools/clean-vlans b/tools/clean-vlans index 39010ba1d..7e4f5e538 100755 --- a/tools/clean-vlans +++ b/tools/clean-vlans @@ -1,4 +1,23 @@ #!/usr/bin/env bash +# 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. sudo ifconfig -a | grep br | grep -v bridge | cut -f1 -d" " | xargs -n1 -ifoo ifconfig foo down sudo ifconfig -a | grep br | grep -v bridge | cut -f1 -d" " | xargs -n1 -ifoo brctl delbr foo -- cgit From 10b8e5bdaa8ca601b1e0b0268a6acfec6f5712ad Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Tue, 29 Jun 2010 21:25:59 -0500 Subject: Removed trailing whitespace from header --- bin/nova-api | 2 +- bin/nova-compute | 2 +- bin/nova-instancemonitor | 2 +- bin/nova-manage | 2 +- bin/nova-objectstore | 2 +- bin/nova-volume | 2 +- builddeb.sh | 2 +- nova/__init__.py | 2 +- nova/adminclient.py | 2 +- nova/auth/__init__.py | 2 +- nova/auth/fakeldap.py | 2 +- nova/auth/novarc.template | 2 +- nova/auth/rbac.py | 2 +- nova/auth/signer.py | 2 +- nova/auth/slap.sh | 2 +- nova/auth/users.py | 2 +- nova/cloudpipe/__init__.py | 2 +- nova/cloudpipe/api.py | 2 +- nova/cloudpipe/bootscript.sh | 2 +- nova/cloudpipe/client.ovpn.template | 2 +- nova/cloudpipe/pipelib.py | 2 +- nova/compute/__init__.py | 2 +- nova/compute/disk.py | 2 +- nova/compute/exception.py | 2 +- nova/compute/fakevirtinstance.xml | 2 +- nova/compute/libvirt.xml.template | 2 +- nova/compute/linux_net.py | 2 +- nova/compute/model.py | 2 +- nova/compute/monitor.py | 2 +- nova/compute/network.py | 2 +- nova/compute/node.py | 2 +- nova/crypto.py | 2 +- nova/datastore.py | 2 +- nova/endpoint/__init__.py | 2 +- nova/endpoint/admin.py | 2 +- nova/endpoint/api.py | 2 +- nova/endpoint/cloud.py | 2 +- nova/endpoint/images.py | 2 +- nova/exception.py | 2 +- nova/fakerabbit.py | 2 +- nova/fakevirt.py | 2 +- nova/flags.py | 2 +- nova/objectstore/__init__.py | 2 +- nova/objectstore/bucket.py | 2 +- nova/objectstore/handler.py | 2 +- nova/objectstore/image.py | 2 +- nova/objectstore/stored.py | 2 +- nova/process.py | 2 +- nova/rpc.py | 2 +- nova/server.py | 2 +- nova/test.py | 2 +- nova/tests/__init__.py | 2 +- nova/tests/access_unittest.py | 2 +- nova/tests/api_integration.py | 2 +- nova/tests/api_unittest.py | 2 +- nova/tests/cloud_unittest.py | 2 +- nova/tests/datastore_unittest.py | 2 +- nova/tests/fake_flags.py | 2 +- nova/tests/future_unittest.py | 2 +- nova/tests/keeper_unittest.py | 2 +- nova/tests/network_unittest.py | 2 +- nova/tests/node_unittest.py | 2 +- nova/tests/objectstore_unittest.py | 2 +- nova/tests/process_unittest.py | 2 +- nova/tests/real_flags.py | 2 +- nova/tests/storage_unittest.py | 2 +- nova/tests/users_unittest.py | 2 +- nova/tests/validator_unittest.py | 2 +- nova/twistd.py | 2 +- nova/utils.py | 2 +- nova/validate.py | 2 +- nova/vendor.py | 2 +- nova/volume/__init__.py | 2 +- nova/volume/storage.py | 2 +- run_tests.py | 2 +- setup.py | 2 +- smoketests/__init__.py | 2 +- smoketests/flags.py | 2 +- smoketests/novatestcase.py | 2 +- smoketests/smoketest.py | 2 +- tools/clean-vlans | 2 +- 81 files changed, 81 insertions(+), 81 deletions(-) diff --git a/bin/nova-api b/bin/nova-api index 5ea49692c..e9772ec81 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/bin/nova-compute b/bin/nova-compute index b1a6354b8..cc738e87f 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor index d21732a15..1f22b424e 100755 --- a/bin/nova-instancemonitor +++ b/bin/nova-instancemonitor @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/bin/nova-manage b/bin/nova-manage index c9f36ad32..f418e162b 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/bin/nova-objectstore b/bin/nova-objectstore index 26dcd2676..f6d7b1270 100755 --- a/bin/nova-objectstore +++ b/bin/nova-objectstore @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/bin/nova-volume b/bin/nova-volume index f3f8cb9a4..2720e12cd 100755 --- a/bin/nova-volume +++ b/bin/nova-volume @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/builddeb.sh b/builddeb.sh index 5055dd332..2fb20da2a 100755 --- a/builddeb.sh +++ b/builddeb.sh @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/__init__.py b/nova/__init__.py index 1151ee639..1c886716f 100644 --- a/nova/__init__.py +++ b/nova/__init__.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/adminclient.py b/nova/adminclient.py index ef1ee03c0..fe873b8f7 100644 --- a/nova/adminclient.py +++ b/nova/adminclient.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/__init__.py b/nova/auth/__init__.py index bfc5ef4d5..0d115e9d9 100644 --- a/nova/auth/__init__.py +++ b/nova/auth/__init__.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/fakeldap.py b/nova/auth/fakeldap.py index 13b2435dd..27dde314d 100644 --- a/nova/auth/fakeldap.py +++ b/nova/auth/fakeldap.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/novarc.template b/nova/auth/novarc.template index 91a3c68c8..b6d65297a 100644 --- a/nova/auth/novarc.template +++ b/nova/auth/novarc.template @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/rbac.py b/nova/auth/rbac.py index eb85a3de1..f4abd1075 100644 --- a/nova/auth/rbac.py +++ b/nova/auth/rbac.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/signer.py b/nova/auth/signer.py index 526a54262..4f7ac43bc 100644 --- a/nova/auth/signer.py +++ b/nova/auth/signer.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/slap.sh b/nova/auth/slap.sh index ac2af422f..277ae2bcd 100755 --- a/nova/auth/slap.sh +++ b/nova/auth/slap.sh @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/auth/users.py b/nova/auth/users.py index 72c3c8466..6997596aa 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/cloudpipe/__init__.py b/nova/cloudpipe/__init__.py index 5c35d696c..57ef14651 100644 --- a/nova/cloudpipe/__init__.py +++ b/nova/cloudpipe/__init__.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/cloudpipe/api.py b/nova/cloudpipe/api.py index 87283ef07..610239c2e 100644 --- a/nova/cloudpipe/api.py +++ b/nova/cloudpipe/api.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/cloudpipe/bootscript.sh b/nova/cloudpipe/bootscript.sh index 312258c22..639aad66f 100755 --- a/nova/cloudpipe/bootscript.sh +++ b/nova/cloudpipe/bootscript.sh @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/cloudpipe/client.ovpn.template b/nova/cloudpipe/client.ovpn.template index 80b5dab26..a8ec5dc6e 100644 --- a/nova/cloudpipe/client.ovpn.template +++ b/nova/cloudpipe/client.ovpn.template @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index 106a31368..09da71c64 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/compute/__init__.py b/nova/compute/__init__.py index fe8d357a3..1c688c100 100644 --- a/nova/compute/__init__.py +++ b/nova/compute/__init__.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/compute/disk.py b/nova/compute/disk.py index 84329ae55..e7090dad3 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/compute/exception.py b/nova/compute/exception.py index 829810bb0..b2bfc39e6 100644 --- a/nova/compute/exception.py +++ b/nova/compute/exception.py @@ -1,7 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. +# Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 Anso Labs, LLC diff --git a/nova/compute/fakevirtinstance.xml b/nova/compute/fakevirtinstance.xml index 88cc623a8..0df76f5ef 100644 --- a/nova/compute/fakevirtinstance.xml +++ b/nova/compute/fakevirtinstance.xml @@ -1,6 +1,6 @@