diff options
| author | Trey Morris <trey.morris@rackspace.com> | 2011-06-08 14:46:31 -0500 |
|---|---|---|
| committer | Trey Morris <trey.morris@rackspace.com> | 2011-06-08 14:46:31 -0500 |
| commit | d7925b3890f651b3f6fd002a45b2add86e388d10 (patch) | |
| tree | 159af3a41fd630a2d41197722cf2bc9e76dfc315 | |
| parent | a538fceb8cf6d692db0e3585b99ed10a17197960 (diff) | |
updated docstring for nova-manage network create
| -rwxr-xr-x | bin/nova-manage | 3 | ||||
| -rw-r--r-- | nova/db/api.py | 4 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 9 | ||||
| -rw-r--r-- | nova/network/manager.py | 14 | ||||
| -rw-r--r-- | nova/tests/db/fakes.py | 6 | ||||
| -rw-r--r-- | nova/virt/libvirt/netutils.py | 3 |
6 files changed, 18 insertions, 21 deletions
diff --git a/bin/nova-manage b/bin/nova-manage index e7164b4d2..187db0c86 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -562,6 +562,9 @@ class NetworkCommands(object): [network_size=FLAG], [vlan_start=FLAG], [vpn_start=FLAG], [fixed_range_v6=FLAG], [gateway_v6=FLAG], [flat_network_bridge=FLAG], [bridge_interface=FLAG] + If you wish to use a later argument fill in the gaps with 0s + Ex: network create private 10.0.0.0/8 1 15 0 0 0 0 xenbr1 eth1 + network create private 10.0.0.0/8 1 15 """ if not label: msg = _('a label (ex: public) is required to create networks.') diff --git a/nova/db/api.py b/nova/db/api.py index 4c8a06403..c990af094 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -373,9 +373,9 @@ def fixed_ip_get_by_address(context, address): return IMPL.fixed_ip_get_by_address(context, address) -def fixed_ip_get_all_by_instance(context, instance_id): +def fixed_ip_get_by_instance(context, instance_id): """Get fixed ips by instance or raise if none exist.""" - return IMPL.fixed_ip_get_all_by_instance(context, instance_id) + return IMPL.fixed_ip_get_by_instance(context, instance_id) def fixed_ip_get_by_virtual_interface(context, vif_id): diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 93c3f8897..67c032a56 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -741,7 +741,7 @@ def fixed_ip_get_instance(context, address): @require_context -def fixed_ip_get_all_by_instance(context, instance_id): +def fixed_ip_get_by_instance(context, instance_id): session = get_session() rv = session.query(models.FixedIp).\ filter_by(instance_id=instance_id).\ @@ -1151,7 +1151,7 @@ def instance_get_fixed_addresses(context, instance_id): with session.begin(): instance_ref = instance_get(context, instance_id, session=session) try: - fixed_ips = fixed_ip_get_all_by_instance(context, instance_id) + fixed_ips = fixed_ip_get_by_instance(context, instance_id) except exception.NotFound: return [] return [fixed_ip.address for fixed_ip in fixed_ips] @@ -1170,8 +1170,7 @@ def instance_get_fixed_addresses_v6(context, instance_id): prefixes = [ref.cidr_v6 for ref in sorted(network_refs, key=lambda ref: ref.id)] # get vifs associated with instance - vif_refs = virtual_interface_get_all_by_instance(context, - instance_ref.id) + vif_refs = virtual_interface_get_by_instance(context, instance_ref.id) # compile list of the mac_addresses for vifs sorted by network id macs = [vif_ref['address'] for vif_ref in sorted(vif_refs, key=lambda vif_ref: vif_ref['network_id'])] @@ -1185,7 +1184,7 @@ def instance_get_fixed_addresses_v6(context, instance_id): @require_context def instance_get_floating_address(context, instance_id): - fixed_ip_refs = fixed_ip_get_all_by_instance(context, instance_id) + fixed_ip_refs = fixed_ip_get_by_instance(context, instance_id) if not fixed_ip_refs: return None # NOTE(tr3buchet): this only gets the first fixed_ip diff --git a/nova/network/manager.py b/nova/network/manager.py index 4483422fd..593205901 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -193,8 +193,7 @@ class FloatingIP(object): public_ip) # get the first fixed_ip belonging to the instance - fixed_ips = self.db.fixed_ip_get_all_by_instance(context, - instance_id) + fixed_ips = self.db.fixed_ip_get_by_instance(context, instance_id) fixed_ip = fixed_ips[0] if fixed_ips else None # call to correct network host to associate the floating ip @@ -213,8 +212,7 @@ class FloatingIP(object): LOG.debug(_("floating IP deallocation for instance |%s|"), instance_id, context=context) - fixed_ips = self.db.fixed_ip_get_all_by_instance(context, - instance_id) + fixed_ips = self.db.fixed_ip_get_by_instance(context, instance_id) # add to kwargs so we can pass to super to save a db lookup there kwargs['fixed_ips'] = fixed_ips for fixed_ip in fixed_ips: @@ -368,7 +366,7 @@ class NetworkManager(manager.SchedulerDependentManager): """ instance_id = kwargs.pop('instance_id') fixed_ips = kwargs.get('fixed_ips') or \ - self.db.fixed_ip_get_all_by_instance(context, instance_id) + self.db.fixed_ip_get_by_instance(context, instance_id) LOG.debug(_("network deallocation for instance |%s|"), instance_id, context=context) # deallocate mac addresses @@ -388,10 +386,8 @@ class NetworkManager(manager.SchedulerDependentManager): and info = dict containing pertinent networking data """ # TODO(tr3buchet) should handle floating IPs as well? - fixed_ips = self.db.fixed_ip_get_all_by_instance(context, - instance_id) - vifs = self.db.virtual_interface_get_all_by_instance(context, - instance_id) + fixed_ips = self.db.fixed_ip_get_by_instance(context, instance_id) + vifs = self.db.virtual_interface_get_by_instance(context, instance_id) flavor = self.db.instance_type_get_by_id(context, instance_type_id) network_info = [] diff --git a/nova/tests/db/fakes.py b/nova/tests/db/fakes.py index 8bdea359a..ecb1a27f8 100644 --- a/nova/tests/db/fakes.py +++ b/nova/tests/db/fakes.py @@ -138,7 +138,7 @@ def stub_out_db_instance_api(stubs, injected=True): def fake_instance_get_fixed_address_v6(context, instance_id): return FakeModel(fixed_ip_fields).address - def fake_fixed_ip_get_all_by_instance(context, instance_id): + def fake_fixed_ip_get_by_instance(context, instance_id): return [FakeModel(fixed_ip_fields)] stubs.Set(db, 'network_get_by_instance', fake_network_get_by_instance) @@ -153,5 +153,5 @@ def stub_out_db_instance_api(stubs, injected=True): fake_instance_get_fixed_address_v6) stubs.Set(db, 'network_get_all_by_instance', fake_network_get_all_by_instance) - stubs.Set(db, 'fixed_ip_get_all_by_instance', - fake_fixed_ip_get_all_by_instance) + stubs.Set(db, 'fixed_ip_get_by_instance', + fake_fixed_ip_get_by_instance) diff --git a/nova/virt/libvirt/netutils.py b/nova/virt/libvirt/netutils.py index 4d596078a..c8c2dbc67 100644 --- a/nova/virt/libvirt/netutils.py +++ b/nova/virt/libvirt/netutils.py @@ -53,8 +53,7 @@ def get_network_info(instance): # we should cache network_info admin_context = context.get_admin_context() - ip_addresses = db.fixed_ip_get_all_by_instance(admin_context, - instance['id']) + ip_addresses = db.fixed_ip_get_by_instance(admin_context, instance['id']) networks = db.network_get_all_by_instance(admin_context, instance['id']) flavor = db.instance_type_get_by_id(admin_context, |
