The ironic.objects.port
Module¶
-
class
ironic.objects.port.
Port
(context=None, **kwargs)[source]¶ Bases:
ironic.objects.base.IronicObject
,oslo_versionedobjects.base.VersionedObjectDictCompat
-
create
(context=None)[source]¶ Create a Port record in the DB.
Parameters: context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Port(context) Raises: MACAlreadyExists if ‘address’ column is not unique Raises: PortAlreadyExists if ‘uuid’ column is not unique
-
destroy
(context=None)[source]¶ Delete the Port from the DB.
Parameters: context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Port(context) Raises: PortNotFound
-
classmethod
get
(context, port_id)[source]¶ Find a port.
Find a port based on its id or uuid or MAC address and return a Port object.
Parameters: port_id – the id or uuid or MAC address of a port. Returns: a Port
object.Raises: InvalidIdentity
-
classmethod
get_by_address
(context, address)[source]¶ Find a port based on address and return a
Port
object.Parameters: - cls – the
Port
- context – Security context
- address – the address of a port.
Returns: a
Port
object.Raises: PortNotFound
- cls – the
-
classmethod
get_by_id
(context, port_id)[source]¶ Find a port based on its integer ID and return a Port object.
Parameters: - cls – the
Port
- context – Security context
- port_id – the ID of a port.
Returns: a
Port
object.Raises: PortNotFound
- cls – the
-
classmethod
get_by_uuid
(context, uuid)[source]¶ Find a port based on UUID and return a
Port
object.Parameters: - cls – the
Port
- context – Security context
- uuid – the UUID of a port.
Returns: a
Port
object.Raises: PortNotFound
- cls – the
-
classmethod
list
(context, limit=None, marker=None, sort_key=None, sort_dir=None)[source]¶ Return a list of Port objects.
Parameters: - context – Security context.
- limit – maximum number of resources to return in a single result.
- marker – pagination marker for large data sets.
- sort_key – column to sort results by.
- sort_dir – direction to sort. “asc” or “desc”.
Returns: a list of
Port
object.Raises: InvalidParameterValue
-
classmethod
list_by_node_id
(context, node_id, limit=None, marker=None, sort_key=None, sort_dir=None)[source]¶ Return a list of Port objects associated with a given node ID.
Parameters: - context – Security context.
- node_id – the ID of the node.
- limit – maximum number of resources to return in a single result.
- marker – pagination marker for large data sets.
- sort_key – column to sort results by.
- sort_dir – direction to sort. “asc” or “desc”.
Returns: a list of
Port
object.
-
classmethod
list_by_portgroup_id
(context, portgroup_id, limit=None, marker=None, sort_key=None, sort_dir=None)[source]¶ Return a list of Port objects associated with a given portgroup ID.
Parameters: - context – Security context.
- portgroup_id – the ID of the portgroup.
- limit – maximum number of resources to return in a single result.
- marker – pagination marker for large data sets.
- sort_key – column to sort results by.
- sort_dir – direction to sort. “asc” or “desc”.
Returns: a list of
Port
object.
-
refresh
(context=None)[source]¶ Loads updates for this Port.
Loads a port with the same uuid from the database and checks for updated attributes. Updates are applied from the loaded port column by column, if there are any updates.
Parameters: context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Port(context) Raises: PortNotFound
-
save
(context=None)[source]¶ Save updates to this Port.
Updates will be made column by column based on the result of self.what_changed().
Parameters: context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Port(context) Raises: PortNotFound Raises: MACAlreadyExists if ‘address’ column is not unique
-
-
class
ironic.objects.port.
PortCRUDNotification
(context=None, **kwargs)[source]¶ Bases:
ironic.objects.notification.NotificationBase
Notification emitted when ironic creates, updates or deletes a port.