The nova.network.api Module

class API(**kwargs)

Bases: nova.network.base_api.NetworkAPI

API for doing networking via the nova-network network manager.

This is a pluggable module - other implementations do networking via other services (such as Neutron).

add_dns_entry(context, *args, **kwargs)

Create specified DNS entry for address.

add_fixed_ip_to_instance(context, *args, **kwargs)

Adds a fixed IP to instance from specified network.

add_network_to_project(context, *args, **kwargs)

Force adds another network to a project.

allocate_floating_ip(context, *args, **kwargs)

Adds (allocates) a floating IP to a project from a pool.

allocate_for_instance(context, *args, **kwargs)

Allocates all network structures for an instance.

Parameters:
  • context – The request context.
  • instance – nova.objects.instance.Instance object.
  • vpn – A boolean, if True, indicate a vpn to access the instance.
  • requested_networks – A dictionary of requested_networks, Optional value containing network_id, fixed_ip, and port_id.
  • macs – None or a set of MAC addresses that the instance should use. macs is supplied by the hypervisor driver (contrast with requested_networks which is user supplied).
  • security_groups – None or security groups to allocate for instance.
  • dhcp_options – None or a set of key/value pairs that should determine the DHCP BOOTP response, eg. for PXE booting an instance configured with the baremetal hypervisor. It is expected that these are already formatted for the neutron v2 api. See nova/virt/driver.py:dhcp_options_for_instance for an example.
  • bind_host_id – ignored by this driver.
Returns:

network info as from get_instance_nw_info() below

allocate_port_for_instance(context, instance, port_id, network_id=None, requested_ip=None, bind_host_id=None)
associate(context, *args, **kwargs)

Associate or disassociate host or project to network.

associate_floating_ip(context, *args, **kwargs)

Associates a floating IP with a fixed IP.

Ensures floating IP is allocated to the project in context. Does not verify ownership of the fixed IP. Caller is assumed to have checked that the instance is properly owned.

cleanup_instance_network_on_host(context, instance, host)

Cleanup network for specified instance on host.

create(context, *args, **kwargs)
create_pci_requests_for_sriov_ports(context, pci_requests, requested_networks)

Check requested networks for any SR-IOV port request.

Create a PCI request object for each SR-IOV port, and add it to the pci_requests object that contains a list of PCI request object.

create_private_dns_domain(context, *args, **kwargs)

Create a private DNS domain with nova availability zone.

create_public_dns_domain(context, *args, **kwargs)

Create a public DNS domain with optional nova project.

deallocate_for_instance(context, *args, **kwargs)

Deallocates all network structures related to instance.

deallocate_port_for_instance(context, instance, port_id)
delete(context, *args, **kwargs)
delete_dns_domain(context, *args, **kwargs)

Delete the specified dns domain.

delete_dns_entry(context, *args, **kwargs)

Delete the specified dns entry.

disassociate(context, *args, **kwargs)
disassociate_and_release_floating_ip(context, instance, floating_ip)

Removes (deallocates) and deletes the floating IP.

This api call was added to allow this to be done in one operation if using neutron.

disassociate_floating_ip(context, *args, **kwargs)

Disassociates a floating IP from fixed IP it is associated with.

get(context, *args, **kwargs)
get_all(context, *args, **kwargs)

Get all the networks.

If it is an admin user then api will return all the networks. If it is a normal user and nova Flat or FlatDHCP networking is being used then api will return all networks. Otherwise api will only return the networks which belong to the user’s project.

get_dns_domains(context, *args, **kwargs)

Returns a list of available dns domains. These can be used to create DNS entries for floating IPs.

get_dns_entries_by_address(context, *args, **kwargs)

Get entries for address and domain.

get_dns_entries_by_name(context, *args, **kwargs)

Get entries for name and domain.

get_fixed_ip(context, *args, **kwargs)
get_fixed_ip_by_address(context, *args, **kwargs)
get_floating_ip(context, *args, **kwargs)
get_floating_ip_by_address(context, *args, **kwargs)
get_floating_ip_pools(context, *args, **kwargs)
get_floating_ips_by_project(context, *args, **kwargs)
get_instance_id_by_floating_address(context, *args, **kwargs)
get_instance_nw_info(context, *args, **kwargs)

Returns all network info related to an instance.

get_vif_by_mac_address(context, *args, **kwargs)
get_vifs_by_instance(context, *args, **kwargs)
list_ports(*args, **kwargs)
migrate_instance_finish(context, *args, **kwargs)

Finish migrating the network of an instance.

migrate_instance_start(context, *args, **kwargs)

Start to migrate the network of an instance.

modify_dns_entry(context, *args, **kwargs)

Create specified DNS entry for address.

release_floating_ip(context, *args, **kwargs)

Removes (deallocates) a floating IP with address from a project.

remove_fixed_ip_from_instance(context, *args, **kwargs)

Removes a fixed IP from instance from specified network.

setup_instance_network_on_host(context, instance, host)

Setup network for specified instance on host.

setup_networks_on_host(context, *args, **kwargs)

Setup or teardown the network structures on hosts related to instance.

show_port(*args, **kwargs)
validate_networks(context, *args, **kwargs)

validate the networks passed at the time of creating the server.

Return the number of instances that can be successfully allocated with the requested network configuration.

check_policy(context, action)
wrap_check_policy(func)

Check policy corresponding to the wrapped methods prior to execution.

Previous topic

The nova.netconf Module

Next topic

The nova.network.base_api Module

Project Source

This Page