summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJason Koelker <jason@koelker.net>2011-08-15 15:24:57 -0500
committerJason Koelker <jason@koelker.net>2011-08-15 15:24:57 -0500
commit3ff86b8bc57bf9c66bfa6b4dc705f3e51952b521 (patch)
treec3672e81dbc5cd8a8cf9d3dfac1d6e6be45b272f /bin
parenta256b3718c3e2f44563ca3422820b29dc9e23c74 (diff)
parent2ed3b12cc8da82304cef88dde64631b6348ee60e (diff)
merge trunk, remove _validate_cidrs and replace functionality with a double for loop
Diffstat (limited to 'bin')
-rwxr-xr-xbin/clear_rabbit_queues73
-rwxr-xr-xbin/nova-dhcpbridge17
-rwxr-xr-xbin/nova-manage14
3 files changed, 92 insertions, 12 deletions
diff --git a/bin/clear_rabbit_queues b/bin/clear_rabbit_queues
new file mode 100755
index 000000000..7a000e5d8
--- /dev/null
+++ b/bin/clear_rabbit_queues
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (c) 2011 Openstack, LLC.
+# 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.
+
+"""Admin/debug script to wipe rabbitMQ (AMQP) queues nova uses.
+ This can be used if you need to change durable options on queues,
+ or to wipe all messages in the queue system if things are in a
+ serious bad way.
+
+"""
+
+import datetime
+import gettext
+import os
+import sys
+import time
+
+# 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 context
+from nova import exception
+from nova import flags
+from nova import log as logging
+from nova import rpc
+from nova import utils
+
+
+FLAGS = flags.FLAGS
+flags.DEFINE_boolean('delete_exchange', False, 'delete nova exchange too.')
+
+
+def delete_exchange(exch):
+ conn = rpc.create_connection()
+ x = conn.get_channel()
+ x.exchange_delete(exch)
+
+
+def delete_queues(queues):
+ conn = rpc.create_connection()
+ x = conn.get_channel()
+ for q in queues:
+ x.queue_delete(q)
+
+if __name__ == '__main__':
+ utils.default_flagfile()
+ args = flags.FLAGS(sys.argv)
+ logging.setup()
+ delete_queues(args[1:])
+ if FLAGS.delete_exchange:
+ delete_exchange(FLAGS.control_exchange)
diff --git a/bin/nova-dhcpbridge b/bin/nova-dhcpbridge
index 325642d52..621222d8f 100755
--- a/bin/nova-dhcpbridge
+++ b/bin/nova-dhcpbridge
@@ -53,7 +53,7 @@ flags.DEFINE_string('dnsmasq_interface', 'br0', 'Default Dnsmasq interface')
LOG = logging.getLogger('nova.dhcpbridge')
-def add_lease(mac, ip_address, _hostname, _interface):
+def add_lease(mac, ip_address, _interface):
"""Set the IP that was assigned by the DHCP server."""
if FLAGS.fake_rabbit:
LOG.debug(_("leasing ip"))
@@ -67,13 +67,13 @@ def add_lease(mac, ip_address, _hostname, _interface):
"args": {"address": ip_address}})
-def old_lease(mac, ip_address, hostname, interface):
+def old_lease(mac, ip_address, interface):
"""Update just as add lease."""
- LOG.debug(_("Adopted old lease or got a change of mac/hostname"))
- add_lease(mac, ip_address, hostname, interface)
+ LOG.debug(_("Adopted old lease or got a change of mac"))
+ add_lease(mac, ip_address, interface)
-def del_lease(mac, ip_address, _hostname, _interface):
+def del_lease(mac, ip_address, _interface):
"""Called when a lease expires."""
if FLAGS.fake_rabbit:
LOG.debug(_("releasing ip"))
@@ -115,11 +115,10 @@ def main():
if action in ['add', 'del', 'old']:
mac = argv[2]
ip = argv[3]
- hostname = argv[4]
- msg = _("Called %(action)s for mac %(mac)s with ip %(ip)s and"
- " hostname %(hostname)s on interface %(interface)s") % locals()
+ msg = _("Called %(action)s for mac %(mac)s with ip %(ip)s"
+ " on interface %(interface)s") % locals()
LOG.debug(msg)
- globals()[action + '_lease'](mac, ip, hostname, interface)
+ globals()[action + '_lease'](mac, ip, interface)
else:
print init_leases(interface)
diff --git a/bin/nova-manage b/bin/nova-manage
index 25655125d..8bc4c0f2a 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -885,6 +885,14 @@ class ServiceCommands(object):
services = [s for s in services if s['host'] == host]
if service:
services = [s for s in services if s['binary'] == service]
+ print_format = "%-16s %-36s %-16s %-10s %-5s %-10s"
+ print print_format % (
+ _('Binary'),
+ _('Host'),
+ _('Zone'),
+ _('Status'),
+ _('State'),
+ _('Updated_At'))
for svc in services:
delta = now - (svc['updated_at'] or svc['created_at'])
alive = (delta.seconds <= 15)
@@ -892,9 +900,9 @@ class ServiceCommands(object):
active = 'enabled'
if svc['disabled']:
active = 'disabled'
- print "%-10s %-10s %-8s %s %s" % (svc['host'], svc['binary'],
- active, art,
- svc['updated_at'])
+ print print_format % (svc['binary'], svc['host'],
+ svc['availability_zone'], active, art,
+ svc['updated_at'])
@args('--host', dest='host', metavar='<host>', help='Host')
@args('--service', dest='service', metavar='<service>',