summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorvladimir.p <vladimir@zadarastorage.com>2011-08-24 16:48:04 -0700
committervladimir.p <vladimir@zadarastorage.com>2011-08-24 16:48:04 -0700
commit08af6ab6325e27b60d3d036d6e780f8e594234cc (patch)
tree08cf95e9b1a5fd8e2486357a24bab8b07781ac55 /bin
parent48cd9689de31e408c792052747f714a9dbe1f8f7 (diff)
parent96f85f94f23c9eeac3f43e122d2992b6d0938827 (diff)
downloadnova-08af6ab6325e27b60d3d036d6e780f8e594234cc.tar.gz
merged with volume_types. no code refactoring yet
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-ajax-console-proxy7
-rwxr-xr-xbin/nova-api43
-rwxr-xr-xbin/nova-api-ec247
-rwxr-xr-xbin/nova-api-os47
-rwxr-xr-xbin/nova-compute6
-rwxr-xr-xbin/nova-console5
-rwxr-xr-xbin/nova-dhcpbridge24
-rwxr-xr-xbin/nova-direct-api11
-rwxr-xr-xbin/nova-manage56
-rwxr-xr-xbin/nova-network6
-rwxr-xr-xbin/nova-objectstore15
-rwxr-xr-xbin/nova-scheduler4
-rwxr-xr-xbin/nova-vncproxy15
-rwxr-xr-xbin/nova-volume6
14 files changed, 194 insertions, 98 deletions
diff --git a/bin/nova-ajax-console-proxy b/bin/nova-ajax-console-proxy
index 2329581a23..0a789b4b9c 100755
--- a/bin/nova-ajax-console-proxy
+++ b/bin/nova-ajax-console-proxy
@@ -24,7 +24,6 @@ from eventlet import greenthread
from eventlet.green import urllib2
import exceptions
-import gettext
import os
import sys
import time
@@ -38,11 +37,11 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
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 flags
from nova import log as logging
from nova import rpc
+from nova import service
from nova import utils
from nova import wsgi
@@ -141,5 +140,5 @@ if __name__ == '__main__':
acp = AjaxConsoleProxy()
acp.register_listeners()
server = wsgi.Server("AJAX Console Proxy", acp, port=acp_port)
- server.start()
- server.wait()
+ service.serve(server)
+ service.wait()
diff --git a/bin/nova-api b/bin/nova-api
index fe8e833660..d8635978e9 100755
--- a/bin/nova-api
+++ b/bin/nova-api
@@ -19,12 +19,14 @@
"""Starter script for Nova API.
-Starts both the EC2 and OpenStack APIs in separate processes.
+Starts both the EC2 and OpenStack APIs in separate greenthreads.
"""
+import eventlet
+eventlet.monkey_patch()
+
import os
-import signal
import sys
@@ -33,32 +35,19 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(
if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
sys.path.insert(0, possible_topdir)
-import nova.service
-import nova.utils
from nova import flags
-
-
-FLAGS = flags.FLAGS
-
-
-def main():
- """Launch EC2 and OSAPI services."""
- nova.utils.Bootstrapper.bootstrap_binary(sys.argv)
-
- launcher = nova.service.Launcher()
-
- for api in FLAGS.enabled_apis:
- service = nova.service.WSGIService(api)
- launcher.launch_service(service)
-
- signal.signal(signal.SIGTERM, lambda *_: launcher.stop())
-
- try:
- launcher.wait()
- except KeyboardInterrupt:
- launcher.stop()
-
+from nova import log as logging
+from nova import service
+from nova import utils
if __name__ == '__main__':
- sys.exit(main())
+ utils.default_flagfile()
+ flags.FLAGS(sys.argv)
+ logging.setup()
+ utils.monkey_patch()
+ servers = []
+ for api in flags.FLAGS.enabled_apis:
+ servers.append(service.WSGIService(api))
+ service.serve(*servers)
+ service.wait()
diff --git a/bin/nova-api-ec2 b/bin/nova-api-ec2
new file mode 100755
index 0000000000..9f82a69e4a
--- /dev/null
+++ b/bin/nova-api-ec2
@@ -0,0 +1,47 @@
+#!/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.
+
+"""Starter script for Nova EC2 API."""
+
+import eventlet
+eventlet.monkey_patch()
+
+import os
+import sys
+
+
+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)
+
+
+from nova import flags
+from nova import log as logging
+from nova import service
+from nova import utils
+
+if __name__ == '__main__':
+ utils.default_flagfile()
+ flags.FLAGS(sys.argv)
+ logging.setup()
+ utils.monkey_patch()
+ server = service.WSGIService('ec2')
+ service.serve(server)
+ service.wait()
diff --git a/bin/nova-api-os b/bin/nova-api-os
new file mode 100755
index 0000000000..83a808987d
--- /dev/null
+++ b/bin/nova-api-os
@@ -0,0 +1,47 @@
+#!/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.
+
+"""Starter script for Nova OS API."""
+
+import eventlet
+eventlet.monkey_patch()
+
+import os
+import sys
+
+
+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)
+
+
+from nova import flags
+from nova import log as logging
+from nova import service
+from nova import utils
+
+if __name__ == '__main__':
+ utils.default_flagfile()
+ flags.FLAGS(sys.argv)
+ logging.setup()
+ utils.monkey_patch()
+ server = service.WSGIService('osapi')
+ service.serve(server)
+ service.wait()
diff --git a/bin/nova-compute b/bin/nova-compute
index cd7c78def0..0c69a81290 100755
--- a/bin/nova-compute
+++ b/bin/nova-compute
@@ -22,7 +22,6 @@
import eventlet
eventlet.monkey_patch()
-import gettext
import os
import sys
@@ -34,7 +33,6 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
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 flags
from nova import log as logging
@@ -45,5 +43,7 @@ if __name__ == '__main__':
utils.default_flagfile()
flags.FLAGS(sys.argv)
logging.setup()
- service.serve()
+ utils.monkey_patch()
+ server = service.Service.create(binary='nova-compute')
+ service.serve(server)
service.wait()
diff --git a/bin/nova-console b/bin/nova-console
index 40608b9950..22f6ef1711 100755
--- a/bin/nova-console
+++ b/bin/nova-console
@@ -21,7 +21,6 @@
import eventlet
eventlet.monkey_patch()
-import gettext
import os
import sys
@@ -33,7 +32,6 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
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 flags
from nova import log as logging
@@ -44,5 +42,6 @@ if __name__ == '__main__':
utils.default_flagfile()
flags.FLAGS(sys.argv)
logging.setup()
- service.serve()
+ server = service.Service.create(binary='nova-console')
+ service.serve(server)
service.wait()
diff --git a/bin/nova-dhcpbridge b/bin/nova-dhcpbridge
index a47ea7a761..1c9ae951e9 100755
--- a/bin/nova-dhcpbridge
+++ b/bin/nova-dhcpbridge
@@ -52,7 +52,7 @@ flags.DECLARE('update_dhcp_on_disassociate', 'nova.network.manager')
LOG = logging.getLogger('nova.dhcpbridge')
-def add_lease(mac, ip_address, _interface):
+def add_lease(mac, ip_address):
"""Set the IP that was assigned by the DHCP server."""
if FLAGS.fake_rabbit:
LOG.debug(_("leasing ip"))
@@ -66,13 +66,13 @@ def add_lease(mac, ip_address, _interface):
"args": {"address": ip_address}})
-def old_lease(mac, ip_address, interface):
+def old_lease(mac, ip_address):
"""Update just as add lease."""
LOG.debug(_("Adopted old lease or got a change of mac"))
- add_lease(mac, ip_address, interface)
+ add_lease(mac, ip_address)
-def del_lease(mac, ip_address, _interface):
+def del_lease(mac, ip_address):
"""Called when a lease expires."""
if FLAGS.fake_rabbit:
LOG.debug(_("releasing ip"))
@@ -99,8 +99,6 @@ def main():
utils.default_flagfile(flagfile)
argv = FLAGS(sys.argv)
logging.setup()
- # check ENV first so we don't break any older deploys
- network_id = int(os.environ.get('NETWORK_ID'))
if int(os.environ.get('TESTING', '0')):
from nova.tests import fake_flags
@@ -115,11 +113,19 @@ def main():
if action in ['add', 'del', 'old']:
mac = argv[2]
ip = argv[3]
- msg = _("Called %(action)s for mac %(mac)s with ip %(ip)s"
- " on interface %(interface)s") % locals()
+ msg = _("Called '%(action)s' for mac '%(mac)s' with ip '%(ip)s'") % \
+ {"action": action,
+ "mac": mac,
+ "ip": ip}
LOG.debug(msg)
- globals()[action + '_lease'](mac, ip, interface)
+ globals()[action + '_lease'](mac, ip)
else:
+ try:
+ network_id = int(os.environ.get('NETWORK_ID'))
+ except TypeError:
+ LOG.error(_("Environment variable 'NETWORK_ID' must be set."))
+ sys.exit(1)
+
print init_leases(network_id)
if __name__ == "__main__":
diff --git a/bin/nova-direct-api b/bin/nova-direct-api
index c6cf9b2ff9..106e89ba9e 100755
--- a/bin/nova-direct-api
+++ b/bin/nova-direct-api
@@ -20,7 +20,9 @@
"""Starter script for Nova Direct API."""
-import gettext
+import eventlet
+eventlet.monkey_patch()
+
import os
import sys
@@ -32,12 +34,12 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
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 compute
from nova import flags
from nova import log as logging
from nova import network
+from nova import service
from nova import utils
from nova import volume
from nova import wsgi
@@ -97,5 +99,6 @@ if __name__ == '__main__':
with_auth,
host=FLAGS.direct_host,
port=FLAGS.direct_port)
- server.start()
- server.wait()
+
+ service.serve(server)
+ service.wait()
diff --git a/bin/nova-manage b/bin/nova-manage
index d7636b8118..bd2d43139d 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -140,7 +140,7 @@ class VpnCommands(object):
help='Project name')
def list(self, project=None):
"""Print a listing of the VPN data for one or all projects."""
-
+ print "WARNING: This method only works with deprecated auth"
print "%-12s\t" % 'project',
print "%-20s\t" % 'ip:port',
print "%-20s\t" % 'private_ip',
@@ -176,17 +176,22 @@ class VpnCommands(object):
def spawn(self):
"""Run all VPNs."""
+ print "WARNING: This method only works with deprecated auth"
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)
+ self.pipe.launch_vpn_instance(p.id, p.project_manager_id)
time.sleep(10)
@args('--project', dest="project_id", metavar='<Project name>',
help='Project name')
- def run(self, project_id):
- """Start the VPN for a given project."""
- self.pipe.launch_vpn_instance(project_id)
+ @args('--user', dest="user_id", metavar='<user name>', help='User name')
+ def run(self, project_id, user_id):
+ """Start the VPN for a given project and user."""
+ if not user_id:
+ print "WARNING: This method only works with deprecated auth"
+ user_id = self.manager.get_project(project_id).project_manager_id
+ self.pipe.launch_vpn_instance(project_id, user_id)
@args('--project', dest="project_id", metavar='<Project name>',
help='Project name')
@@ -201,10 +206,6 @@ class VpnCommands(object):
"""
# TODO(tr3buchet): perhaps this shouldn't update all networks
# associated with a project in the future
- project = self.manager.get_project(project_id)
- if not project:
- print 'No project %s' % (project_id)
- return
admin_context = context.get_admin_context()
networks = db.project_get_networks(admin_context, project_id)
for network in networks:
@@ -617,6 +618,8 @@ class FixedIpCommands(object):
try:
fixed_ip = db.fixed_ip_get_by_address(ctxt, address)
+ if fixed_ip is None:
+ raise exception.NotFound('Could not find address')
db.fixed_ip_update(ctxt, fixed_ip['address'],
{'reserved': reserved})
except exception.NotFound as ex:
@@ -769,23 +772,26 @@ class NetworkCommands(object):
def list(self):
"""List all created networks"""
- print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % (
- _('IPv4'),
- _('IPv6'),
- _('start address'),
- _('DNS1'),
- _('DNS2'),
- _('VlanID'),
- 'project')
+ _fmt = "%-5s\t%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s"
+ print _fmt % (_('id'),
+ _('IPv4'),
+ _('IPv6'),
+ _('start address'),
+ _('DNS1'),
+ _('DNS2'),
+ _('VlanID'),
+ _('project'),
+ _("uuid"))
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.cidr_v6,
- network.dhcp_start,
- network.dns1,
- network.dns2,
- network.vlan,
- network.project_id)
+ print _fmt % (network.id,
+ network.cidr,
+ network.cidr_v6,
+ network.dhcp_start,
+ network.dns1,
+ network.dns2,
+ network.vlan,
+ network.project_id,
+ network.uuid)
@args('--network', dest="fixed_range", metavar='<x.x.x.x/yy>',
help='Network to delete')
diff --git a/bin/nova-network b/bin/nova-network
index 101761ef78..0f1482515b 100755
--- a/bin/nova-network
+++ b/bin/nova-network
@@ -22,7 +22,6 @@
import eventlet
eventlet.monkey_patch()
-import gettext
import os
import sys
@@ -34,7 +33,6 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
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 flags
from nova import log as logging
@@ -45,5 +43,7 @@ if __name__ == '__main__':
utils.default_flagfile()
flags.FLAGS(sys.argv)
logging.setup()
- service.serve()
+ utils.monkey_patch()
+ server = service.Service.create(binary='nova-network')
+ service.serve(server)
service.wait()
diff --git a/bin/nova-objectstore b/bin/nova-objectstore
index 4d5aec4450..757301c24d 100755
--- a/bin/nova-objectstore
+++ b/bin/nova-objectstore
@@ -17,11 +17,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-"""
- Daemon for nova objectstore. Supports S3 API.
-"""
+"""Daemon for nova objectstore. Supports S3 API."""
+
+import eventlet
+eventlet.monkey_patch()
-import gettext
import os
import sys
@@ -33,10 +33,10 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
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 flags
from nova import log as logging
+from nova import service
from nova import utils
from nova import wsgi
from nova.objectstore import s3server
@@ -49,10 +49,11 @@ if __name__ == '__main__':
utils.default_flagfile()
FLAGS(sys.argv)
logging.setup()
+ utils.monkey_patch()
router = s3server.S3Application(FLAGS.buckets_path)
server = wsgi.Server("S3 Objectstore",
router,
port=FLAGS.s3_port,
host=FLAGS.s3_host)
- server.start()
- server.wait()
+ service.serve(server)
+ service.wait()
diff --git a/bin/nova-scheduler b/bin/nova-scheduler
index 0c205a80f3..c1033a3040 100755
--- a/bin/nova-scheduler
+++ b/bin/nova-scheduler
@@ -45,5 +45,7 @@ if __name__ == '__main__':
utils.default_flagfile()
flags.FLAGS(sys.argv)
logging.setup()
- service.serve()
+ utils.monkey_patch()
+ server = service.Service.create(binary='nova-scheduler')
+ service.serve(server)
service.wait()
diff --git a/bin/nova-vncproxy b/bin/nova-vncproxy
index bdbb30a7fc..dc08e24334 100755
--- a/bin/nova-vncproxy
+++ b/bin/nova-vncproxy
@@ -19,7 +19,8 @@
"""VNC Console Proxy Server."""
import eventlet
-import gettext
+eventlet.monkey_patch()
+
import os
import sys
@@ -29,7 +30,6 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
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 flags
from nova import log as logging
@@ -41,7 +41,7 @@ from nova.vnc import auth
from nova.vnc import proxy
-LOG = logging.getLogger('nova.vnc-proxy')
+LOG = logging.getLogger('nova.vncproxy')
FLAGS = flags.FLAGS
@@ -81,7 +81,7 @@ if __name__ == "__main__":
FLAGS(sys.argv)
logging.setup()
- LOG.audit(_("Starting nova-vnc-proxy node (version %s)"),
+ LOG.audit(_("Starting nova-vncproxy node (version %s)"),
version.version_string_with_vcs())
if not (os.path.exists(FLAGS.vncproxy_wwwroot) and
@@ -107,13 +107,10 @@ if __name__ == "__main__":
else:
with_auth = auth.VNCNovaAuthMiddleware(with_logging)
- service.serve()
-
server = wsgi.Server("VNC Proxy",
with_auth,
host=FLAGS.vncproxy_host,
port=FLAGS.vncproxy_port)
- server.start()
server.start_tcp(handle_flash_socket_policy, 843, host=FLAGS.vncproxy_host)
-
- server.wait()
+ service.serve(server)
+ service.wait()
diff --git a/bin/nova-volume b/bin/nova-volume
index 8dcdbc500e..8caa0f44a9 100755
--- a/bin/nova-volume
+++ b/bin/nova-volume
@@ -22,7 +22,6 @@
import eventlet
eventlet.monkey_patch()
-import gettext
import os
import sys
@@ -34,7 +33,6 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
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 flags
from nova import log as logging
@@ -45,5 +43,7 @@ if __name__ == '__main__':
utils.default_flagfile()
flags.FLAGS(sys.argv)
logging.setup()
- service.serve()
+ utils.monkey_patch()
+ server = service.Service.create(binary='nova-volume')
+ service.serve(server)
service.wait()