The ironic.db.sqlalchemy.api Module

The ironic.db.sqlalchemy.api Module

SQLAlchemy storage backend.

class ironic.db.sqlalchemy.api.Connection[source]

Bases: ironic.db.api.Connection

SqlAlchemy connection.

add_node_tag(node_id, tag)[source]
add_node_trait(node_id, trait, version)[source]
backfill_version_column(context, max_count)[source]

Backfill the Conductor version column with Pike version.

The version column was added to all the resource tables in the Pike release (via ‘ironic-dbsync upgrade’). After upgrading (from Ocata to Pike), the ‘ironic-dbsync online_data_migrations’ command would have populated (backfilled) the version column for all objects.

Unfortunately, in the Pike release, we forgot to set the value for the conductor’s version column. For the Queens release, we are setting the conductor version, however, we still need to backfill in case new conductors were added between the time the operator ran Pike’s ‘ironic-dbsync online_data_migrations’ and their upgrade to Queens. The version used will be the conductor object version from the Pike release.

Parameters:
  • context – the admin context (not used)
  • max_count – The maximum number of objects to migrate. Must be >= 0. If zero, all the objects will be migrated.
Returns:

A 2-tuple, 1. the total number of objects that need to be migrated (at the beginning of this call) and 2. the number of migrated objects.

check_versions()[source]

Checks the whole database for incompatible objects.

This scans all the tables in search of objects that are not supported; i.e., those that are not specified in ironic.common.release_mappings.RELEASE_MAPPING. This includes objects that have null ‘version’ values.

Returns:A Boolean. True if all the objects have supported versions; False otherwise.
clear_node_reservations_for_conductor(hostname)[source]
clear_node_target_power_state(hostname)[source]
create_chassis(values)[source]
create_node(values)[source]
create_port(values)[source]
create_portgroup(values)[source]
create_volume_connector(connector_info)[source]
create_volume_target(target_info)[source]
delete_node_tag(node_id, tag)[source]
delete_node_trait(node_id, trait)[source]
destroy_chassis(chassis_id)[source]
destroy_node(node_id)[source]
destroy_port(port_id)[source]
destroy_portgroup(portgroup_id)[source]
destroy_volume_connector(ident)[source]
destroy_volume_target(ident)[source]
get_active_driver_dict(interval=None)[source]
get_active_hardware_type_dict()[source]
get_chassis_by_id(chassis_id)[source]
get_chassis_by_uuid(chassis_uuid)[source]
get_chassis_list(limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_conductor(hostname)[source]
get_node_by_id(node_id)[source]
get_node_by_instance(instance)[source]
get_node_by_name(node_name)[source]
get_node_by_port_addresses(addresses)[source]
get_node_by_uuid(node_uuid)[source]
get_node_list(filters=None, limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_node_tags_by_node_id(node_id)[source]
get_node_traits_by_node_id(node_id)[source]
get_nodeinfo_list(columns=None, filters=None, limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_offline_conductors()[source]
get_port_by_address(address)[source]
get_port_by_id(port_id)[source]
get_port_by_uuid(port_uuid)[source]
get_port_list(limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_portgroup_by_address(address)[source]
get_portgroup_by_id(portgroup_id)[source]
get_portgroup_by_name(name)[source]
get_portgroup_by_uuid(portgroup_uuid)[source]
get_portgroup_list(limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_portgroups_by_node_id(node_id, limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_ports_by_node_id(node_id, limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_ports_by_portgroup_id(portgroup_id, limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_volume_connector_by_id(db_id)[source]
get_volume_connector_by_uuid(connector_uuid)[source]
get_volume_connector_list(limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_volume_connectors_by_node_id(node_id, limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_volume_target_by_id(db_id)[source]
get_volume_target_by_uuid(uuid)[source]
get_volume_target_list(limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_volume_targets_by_node_id(node_id, limit=None, marker=None, sort_key=None, sort_dir=None)[source]
get_volume_targets_by_volume_id(volume_id, limit=None, marker=None, sort_key=None, sort_dir=None)[source]
list_conductor_hardware_interfaces(conductor_id)[source]
list_hardware_type_interfaces(hardware_types)[source]
migrate_to_hardware_types(context, max_count, reset_unsupported_interfaces=False)[source]

Migrate nodes from classic drivers to hardware types.

Go through all nodes with a classic driver and try to migrate them to a corresponding hardware type and a correct set of hardware interfaces.

If migration is not possible for any reason (e.g. the target hardware type is not enabled), the nodes are skipped. An operator is expected to correct the configuration and either rerun online_data_migration or migrate the nodes manually.

Parameters:
  • context – the admin context (not used)
  • max_count – The maximum number of objects to migrate. Must be >= 0. If zero, all the objects will be migrated.
  • reset_unsupported_interfaces – whether to reset unsupported optional interfaces to their no-XXX versions.
Returns:

A 2-tuple, 1. the total number of objects that need to be migrated (at the beginning of this call) and 2. the number of migrated objects.

node_tag_exists(node_id, tag)[source]
node_trait_exists(node_id, trait)[source]
register_conductor(values, update_existing=False)[source]
register_conductor_hardware_interfaces(conductor_id, hardware_type, interface_type, interfaces, default_interface)[source]
release_node(tag, node_id)[source]
reserve_node(tag, node_id)[source]
set_node_tags(node_id, tags)[source]
set_node_traits(node_id, traits, version)[source]
touch_conductor(hostname)[source]
touch_node_provisioning(node_id)[source]
unregister_conductor(hostname)[source]
unregister_conductor_hardware_interfaces(conductor_id)[source]
unset_node_tags(node_id)[source]
unset_node_traits(node_id)[source]
update_chassis(chassis_id, values)[source]
update_node(node_id, values)[source]
update_port(port_id, values)[source]
update_portgroup(portgroup_id, values)[source]
update_to_latest_versions(context, max_count)[source]

Updates objects to their latest known versions.

This scans all the tables and for objects that are not in their latest version, updates them to that version.

Parameters:
  • context – the admin context
  • max_count – The maximum number of objects to migrate. Must be >= 0. If zero, all the objects will be migrated.
Returns:

A 2-tuple, 1. the total number of objects that need to be migrated (at the beginning of this call) and 2. the number of migrated objects.

update_volume_connector(ident, connector_info)[source]
update_volume_target(ident, target_info)[source]
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.