A driver wrapping the Ironic API, such that Nova may provision
bare metal resources.
-
class IronicDriver(virtapi, read_only=False)
Bases: nova.virt.driver.ComputeDriver
Hypervisor driver for Ironic - bare metal provisioning.
-
capabilities = {'supports_recreate': False, 'has_imagecache': False, 'supports_migrate_to_same_host': False}
-
deallocate_networks_on_reschedule(instance)
Does the driver want networks deallocated on reschedule?
Parameters: | instance – the instance object. |
Returns: | Boolean value. If True deallocate networks on reschedule. |
-
destroy(context, instance, network_info, block_device_info=None, destroy_disks=True, migrate_data=None)
Destroy the specified instance, if it can be found.
Parameters: |
- context – The security context.
- instance – The instance object.
- network_info – Instance network information.
- block_device_info – Instance block device
information. Ignored by this driver.
- destroy_disks – Indicates if disks should be
destroyed. Ignored by this driver.
- migrate_data – implementation specific params.
Ignored by this driver.
|
-
ensure_filtering_rules_for_instance(instance, network_info)
Set up filtering rules.
Parameters: |
- instance – The instance object.
- network_info – Instance network information.
|
-
get_available_nodes(refresh=False)
Returns the UUIDs of all nodes in the Ironic inventory.
Parameters: | refresh – Boolean value; If True run update first. Ignored by
this driver. |
Returns: | a list of UUIDs |
-
get_available_resource(nodename)
Retrieve resource information.
This method is called when nova-compute launches, and
as part of a periodic task that records the results in the DB.
Parameters: | nodename – the UUID of the node. |
Returns: | a dictionary describing resources. |
-
get_info(instance)
Get the current state and resource usage for this instance.
If the instance is not found this method returns (a dictionary
with) NOSTATE and all resources == 0.
Parameters: | instance – the instance object. |
Returns: | a InstanceInfo object |
-
init_host(host)
Initialize anything that is necessary for the driver to function.
Parameters: | host – the hostname of the compute host. |
-
instance_exists(instance)
Checks the existence of an instance.
Checks the existence of an instance. This is an override of the
base method for efficiency.
Parameters: | instance – The instance object. |
Returns: | True if the instance exists. False if not. |
-
list_instance_uuids()
Return the UUIDs of all the instances provisioned.
Returns: | a list of instance UUIDs. |
-
list_instances()
Return the names of all the instances provisioned.
Returns: | a list of instance names. |
-
macs_for_instance(instance)
List the MAC addresses of an instance.
List of MAC addresses for the node which this instance is
associated with.
Parameters: | instance – the instance object. |
Returns: | None, or a set of MAC ids (e.g. set([‘12:34:56:78:90:ab’])).
None means ‘no constraints’, a set means ‘these and only these
MAC addresses’. |
-
network_binding_host_id(context, instance)
Get host ID to associate with network ports.
This defines the binding:host_id parameter to the port-create
calls for Neutron. If using a flat network, use the default behavior
and allow the port to bind immediately. If using separate networks
for the control plane and tenants, return None here to indicate
that the port should not yet be bound; Ironic will make a port-update
call to Neutron later to tell Neutron to bind the port.
Parameters: |
- context – request context
- instance – nova.objects.instance.Instance that the network
ports will be associated with
|
Returns: | a string representing the host ID
|
-
node_is_available(nodename)
Confirms a Nova hypervisor node exists in the Ironic inventory.
Parameters: | nodename – The UUID of the node. |
Returns: | True if the node exists, False if not. |
-
plug_vifs(instance, network_info)
Plug VIFs into networks.
Parameters: |
- instance – The instance object.
- network_info – Instance network information.
|
-
power_off(instance, timeout=0, retry_interval=0)
Power off the specified instance.
- NOTE: Ironic does not support soft-off, so this method ignores
- timeout and retry_interval parameters.
- NOTE: Unlike the libvirt driver, this method does not delete
- and recreate the instance; it preserves local state.
Parameters: |
- instance – The instance object.
- timeout – time to wait for node to shutdown. Ignored by
this driver.
- retry_interval – How often to signal node while waiting
for it to shutdown. Ignored by this driver.
|
-
power_on(context, instance, network_info, block_device_info=None)
Power on the specified instance.
- NOTE: Unlike the libvirt driver, this method does not delete
- and recreate the instance; it preserves local state.
Parameters: |
- context – The security context.
- instance – The instance object.
- network_info – Instance network information. Ignored by
this driver.
- block_device_info – Instance block device
information. Ignored by this driver.
|
-
reboot(context, instance, network_info, reboot_type, block_device_info=None, bad_volumes_callback=None)
Reboot the specified instance.
- NOTE: Ironic does not support soft-off, so this method
- always performs a hard-reboot.
- NOTE: Unlike the libvirt driver, this method does not delete
- and recreate the instance; it preserves local state.
Parameters: |
- context – The security context.
- instance – The instance object.
- network_info – Instance network information. Ignored by
this driver.
- reboot_type – Either a HARD or SOFT reboot. Ignored by
this driver.
- block_device_info – Info pertaining to attached volumes.
Ignored by this driver.
- bad_volumes_callback – Function to handle any bad volumes
encountered. Ignored by this driver.
|
-
rebuild(context, instance, image_meta, injected_files, admin_password, bdms, detach_block_devices, attach_block_devices, network_info=None, recreate=False, block_device_info=None, preserve_ephemeral=False)
Rebuild/redeploy an instance.
This version of rebuild() allows for supporting the option to
preserve the ephemeral partition. We cannot call spawn() from
here because it will attempt to set the instance_uuid value
again, which is not allowed by the Ironic API. It also requires
the instance to not have an ‘active’ provision state, but we
cannot safely change that. Given that, we implement only the
portions of spawn() we need within rebuild().
Parameters: |
- context – The security context.
- instance – The instance object.
- image_meta – Image object returned by nova.image.glance
that defines the image from which to boot this instance. Ignored
by this driver.
- injected_files – User files to inject into instance. Ignored
by this driver.
- admin_password – Administrator password to set in
instance. Ignored by this driver.
- bdms – block-device-mappings to use for rebuild. Ignored
by this driver.
- detach_block_devices – function to detach block devices. See
nova.compute.manager.ComputeManager:_rebuild_default_impl for
usage. Ignored by this driver.
- attach_block_devices – function to attach block devices. See
nova.compute.manager.ComputeManager:_rebuild_default_impl for
usage. Ignored by this driver.
- network_info – Instance network information. Ignored by
this driver.
- recreate – Boolean value; if True the instance is
recreated on a new hypervisor - all the cleanup of old state is
skipped. Ignored by this driver.
- block_device_info – Instance block device
information. Ignored by this driver.
- preserve_ephemeral – Boolean value; if True the ephemeral
must be preserved on rebuild.
|
-
refresh_instance_security_rules(instance)
Refresh security group rules from data store.
Gets called when an instance gets added to or removed from
the security group the instance is a member of or if the
group gains or loses a rule.
Parameters: | instance – The instance object. |
-
refresh_security_group_rules(security_group_id)
Refresh security group rules from data store.
Invoked when security group rules are updated.
Parameters: | security_group_id – The security group id. |
-
spawn(context, instance, image_meta, injected_files, admin_password, network_info=None, block_device_info=None)
Deploy an instance.
Parameters: |
- context – The security context.
- instance – The instance object.
- image_meta – Image dict returned by nova.image.glance
that defines the image from which to boot this instance.
- injected_files – User files to inject into instance.
- admin_password – Administrator password to set in
instance.
- network_info – Instance network information.
- block_device_info – Instance block device
information. Ignored by this driver.
|
-
unfilter_instance(instance, network_info)
Stop filtering instance.
Parameters: |
- instance – The instance object.
- network_info – Instance network information.
|
-
unplug_vifs(instance, network_info)
Unplug VIFs from networks.
Parameters: |
- instance – The instance object.
- network_info – Instance network information.
|
-
map_power_state(state)