diff options
| author | Soren Hansen <soren@linux2go.dk> | 2011-08-09 22:20:53 +0100 |
|---|---|---|
| committer | Soren Hansen <soren@linux2go.dk> | 2011-08-09 22:20:53 +0100 |
| commit | adc4d2dc71b6dcdad4bca57925f89d7344a613e8 (patch) | |
| tree | fd996b679318d453e1e742b7c4d514e3675348e3 /bin | |
| parent | 1d269ad0b9a8bc7d30ff1f91faa9afe465f87e98 (diff) | |
| parent | d6943d72525fd6a48bc9b3407bc90d9da7f99ad9 (diff) | |
| download | nova-adc4d2dc71b6dcdad4bca57925f89d7344a613e8.tar.gz nova-adc4d2dc71b6dcdad4bca57925f89d7344a613e8.tar.xz nova-adc4d2dc71b6dcdad4bca57925f89d7344a613e8.zip | |
Merge trunk
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/nova-ajax-console-proxy | 10 | ||||
| -rwxr-xr-x | bin/nova-instancemonitor | 59 | ||||
| -rw-r--r-- | bin/nova-logspool | 1 | ||||
| -rwxr-xr-x | bin/nova-manage | 64 | ||||
| -rwxr-xr-x | bin/nova-objectstore | 2 |
5 files changed, 52 insertions, 84 deletions
diff --git a/bin/nova-ajax-console-proxy b/bin/nova-ajax-console-proxy index 21cf68007..2329581a2 100755 --- a/bin/nova-ajax-console-proxy +++ b/bin/nova-ajax-console-proxy @@ -114,11 +114,11 @@ class AjaxConsoleProxy(object): AjaxConsoleProxy.tokens[kwargs['token']] = \ {'args': kwargs, 'last_activity': time.time()} - conn = rpc.Connection.instance(new=True) - consumer = rpc.TopicAdapterConsumer( - connection=conn, - proxy=TopicProxy, - topic=FLAGS.ajax_console_proxy_topic) + conn = rpc.create_connection(new=True) + consumer = rpc.create_consumer( + conn, + FLAGS.ajax_console_proxy_topic, + TopicProxy) def delete_expired_tokens(): now = time.time() diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor deleted file mode 100755 index b9d4e49d7..000000000 --- a/bin/nova-instancemonitor +++ /dev/null @@ -1,59 +0,0 @@ -#!/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. -# -# Licensed under the Apache License, Version 2.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 gettext -import os -import sys -from twisted.application import service - -# If ../nova/__init__.py exists, add ../ to Python search path, so that -# it will override what happens to be installed in /usr/(local/)lib/python... -possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), - os.pardir, - os.pardir)) -if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): - sys.path.insert(0, possible_topdir) - -gettext.install('nova', unicode=1) - -from nova import log as logging -from nova import utils -from nova import twistd -from nova.compute import monitor - -LOG = logging.getLogger('nova.instancemonitor') - - -if __name__ == '__main__': - utils.default_flagfile() - twistd.serve(__file__) - -if __name__ == '__builtin__': - LOG.warn(_('Starting instance monitor')) - # pylint: disable=C0103 - monitor = 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') - monitor.setServiceParent(application) diff --git a/bin/nova-logspool b/bin/nova-logspool index 097459b12..a876f4c71 100644 --- a/bin/nova-logspool +++ b/bin/nova-logspool @@ -81,7 +81,6 @@ class LogReader(object): if level == 'ERROR': self.handle_logged_error(line) elif level == '[-]' and self.last_error: - # twisted stack trace line clean_line = " ".join(line.split(" ")[6:]) self.last_error.trace = self.last_error.trace + clean_line else: diff --git a/bin/nova-manage b/bin/nova-manage index 75d74903c..40f22c19c 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -56,6 +56,7 @@ import gettext import glob import json +import math import netaddr import os import sys @@ -591,6 +592,31 @@ class FixedIpCommands(object): fixed_ip['address'], mac_address, hostname, host) + @args('--address', dest="address", metavar='<ip address>', + help='IP address') + def reserve(self, address): + """Mark fixed ip as reserved + arguments: address""" + self._set_reserved(address, True) + + @args('--address', dest="address", metavar='<ip address>', + help='IP address') + def unreserve(self, address): + """Mark fixed ip as free to use + arguments: address""" + self._set_reserved(address, False) + + def _set_reserved(self, address, reserved): + ctxt = context.get_admin_context() + + try: + fixed_ip = db.fixed_ip_get_by_address(ctxt, address) + db.fixed_ip_update(ctxt, fixed_ip['address'], + {'reserved': reserved}) + except exception.NotFound as ex: + print "error: %s" % ex + sys.exit(2) + class FloatingIpCommands(object): """Class for managing floating ip.""" @@ -662,8 +688,9 @@ class NetworkCommands(object): # check for certain required inputs if not label: raise exception.NetworkNotCreated(req='--label') - if not fixed_range_v4: - raise exception.NetworkNotCreated(req='--fixed_range_v4') + if not (fixed_range_v4 or fixed_range_v6): + req = '--fixed_range_v4 or --fixed_range_v6' + raise exception.NetworkNotCreated(req=req) bridge = bridge or FLAGS.flat_network_bridge if not bridge: @@ -689,21 +716,21 @@ class NetworkCommands(object): if FLAGS.network_manager in interface_required: raise exception.NetworkNotCreated(req='--bridge_interface') - if FLAGS.use_ipv6: - fixed_range_v6 = fixed_range_v6 or FLAGS.fixed_range_v6 - if not fixed_range_v6: - raise exception.NetworkNotCreated(req='with use_ipv6, ' - '--fixed_range_v6') - gateway_v6 = gateway_v6 or FLAGS.gateway_v6 - if not gateway_v6: - raise exception.NetworkNotCreated(req='with use_ipv6, ' - '--gateway_v6') - # sanitize other input using FLAGS if necessary if not num_networks: num_networks = FLAGS.num_networks if not network_size: - network_size = FLAGS.network_size + fixnet = netaddr.IPNetwork(fixed_range_v4) + each_subnet_size = fixnet.size / int(num_networks) + if each_subnet_size > FLAGS.network_size: + network_size = FLAGS.network_size + subnet = 32 - int(math.log(network_size, 2)) + oversize_msg = _('Subnet(s) too large, defaulting to /%s.' + ' To override, specify network_size flag.' + ) % subnet + print oversize_msg + else: + network_size = fixnet.size if not multi_host: multi_host = FLAGS.multi_host else: @@ -735,8 +762,8 @@ class NetworkCommands(object): def list(self): """List all created networks""" print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % ( - _('network'), - _('netmask'), + _('IPv4'), + _('IPv6'), _('start address'), _('DNS1'), _('DNS2'), @@ -745,7 +772,7 @@ class NetworkCommands(object): for network in db.network_get_all(context.get_admin_context()): print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % ( network.cidr, - network.netmask, + network.cidr_v6, network.dhcp_start, network.dns1, network.dns2, @@ -1233,11 +1260,12 @@ class ImageCommands(object): is_public, architecture) def _lookup(self, old_image_id): + elevated = context.get_admin_context() try: internal_id = ec2utils.ec2_id_to_id(old_image_id) - image = self.image_service.show(context, internal_id) + image = self.image_service.show(elevated, internal_id) except (exception.InvalidEc2Id, exception.ImageNotFound): - image = self.image_service.show_by_name(context, old_image_id) + image = self.image_service.show_by_name(elevated, old_image_id) return image['id'] def _old_to_new(self, old): diff --git a/bin/nova-objectstore b/bin/nova-objectstore index 1aef3a255..4d5aec445 100755 --- a/bin/nova-objectstore +++ b/bin/nova-objectstore @@ -18,7 +18,7 @@ # under the License. """ - Twisted daemon for nova objectstore. Supports S3 API. + Daemon for nova objectstore. Supports S3 API. """ import gettext |
