The nova.network.neutronv2.api Module

class API(skip_policy_check=False)

Bases: nova.network.base_api.NetworkAPI

API for interacting with the neutron 2.x API.

add_dns_entry(context, address, name, dns_type, domain)

Create specified DNS entry for address.

add_fixed_ip_to_instance(context, *args, **kwargs)

Add a fixed IP to the instance from specified network.

add_network_to_project(context, project_id, network_uuid=None)

Force add a network to the project.

allocate_floating_ip(context, pool=None)

Add a floating IP to a project from a pool.

allocate_for_instance(context, instance, **kwargs)

Allocate network resources for the instance.

Parameters:
  • context – The request context.
  • instance – nova.objects.instance.Instance object.
  • requested_networks – optional value containing network_id, fixed_ip, and port_id
  • security_groups – security groups to allocate for instance
  • 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). NB: NeutronV2 currently assigns hypervisor supplied MAC addresses to arbitrary networks, which requires openflow switches to function correctly if more than one network is being used with the bare metal hypervisor (which is the only one known to limit MAC addresses).
  • 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 – the host ID to attach to the ports being created.
allocate_port_for_instance(context, instance, port_id, network_id=None, requested_ip=None, bind_host_id=None)

Allocate a port for the instance.

associate(context, network_uuid, host=<object object at 0x7f32efb13240>, project=<object object at 0x7f32efb13240>)

Associate a network for client.

associate_floating_ip(context, *args, **kwargs)

Associate a floating IP with a fixed IP.

cleanup_instance_network_on_host(context, instance, host)

Cleanup network for specified instance on host.

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, domain, availability_zone)

Create a private DNS domain with nova availability zone.

create_public_dns_domain(context, domain, project=None)

Create a private DNS domain with optional nova project.

deallocate_for_instance(context, instance, **kwargs)

Deallocate all network resources related to the instance.

deallocate_port_for_instance(context, instance, port_id)

Remove a specified port from the instance.

Return network information for the instance

delete(context, network_uuid)

Delete a network for client.

delete_dns_domain(context, domain)

Delete the specified dns domain.

delete_dns_entry(context, name, domain)

Delete the specified dns entry.

disassociate(context, network_uuid)

Disassociate a network for client.

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)

Disassociate a floating IP from the instance.

get(context, network_uuid)

Get specific network for client.

get_all(context)

Get all networks for client.

get_dns_domains(context)

Return a list of available dns domains.

These can be used to create DNS entries for floating IPs.

get_dns_entries_by_address(context, address, domain)

Get entries for address and domain.

get_dns_entries_by_name(context, name, domain)

Get entries for name and domain.

get_fixed_ip(context, id)

Get a fixed IP from the id.

get_fixed_ip_by_address(context, address)

Return instance uuids given an address.

get_floating_ip(context, id)

Return floating IP object given the floating IP id.

get_floating_ip_by_address(context, address)

Return a floating IP given an address.

get_floating_ip_pools(context)

Return floating IP pool names.

get_floating_ips_by_project(context)
get_instance_id_by_floating_address(context, address)

Return the instance id a floating IP’s fixed IP is allocated to.

get_vif_by_mac_address(context, mac_address)
get_vifs_by_instance(context, instance)
list_ports(context, **search_opts)

List ports for the client based on search options.

migrate_instance_finish(context, instance, migration)

Finish migrating the network of an instance.

migrate_instance_start(context, instance, migration)

Start to migrate the network of an instance.

modify_dns_entry(context, name, address, domain)

Create specified DNS entry for address.

release_floating_ip(context, address, affect_auto_assigned=False)

Remove a floating IP with the given address from a project.

remove_fixed_ip_from_instance(context, *args, **kwargs)

Remove a fixed IP from the instance.

setup_instance_network_on_host(context, instance, host)

Setup network for specified instance on host.

setup_networks_on_host(context, instance, host=None, teardown=False)

Setup or teardown the network structures.

show_port(context, port_id)

Return the port for the client given the port id.

Parameters:
  • context – Request context.
  • port_id – The id of port to be queried.
Returns:

A dict containing port data keyed by ‘port’, e.g.

{'port': {'port_id': 'abcd',
          'fixed_ip_address': '1.2.3.4'}}
update_instance_vnic_index(context, instance, vif, index)

Update instance vnic index.

When the ‘VNIC index’ extension is supported this method will update the vnic index of the instance on the port.

validate_networks(context, requested_networks, num_instances)

Validate that the tenant can use the requested networks.

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

get_client(context, admin=False)
list_opts()
reset_state()

Previous topic

The nova.network.model Module

Next topic

The nova.network.neutronv2.constants Module

Project Source

This Page