summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorEric Day <eday@oddments.org>2010-08-07 14:45:36 -0700
committerEric Day <eday@oddments.org>2010-08-07 14:45:36 -0700
commitff47d384a4be8627a32ee8e34dddc5bd005ac063 (patch)
tree4e2ca3073e85e69262d5b6a0be1e09919ded43bc /bin
parentb77d261b0288f89d2b25a52e7ad7c8073e357cb1 (diff)
parentc0c2f5851ab70ee91f1a271a6c32a84315c1e831 (diff)
Merged trunk.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-dhcpbridge22
-rwxr-xr-xbin/nova-manage23
-rwxr-xr-xbin/nova-network6
3 files changed, 28 insertions, 23 deletions
diff --git a/bin/nova-dhcpbridge b/bin/nova-dhcpbridge
index 0db241b5e..b3e7d456a 100755
--- a/bin/nova-dhcpbridge
+++ b/bin/nova-dhcpbridge
@@ -35,32 +35,34 @@ sys.path.append(os.path.abspath(os.path.join(__file__, "../../")))
from nova import flags
from nova import rpc
from nova import utils
-from nova.compute import linux_net
-from nova.compute import network
-
+from nova.network import linux_net
+from nova.network import model
+from nova.network import service
FLAGS = flags.FLAGS
def add_lease(mac, ip, hostname, interface):
if FLAGS.fake_rabbit:
- network.lease_ip(ip)
+ service.VlanNetworkService().lease_ip(ip)
else:
- rpc.cast(FLAGS.cloud_topic, {"method": "lease_ip",
- "args" : {"address": ip}})
+ rpc.cast("%s.%s" (FLAGS.network_topic, FLAGS.node_name),
+ {"method": "lease_ip",
+ "args" : {"fixed_ip": ip}})
def old_lease(mac, ip, hostname, interface):
logging.debug("Adopted old lease or got a change of mac/hostname")
def del_lease(mac, ip, hostname, interface):
if FLAGS.fake_rabbit:
- network.release_ip(ip)
+ service.VlanNetworkService().release_ip(ip)
else:
- rpc.cast(FLAGS.cloud_topic, {"method": "release_ip",
- "args" : {"address": ip}})
+ rpc.cast("%s.%s" (FLAGS.network_topic, FLAGS.node_name),
+ {"method": "release_ip",
+ "args" : {"fixed_ip": ip}})
def init_leases(interface):
- net = network.get_network_by_interface(interface)
+ net = model.get_network_by_interface(interface)
res = ""
for host_name in net.hosts:
res += "%s\n" % linux_net.hostDHCP(net, host_name, net.hosts[host_name])
diff --git a/bin/nova-manage b/bin/nova-manage
index b0f0029ed..7835c7a77 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -29,16 +29,12 @@ from nova import flags
from nova import utils
from nova.auth import manager
from nova.compute import model
-from nova.compute import network
from nova.cloudpipe import pipelib
from nova.endpoint import cloud
FLAGS = flags.FLAGS
-class NetworkCommands(object):
- def restart(self):
- network.restart_nets()
class VpnCommands(object):
def __init__(self):
@@ -170,6 +166,13 @@ class ProjectCommands(object):
arguments: name"""
self.manager.delete_project(name)
+ def environment(self, project_id, user_id, filename='novarc'):
+ """exports environment variables to an sourcable file
+ arguments: project_id user_id [filename='novarc]"""
+ rc = self.manager.get_environment_rc(project_id, user_id)
+ with open(filename, 'w') as f:
+ f.write(rc)
+
def list(self):
"""lists all projects
arguments: <none>"""
@@ -182,14 +185,11 @@ class ProjectCommands(object):
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
+ """exports credentials for project to a zip file
arguments: project_id user_id [filename='nova.zip]"""
- project = self.manager.get_project(project_id)
- if project:
- with open(filename, 'w') as f:
- f.write(project.get_credentials(user_id))
- else:
- print "Project %s doesn't exist" % project
+ zip = self.manager.get_credentials(project_id, user_id)
+ with open(filename, 'w') as f:
+ f.write(zip)
def usage(script_name):
@@ -197,7 +197,6 @@ def usage(script_name):
categories = [
- ('network', NetworkCommands),
('user', UserCommands),
('project', ProjectCommands),
('role', RoleCommands),
diff --git a/bin/nova-network b/bin/nova-network
index 52d6cb70a..ba9063f56 100755
--- a/bin/nova-network
+++ b/bin/nova-network
@@ -21,12 +21,16 @@
Twistd daemon for the nova network nodes.
"""
+from nova import flags
from nova import twistd
+
from nova.network import service
+FLAGS = flags.FLAGS
+
if __name__ == '__main__':
twistd.serve(__file__)
if __name__ == '__builtin__':
- application = service.NetworkService.create()
+ application = service.type_to_class(FLAGS.network_type).create()