diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-07-18 13:25:43 -0500 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-07-18 13:25:43 -0500 |
| commit | 5d647826d6345bfdd87bad10995319679f39679f (patch) | |
| tree | 979b3fa11717c38b868b08239cbf3a50b4e27f49 /nova/compute | |
| parent | 0b396e1315a76112ab978a677e96d7b3a371faa9 (diff) | |
| parent | b09e69c5579526fcc1a08c7e3c3a3c880fa09297 (diff) | |
merged in trunk and fixed import merge errors
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/disk.py | 3 | ||||
| -rw-r--r-- | nova/compute/exception.py | 1 | ||||
| -rw-r--r-- | nova/compute/linux_net.py | 3 | ||||
| -rw-r--r-- | nova/compute/model.py | 2 | ||||
| -rw-r--r-- | nova/compute/monitor.py | 16 | ||||
| -rw-r--r-- | nova/compute/network.py | 21 | ||||
| -rw-r--r-- | nova/compute/node.py | 6 |
7 files changed, 27 insertions, 25 deletions
diff --git a/nova/compute/disk.py b/nova/compute/disk.py index b24a90d7f..08a22556e 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -24,12 +24,11 @@ Includes injection of SSH PGP keys into authorized_keys file. import logging import os import tempfile - -from nova import vendor from twisted.internet import defer 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 diff --git a/nova/compute/exception.py b/nova/compute/exception.py index fefa7451d..13e4f0a51 100644 --- a/nova/compute/exception.py +++ b/nova/compute/exception.py @@ -22,6 +22,7 @@ Exceptions for Compute Node errors, mostly network addressing. from nova.exception import Error + class NoMoreAddresses(Error): pass diff --git a/nova/compute/linux_net.py b/nova/compute/linux_net.py index 2e5f2519f..eb9614194 100644 --- a/nova/compute/linux_net.py +++ b/nova/compute/linux_net.py @@ -19,11 +19,12 @@ import logging import signal import os -import nova.utils import subprocess # todo(ja): does the definition of network_path belong here? +from nova import utils + from nova import flags FLAGS=flags.FLAGS diff --git a/nova/compute/model.py b/nova/compute/model.py index f1eb99e74..cda188183 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -42,8 +42,6 @@ True import logging import time - -from nova import vendor import redis from nova import datastore diff --git a/nova/compute/monitor.py b/nova/compute/monitor.py index b9fe20a71..fdc86b031 100644 --- a/nova/compute/monitor.py +++ b/nova/compute/monitor.py @@ -24,11 +24,18 @@ Instance Monitoring: in the object store. """ +import boto +import boto.s3 import datetime +import libxml2 import logging import os +import rrdtool import sys import time +from twisted.internet import defer +from twisted.internet import task +from twisted.application import service try: import libvirt @@ -36,14 +43,7 @@ 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( diff --git a/nova/compute/network.py b/nova/compute/network.py index 3904fcff0..bdb8a22f9 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -20,22 +20,19 @@ Classes for network control, including VLANs, DHCP, and IP allocation. """ +import IPy import logging import os import time -# TODO(termie): clean up these imports -from nova import vendor -import IPy - from nova import datastore +from nova import exception from nova import flags from nova import utils -from nova import exception -from nova.compute import exception as compute_exception from nova.auth import users +from nova.compute import exception as compute_exception +from nova.compute import linux_net -import linux_net FLAGS = flags.FLAGS flags.DEFINE_string('networks_path', utils.abspath('../networks'), @@ -130,8 +127,9 @@ class Vlan(datastore.BasicModel): @datastore.absorb_connection_error def all(cls): set_name = cls._redis_set_name(cls.__name__) - for project,vlan in datastore.Redis.instance().hgetall(set_name): - yield cls(project, vlan) + elements = datastore.Redis.instance().hgetall(set_name) + for project in elements: + yield cls(project, elements[project]) @datastore.absorb_connection_error def save(self): @@ -291,6 +289,7 @@ class BridgedNetwork(BaseNetwork): netmask """ + bridge_gets_ip = False override_type = 'network' @classmethod @@ -532,6 +531,10 @@ def get_vlan_for_project(project_id): return Vlan.create(project_id, vnum) raise compute_exception.AddressNotAllocated("Out of VLANs") +def get_network_by_interface(iface, security_group='default'): + vlan = iface.rpartition("br")[2] + return get_project_network(Vlan.dict_by_vlan().get(vlan), security_group) + def get_network_by_address(address): logging.debug("Get Network By Address: %s" % address) for project in users.UserManager.instance().get_projects(): diff --git a/nova/compute/node.py b/nova/compute/node.py index 7e4277f58..d681ec661 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -30,12 +30,11 @@ import logging import os import shutil import sys - -from nova import vendor from twisted.internet import defer from twisted.internet import task from twisted.application import service + try: import libvirt except Exception, err: @@ -49,8 +48,9 @@ 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 +from nova.volume import storage + FLAGS = flags.FLAGS flags.DEFINE_string('libvirt_xml_template', |
