diff options
-rw-r--r-- | nova/network/api.py | 18 | ||||
-rw-r--r-- | nova/network/dns_driver.py | 2 | ||||
-rw-r--r-- | nova/network/l3.py | 14 | ||||
-rw-r--r-- | nova/network/linux_net.py | 8 | ||||
-rw-r--r-- | nova/network/manager.py | 56 | ||||
-rw-r--r-- | nova/network/model.py | 24 | ||||
-rw-r--r-- | nova/network/noop_dns_driver.py | 2 | ||||
-rw-r--r-- | nova/network/nova_ipam_lib.py | 2 | ||||
-rw-r--r-- | nova/network/quantumv2/api.py | 8 |
9 files changed, 67 insertions, 67 deletions
diff --git a/nova/network/api.py b/nova/network/api.py index ecc63ba79..ec58e1101 100644 --- a/nova/network/api.py +++ b/nova/network/api.py @@ -140,7 +140,7 @@ class API(base.Base): return self.network_rpcapi.get_vif_by_mac_address(context, mac_address) def allocate_floating_ip(self, context, pool=None): - """Adds a floating ip to a project from a pool. (allocates)""" + """Adds (allocates) a floating ip to a project from a pool.""" # NOTE(vish): We don't know which network host should get the ip # when we allocate, so just send it to any one. This # will probably need to move into a network supervisor @@ -150,7 +150,7 @@ class API(base.Base): def release_floating_ip(self, context, address, affect_auto_assigned=False): - """Removes floating ip with address from a project. (deallocates)""" + """Removes (deallocates) a floating ip with address from a project.""" return self.network_rpcapi.deallocate_floating_ip(context, address, affect_auto_assigned) @@ -235,7 +235,7 @@ class API(base.Base): def associate(self, context, network_uuid, host=_sentinel, project=_sentinel): - """Associate or disassociate host or project to network""" + """Associate or disassociate host or project to network.""" associations = {} if host is not API._sentinel: associations['host'] = host @@ -280,7 +280,7 @@ class API(base.Base): return self.network_rpcapi.get_dns_domains(context) def add_dns_entry(self, context, address, name, dns_type, domain): - """Create specified DNS entry for address""" + """Create specified DNS entry for address.""" args = {'address': address, 'name': name, 'dns_type': dns_type, @@ -288,7 +288,7 @@ class API(base.Base): return self.network_rpcapi.add_dns_entry(context, **args) def modify_dns_entry(self, context, name, address, domain): - """Create specified DNS entry for address""" + """Create specified DNS entry for address.""" args = {'address': address, 'name': name, 'domain': domain} @@ -304,12 +304,12 @@ class API(base.Base): return self.network_rpcapi.delete_dns_domain(context, domain=domain) def get_dns_entries_by_address(self, context, address, domain): - """Get entries for address and domain""" + """Get entries for address and domain.""" args = {'address': address, 'domain': domain} return self.network_rpcapi.get_dns_entries_by_address(context, **args) def get_dns_entries_by_name(self, context, name, domain): - """Get entries for name and domain""" + """Get entries for name and domain.""" args = {'name': name, 'domain': domain} return self.network_rpcapi.get_dns_entries_by_name(context, **args) @@ -353,7 +353,7 @@ class API(base.Base): return [floating_ip['address'] for floating_ip in floating_ips] def migrate_instance_start(self, context, instance, migration): - """Start to migrate the network of an instance""" + """Start to migrate the network of an instance.""" args = dict( instance_uuid=instance['uuid'], rxtx_factor=instance['instance_type']['rxtx_factor'], @@ -371,7 +371,7 @@ class API(base.Base): self.network_rpcapi.migrate_instance_start(context, **args) def migrate_instance_finish(self, context, instance, migration): - """Finish migrating the network of an instance""" + """Finish migrating the network of an instance.""" args = dict( instance_uuid=instance['uuid'], rxtx_factor=instance['instance_type']['rxtx_factor'], diff --git a/nova/network/dns_driver.py b/nova/network/dns_driver.py index 6e7cbf556..07b690b91 100644 --- a/nova/network/dns_driver.py +++ b/nova/network/dns_driver.py @@ -14,7 +14,7 @@ class DNSDriver(object): - """Defines the DNS manager interface. Does nothing. """ + """Defines the DNS manager interface. Does nothing.""" def __init__(self): pass diff --git a/nova/network/l3.py b/nova/network/l3.py index bea1c3e6a..baf77c112 100644 --- a/nova/network/l3.py +++ b/nova/network/l3.py @@ -23,29 +23,29 @@ LOG = logging.getLogger(__name__) class L3Driver(object): - """Abstract class that defines a generic L3 API""" + """Abstract class that defines a generic L3 API.""" def __init__(self, l3_lib=None): raise NotImplementedError() def initialize(self, **kwargs): - """Set up basic L3 networking functionality""" + """Set up basic L3 networking functionality.""" raise NotImplementedError() def initialize_network(self, network): - """Enable rules for a specific network""" + """Enable rules for a specific network.""" raise NotImplementedError() def initialize_gateway(self, network): - """Set up a gateway on this network""" + """Set up a gateway on this network.""" raise NotImplementedError() def remove_gateway(self, network_ref): - """Remove an existing gateway on this network""" + """Remove an existing gateway on this network.""" raise NotImplementedError() def is_initialized(self): - """:returns: True/False (whether the driver is initialized)""" + """:returns: True/False (whether the driver is initialized).""" raise NotImplementedError() def add_floating_ip(self, floating_ip, fixed_ip, l3_interface_id): @@ -68,7 +68,7 @@ class L3Driver(object): class LinuxNetL3(L3Driver): - """L3 driver that uses linux_net as the backend""" + """L3 driver that uses linux_net as the backend.""" def __init__(self): self.initialized = False diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index 215dd0092..f4b39e553 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -1140,15 +1140,15 @@ class LinuxNetInterfaceDriver(object): """ def plug(self, network, mac_address): - """Create Linux device, return device name""" + """Create Linux device, return device name.""" raise NotImplementedError() def unplug(self, network): - """Destory Linux device, return device name""" + """Destory Linux device, return device name.""" raise NotImplementedError() def get_dev(self, network): - """Get device name""" + """Get device name.""" raise NotImplementedError() @@ -1242,7 +1242,7 @@ class LinuxBridgeInterfaceDriver(LinuxNetInterfaceDriver): @classmethod @lockutils.synchronized('lock_vlan', 'nova-', external=True) def remove_vlan(cls, vlan_num): - """Delete a vlan""" + """Delete a vlan.""" vlan_interface = 'vlan%s' % vlan_num if not device_exists(vlan_interface): return diff --git a/nova/network/manager.py b/nova/network/manager.py index e263ac730..a0b7ca9d1 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -281,7 +281,7 @@ class RPCAllocateFixedIP(object): def wrap_check_policy(func): - """Check policy corresponding to the wrapped methods prior to execution""" + """Check policy corresponding to the wrapped methods prior to execution.""" @functools.wraps(func) def wrapped(self, context, *args, **kwargs): @@ -423,7 +423,7 @@ class FloatingIP(object): super(FloatingIP, self).deallocate_for_instance(context, **kwargs) def _floating_ip_owned_by_project(self, context, floating_ip): - """Raises if floating ip does not belong to project""" + """Raises if floating ip does not belong to project.""" if context.is_admin: return @@ -584,7 +584,7 @@ class FloatingIP(object): def _associate_floating_ip(self, context, floating_address, fixed_address, interface, instance_uuid): - """Performs db and driver calls to associate floating ip & fixed ip""" + """Performs db and driver calls to associate floating ip & fixed ip.""" @lockutils.synchronized(unicode(floating_address), 'nova-') def do_associate(): @@ -671,7 +671,7 @@ class FloatingIP(object): def _disassociate_floating_ip(self, context, address, interface, instance_uuid): - """Performs db and driver calls to disassociate floating ip""" + """Performs db and driver calls to disassociate floating ip.""" # disassociate floating ip @lockutils.synchronized(unicode(address), 'nova-') @@ -704,31 +704,31 @@ class FloatingIP(object): @rpc_common.client_exceptions(exception.FloatingIpNotFound) @wrap_check_policy def get_floating_ip(self, context, id): - """Returns a floating IP as a dict""" + """Returns a floating IP as a dict.""" return dict(self.db.floating_ip_get(context, id).iteritems()) @wrap_check_policy def get_floating_pools(self, context): - """Returns list of floating pools""" + """Returns list of floating pools.""" pools = self.db.floating_ip_get_pools(context) return [dict(pool.iteritems()) for pool in pools] @wrap_check_policy def get_floating_ip_by_address(self, context, address): - """Returns a floating IP as a dict""" + """Returns a floating IP as a dict.""" return dict(self.db.floating_ip_get_by_address(context, address).iteritems()) @wrap_check_policy def get_floating_ips_by_project(self, context): - """Returns the floating IPs allocated to a project""" + """Returns the floating IPs allocated to a project.""" ips = self.db.floating_ip_get_all_by_project(context, context.project_id) return [dict(ip.iteritems()) for ip in ips] @wrap_check_policy def get_floating_ips_by_fixed_address(self, context, fixed_address): - """Returns the floating IPs associated with a fixed_address""" + """Returns the floating IPs associated with a fixed_address.""" floating_ips = self.db.floating_ip_get_by_fixed_address(context, fixed_address) return [floating_ip['address'] for floating_ip in floating_ips] @@ -988,7 +988,7 @@ class NetworkManager(manager.SchedulerDependentManager): host=host) def get_dhcp_leases(self, ctxt, network_ref): - """Broker the request to the driver to fetch the dhcp leases""" + """Broker the request to the driver to fetch the dhcp leases.""" return self.driver.get_dhcp_leases(ctxt, network_ref) def init_host(self): @@ -1300,7 +1300,7 @@ class NetworkManager(manager.SchedulerDependentManager): return nw_info def _get_network_dict(self, network): - """Returns the dict representing necessary and meta network fields""" + """Returns the dict representing necessary and meta network fields.""" # get generic network fields network_dict = {'id': network['uuid'], 'bridge': network['bridge'], @@ -1315,7 +1315,7 @@ class NetworkManager(manager.SchedulerDependentManager): def _get_subnets_from_network(self, context, network, vif, instance_host=None): - """Returns the 1 or 2 possible subnets for a nova network""" + """Returns the 1 or 2 possible subnets for a nova network.""" # get subnets ipam_subnets = self.ipam.get_subnets_by_net_id(context, network['project_id'], network['uuid'], vif['uuid']) @@ -1392,7 +1392,7 @@ class NetworkManager(manager.SchedulerDependentManager): self._allocate_fixed_ips(context, instance_id, host, [network]) def get_backdoor_port(self, context): - """Return backdoor port for eventlet_backdoor""" + """Return backdoor port for eventlet_backdoor.""" return self.backdoor_port @wrap_check_policy @@ -1826,7 +1826,7 @@ class NetworkManager(manager.SchedulerDependentManager): def setup_networks_on_host(self, context, instance_id, host, teardown=False): - """calls setup/teardown on network hosts associated with an instance""" + """calls setup/teardown on network hosts for an instance.""" green_pool = greenpool.GreenPool() if teardown: @@ -1916,14 +1916,14 @@ class NetworkManager(manager.SchedulerDependentManager): @wrap_check_policy def get_vifs_by_instance(self, context, instance_id): - """Returns the vifs associated with an instance""" + """Returns the vifs associated with an instance.""" instance = self.db.instance_get(context, instance_id) vifs = self.db.virtual_interface_get_by_instance(context, instance['uuid']) return [dict(vif.iteritems()) for vif in vifs] def get_instance_id_by_floating_address(self, context, address): - """Returns the instance id a floating ip's fixed ip is allocated to""" + """Returns the instance id a floating ip's fixed ip is allocated to.""" floating_ip = self.db.floating_ip_get_by_address(context, address) if floating_ip['fixed_ip_id'] is None: return None @@ -1960,7 +1960,7 @@ class NetworkManager(manager.SchedulerDependentManager): @wrap_check_policy def get_fixed_ip(self, context, id): - """Return a fixed ip""" + """Return a fixed ip.""" fixed = self.db.fixed_ip_get(context, id) return jsonutils.to_primitive(fixed) @@ -1970,21 +1970,21 @@ class NetworkManager(manager.SchedulerDependentManager): return jsonutils.to_primitive(fixed) def get_vif_by_mac_address(self, context, mac_address): - """Returns the vifs record for the mac_address""" + """Returns the vifs record for the mac_address.""" return self.db.virtual_interface_get_by_address(context, mac_address) @manager.periodic_task( spacing=CONF.dns_update_periodic_interval) def _periodic_update_dns(self, context): - """Update local DNS entries of all networks on this host""" + """Update local DNS entries of all networks on this host.""" networks = self.db.network_get_all_by_host(context, self.host) for network in networks: dev = self.driver.get_dev(network) self.driver.update_dns(context, dev, network) def update_dns(self, context, network_ids): - """Called when fixed IP is allocated or deallocated""" + """Called when fixed IP is allocated or deallocated.""" if CONF.fake_network: return @@ -2070,27 +2070,27 @@ class FlatManager(NetworkManager): @wrap_check_policy def get_floating_ip(self, context, id): - """Returns a floating IP as a dict""" + """Returns a floating IP as a dict.""" return None @wrap_check_policy def get_floating_pools(self, context): - """Returns list of floating pools""" + """Returns list of floating pools.""" return {} @wrap_check_policy def get_floating_ip_by_address(self, context, address): - """Returns a floating IP as a dict""" + """Returns a floating IP as a dict.""" return None @wrap_check_policy def get_floating_ips_by_project(self, context): - """Returns the floating IPs allocated to a project""" + """Returns the floating IPs allocated to a project.""" return [] @wrap_check_policy def get_floating_ips_by_fixed_address(self, context, fixed_address): - """Returns the floating IPs associated with a fixed_address""" + """Returns the floating IPs associated with a fixed_address.""" return [] def migrate_instance_start(self, context, instance_uuid, @@ -2106,7 +2106,7 @@ class FlatManager(NetworkManager): pass def update_dns(self, context, network_ids): - """Called when fixed IP is allocated or deallocated""" + """Called when fixed IP is allocated or deallocated.""" pass @@ -2157,7 +2157,7 @@ class FlatDHCPManager(RPCAllocateFixedIP, FloatingIP, NetworkManager): self.driver.update_dhcp(elevated, dev, network) def _get_network_dict(self, network): - """Returns the dict representing necessary and meta network fields""" + """Returns the dict representing necessary and meta network fields.""" # get generic network fields network_dict = super(FlatDHCPManager, self)._get_network_dict(network) @@ -2382,7 +2382,7 @@ class VlanManager(RPCAllocateFixedIP, FloatingIP, NetworkManager): self.driver.update_dhcp(context, dev, network) def _get_network_dict(self, network): - """Returns the dict representing necessary and meta network fields""" + """Returns the dict representing necessary and meta network fields.""" # get generic network fields network_dict = super(VlanManager, self)._get_network_dict(network) diff --git a/nova/network/model.py b/nova/network/model.py index f427a04bd..dcee68f8c 100644 --- a/nova/network/model.py +++ b/nova/network/model.py @@ -27,7 +27,7 @@ def ensure_string_keys(d): class Model(dict): - """Defines some necessary structures for most of the network models""" + """Defines some necessary structures for most of the network models.""" def __repr__(self): return self.__class__.__name__ + '(' + dict.__repr__(self) + ')' @@ -38,12 +38,12 @@ class Model(dict): self['meta'].update(kwargs) def get_meta(self, key, default=None): - """calls get(key, default) on self['meta']""" + """calls get(key, default) on self['meta'].""" return self['meta'].get(key, default) class IP(Model): - """Represents an IP address in Nova""" + """Represents an IP address in Nova.""" def __init__(self, address=None, type=None, **kwargs): super(IP, self).__init__() @@ -78,7 +78,7 @@ class IP(Model): class FixedIP(IP): - """Represents a Fixed IP address in Nova""" + """Represents a Fixed IP address in Nova.""" def __init__(self, floating_ips=None, **kwargs): super(FixedIP, self).__init__(**kwargs) self['floating_ips'] = floating_ips or [] @@ -102,7 +102,7 @@ class FixedIP(IP): class Route(Model): - """Represents an IP Route in Nova""" + """Represents an IP Route in Nova.""" def __init__(self, cidr=None, gateway=None, interface=None, **kwargs): super(Route, self).__init__() @@ -120,7 +120,7 @@ class Route(Model): class Subnet(Model): - """Represents a Subnet in Nova""" + """Represents a Subnet in Nova.""" def __init__(self, cidr=None, dns=None, gateway=None, ips=None, routes=None, **kwargs): super(Subnet, self).__init__() @@ -153,7 +153,7 @@ class Subnet(Model): self['ips'].append(ip) def as_netaddr(self): - """Convience function to get cidr as a netaddr object""" + """Convience function to get cidr as a netaddr object.""" return netaddr.IPNetwork(self['cidr']) @classmethod @@ -167,7 +167,7 @@ class Subnet(Model): class Network(Model): - """Represents a Network in Nova""" + """Represents a Network in Nova.""" def __init__(self, id=None, bridge=None, label=None, subnets=None, **kwargs): super(Network, self).__init__() @@ -193,7 +193,7 @@ class Network(Model): class VIF(Model): - """Represents a Virtual Interface in Nova""" + """Represents a Virtual Interface in Nova.""" def __init__(self, id=None, address=None, network=None, type=None, **kwargs): super(VIF, self).__init__() @@ -258,16 +258,16 @@ class VIF(Model): class NetworkInfo(list): - """Stores and manipulates network information for a Nova instance""" + """Stores and manipulates network information for a Nova instance.""" # NetworkInfo is a list of VIFs def fixed_ips(self): - """Returns all fixed_ips without floating_ips attached""" + """Returns all fixed_ips without floating_ips attached.""" return [ip for vif in self for ip in vif.fixed_ips()] def floating_ips(self): - """Returns all floating_ips""" + """Returns all floating_ips.""" return [ip for vif in self for ip in vif.floating_ips()] @classmethod diff --git a/nova/network/noop_dns_driver.py b/nova/network/noop_dns_driver.py index be29f4d9a..68a1862e6 100644 --- a/nova/network/noop_dns_driver.py +++ b/nova/network/noop_dns_driver.py @@ -19,7 +19,7 @@ from nova.network import dns_driver class NoopDNSDriver(dns_driver.DNSDriver): - """No-op DNS manager. Does nothing. """ + """No-op DNS manager. Does nothing.""" def __init__(self): pass diff --git a/nova/network/nova_ipam_lib.py b/nova/network/nova_ipam_lib.py index 6b6897156..5fdb27900 100644 --- a/nova/network/nova_ipam_lib.py +++ b/nova/network/nova_ipam_lib.py @@ -69,7 +69,7 @@ class QuantumNovaIPAMLib(object): return [subnet_v4, subnet_v6] def get_routes_by_ip_block(self, context, block_id, project_id): - """Returns the list of routes for the IP block""" + """Returns the list of routes for the IP block.""" return [] def get_v4_ips_by_interface(self, context, net_id, vif_id, project_id): diff --git a/nova/network/quantumv2/api.py b/nova/network/quantumv2/api.py index 0a4b24538..064ae0427 100644 --- a/nova/network/quantumv2/api.py +++ b/nova/network/quantumv2/api.py @@ -427,7 +427,7 @@ class API(base.Base): return [] def get_instance_id_by_floating_address(self, context, address): - """Returns the instance id a floating ip's fixed ip is allocated to""" + """Returns the instance id a floating ip's fixed ip is allocated to.""" client = quantumv2.get_client(context) fip = self._get_floating_ip_by_address(client, address) if not fip['port_id']: @@ -473,7 +473,7 @@ class API(base.Base): return fip['floatingip']['floating_ip_address'] def _get_floating_ip_by_address(self, client, address): - """Get floatingip from floating ip address""" + """Get floatingip from floating ip address.""" data = client.list_floatingips(floating_ip_address=address) fips = data['floatingips'] if len(fips) == 0: @@ -515,13 +515,13 @@ class API(base.Base): client.update_floatingip(fip['id'], {'floatingip': {'port_id': None}}) def migrate_instance_start(self, context, instance, migration): - """Start to migrate the network of an instance""" + """Start to migrate the network of an instance.""" # NOTE(wenjianhn): just pass to make migrate instance doesn't # raise for now. pass def migrate_instance_finish(self, context, instance, migration): - """Finish migrating the network of an instance""" + """Finish migrating the network of an instance.""" # NOTE(wenjianhn): just pass to make migrate instance doesn't # raise for now. pass |