To make tags consistent with traits, change db.api.node_tag_exists()
to raise a NodeNotFound exception if the node doesn't exist.
This is a follow up to bbff319f02.
Change-Id: Id0ddf448d97b5ac22ef5dc27154a1b229514a968
Partial-Bug:#1526266
Adds a NodeTrait model to the DB and DBAPI methods for the following:
* Set/unset node traits
* Get node traits
* Add/remove a single trait
* Check for existence of a node trait
All node traits are deleted when their owner node is deleted. Traits
cannot be specified on node creation currently.
Change-Id: I8b375a33dcb94d2cc73eaa93a5cc5aed86c27178
Partial-Bug: #1722194
This modifies the backfill_version_column method that was used in Pike,
to backfill the version column for the Conductor object, since we missed
setting the Conductor's version column in Pike. This method is invoked
when the operator runs ``ironic-dbsync online_data_migrations``.
Change-Id: I42fec0ac9c8b684219f14822648e627fce529d36
Partial-Bug: 1526283
This adds the new command 'ironic-dbsync online_data_migrations'.
To limit downtime during upgrades, data migrations will be done online
with migration scripts that could be run during normal operation of an
ironic cluster, after the upgrade but before the next one.
Each migration script should ensure that all related DB records are
migrated to the new format. Scripts can detect the format based on
the object version which is stored in the version column.
The online data migration has one script; a function that backfills
the new version column, using versions of objects from the release
prior to this.
This includes code to check the object versions for compatibility with
an ironic release. However, the check is turned off (and will be turned on
in Queens), since we need to boot-strap the new version column before
we can turn the check on. To do this check, we need to keep a list of all
supported versions for every object; release_mapping.RELEASE_MAPPING was
modified so that the object versions is now a list instead of one value.
Change-Id: I1a9fa829951ecf98cae6896d82ba20cf89062394
Closes-Bug: #1585141
Partial-bug: #1526283
Co-Authored-By: Ruby Loo <ruby.loo@intel.com>
This patch introduces methods for retrieving volume targets by
their ID. As this field does not have a unique constraint, getting
volume targets by their volume_id field will return a list. This
will allow us to simplify attaching volumes in the cinder driver
as we can now easily query the database rather than looping
through all connected volumes.
Change-Id: I05709fd2ab09bd127c0d202ddcd4863077db3d5b
Partial-Bug: #1559691
This adds API version 1.30, which adds dynamic driver parameters
and response fields to `GET /v1/drivers` and `GET /v1/drivers/<name>`.
Changes RAID APIs to work for dynamic drivers.
Also changes GET /v1/drivers/<name>/properties to work for dynamic
drivers. It uses the calculated default implementation for each
interface, when calculating the properties.
Last, changes node and driver vendor passthru to work correctly
for dynamic drivers. Similar to properties, driver vendor passthru
will use the calculated default vendor implementation.
Change-Id: If13e7e7fd368273e84d9a108be93b58150432fae
Partial-Bug: #1524745
This loads hardware types into the hash ring, along with the drivers
that are currently there. This allows us to make RPC calls for nodes
that are using a dynamic driver.
Adds a dbapi method `get_active_hardware_type_dict`, similar to
`get_active_driver_dict`, to get a mapping of hardware types to active
conductors.
Change-Id: I50c1428568bd8cbe4ef252d56a6278f1a54dfcdb
Partial-Bug: #1524745
This registers the intersection of supported and enabled interfaces for
each hardware type enabled in the conductor at conductor startup, and
unregisters them at conductor shutdown. Validation is left as a todo for
now.
Change-Id: I14e88bfc304de9414de008d1cc8568dda9115ecc
Partial-Bug: #1524745
This patch adds a "volume_targets" DB table in order to save
the volume target information of physical nodes. With this patch,
Ironic can put/get volume target information to/from the database.
Co-Authored-By: Stephane Miller <stephane@alum.mit.edu>
Co-Authored-By: Ruby Loo <ruby.loo@intel.com>
Change-Id: I79063f9d0aafd7b740785a883732536704e43b7c
Partial-Bug: 1526231
This revision follows up on the feedback on change
I8237ab671a04ac9b01c8bdb2936cf0a661b9b1de which was
to rename one of the parameters use of "id" which is
confusing due to the "connector_id" field in the data
model for a volume connector, when id purely refers
to the "id" column in the database.
Additionally follows-up to the following object
revision I06aa1a94401e7c7faeb019926272a072d1ed1c51
and updates the variable name and some of the doc
strings in that method.
Change-Id: I6a34b195e6dd6f7898348f68646018dfa8bf77de
This patch introduces a new "volume_connectors" table in order to save
the volume connector information of physical nodes. With this patch,
Ironic can put/get volume connector information to/from the database.
Co-Authored-By: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com>
Co-Authored-By: Stephane Miller <stephane@alum.mit.edu>
Co-Authored-By: Julia Kreger <juliaashleykreger@gmail.com>
Change-Id: I8237ab671a04ac9b01c8bdb2936cf0a661b9b1de
Partial-Bug: 1526231
Currently, creating node with tags is not supported.
If tags values were passed over, an exception should
be thrown.
A follow-up patch of 19ef56cf00
Change-Id: I83e7db6a8da014962454e2b1248fe061985d98d8
Adds a new dbapi call get_node_by_port_addresses and associated objects call
Node.get_by_port_addresses. The logic is the same as in "lookup" agent passthru.
Will be used for a new lookup endpoint.
Change-Id: Ia5549fb16cd363f3492b9ca0400177c92a1aea19
Partial-Bug: #1570841
- set/unset node tags
- get node tags
- add/delete single tag
- check whether node tag exists
- Delete all tags attached to the node when it's destroyed
This will not support creating node with tags, just ignore
the specified tags.
Change-Id: Ibe83a726d904fd33b8550c8bec134cf05644560e
Partial-bug: #1526266
get_node_by_instance() only support for 'instance uuid', remove
'instance name' to avoid confusion.
Change-Id: Icaebf43c5daeba055b6d6054b1a51f4a51468620
Ironic should be able to provide the requisite connectivity
information to the Neutron ML2 plugin to allow drivers to
provision the top-of-rack switch for the bare metal server.
The addition of portgroups in Ironic allows the concept of
link aggregation to be handled in Ironic in order to provide
support for cases where multiple interfaces on the bare metal
server connect to switch ports of a single LAG.
This commit includes changes to:
- the DB models (extension of port model and addition of portgroup
model)
- the DB tests
Partial-bug: #1526403
DocImpact
Co-Authored-By: Laura Moore (laura.moore@sap.com)
Co-Authored-By: Jenny Moorehead (jenny.moorehead@sap.com)
Co-Authored-By: Will Stevenson (will.stevenson@sap.com)
Change-Id: Ic028c316b0670c2d18de89111e83069f3441f476
This commit adds support for querying reservation of
a node by a list of desired conductor names. It adds
a new filter 'reserved_by_any_of' which is expected to
be a list of conductors.
Change-Id: I149eae115fd3267e9b9efdb99aca445e7b18ba03
Closes-Bug: 1472212
The patch [1] sets the node's provision_state to DEPLOYWAIT while the
agent is booting and writing the the image onto the local disk. But in
the ironic-conductor we have a periodic task that checks for nodes in
DEPLOYWAIT state and see if the deployment timed out based on the node's
provision_udpated_at field and CONF.conductor.deploy_callback_timeout
configuration option.
The problem is that prior to this patch the node's provision_updated_at
field was only updated when we actually changed the provision state of
the node. So, if we are deployment a image which takes a long time to
be downloaded and written to the local disk ironic-conductor could time
out the deployment even if the agent still deploying that image.
This patch fixes this problem by touching the node's provision_updated_at
field when the node is heartbeating, so that we can indicate to the
ironic-conductor that the deployment is still running and we shouldn't
time it out.
[1] f1929f0155
Closes-Bug: #1475672
Change-Id: I9373c42168cc1ffaae212f17b067a6e4b6d862fe
Periodically checks the nodes in DEPLOYING and the state of the conductor
deploying them. If we find out that a conductor that was provisioning
the node has died we then break release the node and gracefully mark
the deployment as failed.
A new method called "get_offline_conductors" was added to the database
api which return a list of conductor hostnames that are offline.
Closes-Bug: #1461937
Change-Id: I293d3ff18e949b305e6404b8d3ceb75e29b88356
Functions is_int_like(), generate_uuid() is_uuid_like() available in
oslo.utils, so we can use them from there and remove duplicates from
Ironic code
Change-Id: I2a319e633a835dbca6831148acaf425e4ff6a725
Everything that is tracked in Ironic is done via UUID. This isn't very
friendly to humans.
This change adds a new concept to ironic, that being the <logical name>,
which can be used interchangeably with the <node uuid>. Everywhere a
<node uuid> can be specified, we are able to instead specify a <logical
name>, if such an association exists for that node.
APIImpact:
This raises the X-OpenStack-Ironic-API-Version to 1.5, and
adds a new "name" property to nodes, which can be substituted
for the UUID in requests.
This also adds a 'node' parameter for 'GET /v1/nodes/validate'. This
parameter can be a node's UUID or name. The existing 'node_uuid'
parameter is still supported.
DocImpact
blueprint: logical-names
Co-Authored-By: Devananda van der Veen <devananda.vdv@gmail.com>
Change-Id: I505181a1df064194848e3d5b79d01746024ce037
The oslo team is recommending changing to non-namespaced references.
Implements: blueprint drop-namespace-packages
Change-Id: I45462d9d49552044ad990f22bd6e6c5b37cf0649
The oslo team is recommending changing to non-namespaced references.
Implements: blueprint drop-namespace-packages
Change-Id: Iefe0a771dc8328bc92e13dd6d66fdd3853d5bba6
This patch adds the new provisioning state AVAILABLE, and bumps the API
microversion to 1.1. This version exposes the renaming of the previous
provision_state="None" to provision_state="available" for nodes which
are available for use.
A database migration is added which updates all DB records'
provision_state from NOSTATE to AVAILABLE.
Since database migrations and code changes may be rolled out at
different times, the conductor can deploy to a node in either
NOSTATE or AVAILABLE states.
OperatorImpact:
This change should be rolled out to production services, and the
conductor service should be restarted, *before* the database
migration is applied. Ironic will then begin "translating" existing
node states to the new AVAILABLE state automatically when it touches
them. If the DB migration is run much later, it may not actually
update any records (and that is OK).
DocImpact:
This change updates the Node provision_state value which represents
a node that is available for provisioning. It is changed from
"None" to "available", but this change is only realized when the
X-OpenStack-Ironic-API-Version header is >= 1.1
*** NOTE ***
Nova interprets the provision_state of Nodes to determine which should
be exposed to the scheduler and counted as available resources. Up to
the Juno release, Nova looked for the "NOSTATE" state to indicate this,
represented as provision_state=None.
After commit Idbd36b230cf997bed7a86c3f56cf9c70995028b2 landed in Nova,
both the old "None" and new "available" states are interpreted in this
way. As such, Nova may continue to use Juno Ironic, which did not
support microversions, or may begin using the 1.1 version.
Implements: blueprint new-ironic-state-machine
Change-Id: I5e6f6ee5877d475136ce2ebad4a9333b424dc96b
Fixes files with the PEP8 error:
H405 multi line docstring summary not separated with an empty line
and enables the PEP8 check in tox.ini.
Change-Id: I632c89e2a1783be8305a8a8cea7ae9d3bb55b62c
This change fixes all markup mistakes in docstrings that lead to
warnings and errors during docs building.
Partial-bug: #1277282
Change-Id: I092a684b7587b802427d57f4292398bfd21deeb1
Add "conductor_affinity" column to nodes table, containing a reference to the
`id` of the conductor service (not its hostname) that has most recently
performed some action which could require local state to be maintained
(eg, built a PXE config, or started a SOL session).
Using the `id` as a foreign key necessitates not deleting conductors
when unregistering them, but instead marking them offline. This also
helps in determining if a conductor service was only restarted (though
this patch does not implement graceful shutdown).
Thus, this patch also adds an "online" boolean column to the conductors
table to track whether a conductor is on- or offline, and updates
the register and unregister methods to use that field transparently.
It may be noted that this does not change the behavior of
register_conductor or unregister_conductor, though an optional
"update_existing" parameter has been added to register_conductor. This
replaces a DELETE query with an UPDATE query instead.
Co-Authored-By: David Shrewsbury <shrewsbury.dave@gmail.com>
Co-Authored-By: Lucas Alvares Gomes <lucasagomes@gmail.com>
Related-bug: #1279331
Change-Id: I8e8b5cc00fc9f565ad2fb442e9a26077342e0a25
VIF is not indexed by the databse, it lives inside the extra attribute
which is a data blob, so the method is not used.
Change-Id: I11ce35bae1aa81c38c8ebc87251148ae65f3a30e
Partial-bug: 1314732
The same work have already been done by Nodes (see 2192f2848e), so right
now the dbapi's are inconsistent across different objects. This patch
fixes it for Port.
This patch removes all direct calls to dbapi's get_port(). They are
replaced either by Port.get(), Port.get_by_id(), Port.get_by_uuid()
or Port.get_by_address() calls.
Additional detail about the changes:
1) Break DBAPI get_port() into get_port_by_id(), get_port_by_uuid(),
and get_port_by_address(). Let's be explicit about which type we're
passing. This allows Port.get_by_uuid() to work exactly how its
named. Also, do not return an object from the DB API calls. The Chassis
object itself will do the conversion.
2) Adds Port.get_by_id() and Port.get_by_address to compliment the
current Port.get_by_uuid() for places you are querying by the ID.
3) Adds Port.get() so that you can still have a single method to use to
pass either and ID, UUID or MAC address.
4) Make all of the Port.get* calls set the 'context' so that you can
later just port.save() without passing it. Doc strings have been updated
to clarify what 'context' is for.
Co-Authored-By: Chris Behrens <cbehrens@codestud.com>
Related-Bug: #1314732
Change-Id: I39d9a7acc12f0f3b7e06abd038537cd2759fb088
The same work have already been done by Nodes (see 2192f2848e), so right
now the dbapi's are inconsistent across different objects. This patch
fixes it for Chassis.
This patch removes all direct calls to dbapi's get_chassis(). They
are replaced either by Chassis.get(), Chassis.get_by_id(), or
Chassis.get_by_uuid() calls.
Additional detail about the changes:
1) Break DBAPI get_chassis() into get_chassis_by_id() and get_chassis_by_uuid().
Let's be explicit about which type we're passing. This allows
Chassis.get_by_uuid() to work exactly how its named. Also, do not
return an object from the DB API calls. The Chassis object itself will
do the conversion.
2) Adds Chassis.get_by_id() to compliment the current
Chassis.get_by_uuid() for places you are querying by the ID.
3) Adds Chassis.get() so that you can still have a single method to use
to pass either and ID or a UUID.
4) Make all of the Chassis.get* calls set the 'context' so that you
can later just chassis.save() without passing it. Doc strings have been
updated to clarify what 'context' is for.
Co-Authored-By: Chris Behrens <cbehrens@codestud.com>
Related-Bug: #1314732
Change-Id: I5162c2843e15e538c1dc50dd5ac775298f8f0f9d
oslo.db library has been graduated from oslo-incubator,
so now we can use it instead of ironic.openstack.common.db.* code.
Co-Authored-By: Ghe Rivero <ghe.rivero@hp.com>
Implements: blueprint oslo.db
Change-Id: I250050a7dbd8735ba3af954223b54eabae793f59
The multi-node locking is not used and there's no plan to use it.
Removing it allows us to clean up a lot of code.
The TaskManager tests are refactored to not use the DB.
Removed 'node' from get_node_mac_addresses() in driver/utils as it's
no longer needed.
Partial-Bug: 1312632
Change-Id: Ie3577ba150df6c84fc34a4b08775e5011f8925cb
This patch removes all direct calls to dbapi's get_node(). They are
replaced either by Node.get(), Node.get_by_id(), or Node.get_by_uuid()
calls.
Additional detail about the changes:
1) Break DBAPI get_node() into get_node_by_id() and get_node_by_uuid().
Let's be explicit about which type we're passing. This allows
Node.get_by_uuid() to work exactly how its named. Also, do not
return an object from the DB API calls. The Node object itself will
do the conversion.
2) Adds Node.get_by_id() to compliment the current Node.get_by_uuid()
for places you are querying by the ID.
3) Adds Node.get() so that you can still have a single method to use
to pass either and ID or a UUID.
4) Make all of the Node.get* calls set the 'context' so that you can
later just node.save() without passing it. Doc strings have been
updated to clarify what 'context' is for.
Change-Id: I995891b1645056a5b15c48e37b8bcd1e299ac468
New nodes filter parameters added to db.sqlalchemy.api. This
parameters used in _check_deploy_timeouts periodic task for
limit of worker threads which can be started simultaneously.
New config option 'periodic_max_workers' added to conductor
group.
Closes-Bug: #1285793
Change-Id: I646540e334dec05682640c05cedb315e0ee355bc
This renames get_ports_by_node() to get_ports_by_node_id() and changes
the node_id argument to always need to be the integer ID. This removes
the need for get_ports_by_node() to query the DB for UUID -> ID
conversion.
By doing this, we can save a DB query in the cases where we already have
the Node integer ID.
This is needed to help set up the next patch to clean up calls to
get_node(). There's now a case in port API controller where we need
to lookup the Node by UUID just to get its ID to be passed into this
call. Until we implement the Node lazy-loading code, we fetch the
full Node, but this isn't any worse than before for this case, as
I'm just moving it from the DB layer. I've noted this with a FIXME
and it will be made more efficient in the future.
Change-Id: I9993c0c87794171fb971524ac5c30490b3e33716
This sync contains commit - ce69e7f Don't store engine instances in oslo.db -
which removed global engine from oslo.db code. So, added code
for work with sqla engines and sessions to Ironic - get_engine()
and get_session() functions in ironic.db.sqlalchemy.api module.
Also this remove database slave connection and tpool features, because
they was removed from oslo code.
Latest oslo.db commit - 7959826af1f36a4bbc4c466d0d1e0b9efd468649
Change-Id: I14c3b823a8b975d5cd097778f3514cfb1abe2e10
Remove vim setting:
comment - # vim: tabstop=4 shiftwidth=4 softtabstop=4
at the top of source code files, except for files in
openstack/common.
Change-Id: Ie80f76f08e27b7f5f747227c4cca8d79ad98bec6
Partial-Bug: #1229324
Boolean parameter 'maintenance' added to API for filtering
nodes by maintenance mode, example:
/nodes?maintenance=false
strutils.bool_from_string() used for converting 'associated'
and 'maintenance' parameters, accepted values now for True
('1', 't', 'true', 'on', 'y', 'yes'), for False
('0', 'f', 'false', 'off', 'n', 'no') case-insensitive.
Refactored dbapi method get_node_list with filters used for
_get_nodes_collection in nodes controller.
Partial-Bug: #1260099
Partial-Bug: #1271291
Change-Id: I01a62eb641316e890d191cf569bb3cf00b7619f2
Current code can potentially overwrite the instance_uuid without
exception when multiple dbapi.update_node calls are issued. This
patch adds a check to dbapi so that the NodeAssociated exception
will be raised in this case.
The Nova Ironic driver will handle this exception. This will be
introduced in a separate patch.
Change-Id: I28ef5ce55399bde7073ffc111e9bc4400e5577ee
Partial-Bug: #1244541
To facilitate the consistent hash ring, we must know not only what
conductors are active, but also which driver(s) each active conductor
supports. This patch renames list_active_conductor_drivers to
get_active_driver_dict and changes the return value to be a dict,
mapping drivers to the set of hosts which support them.
blueprint instance-mapping-by-consistent-hash
Change-Id: Ie327aa7d9207f6f5da1380631dbbc431dfd7e218
Implement a periodic task in the ConductorManager which will check all
the existing, non-locked nodes and verify that their current power
states correspond to state stored in DB. If they differ, for now, log a
warning and update the DB using current power state.
This is a step towards keeping powered-off-nodes off.
Also, this removes the unused db.api.get_nodes method
and adds a new get_nodeinfo_list method.
Change-Id: I609fdbd7db6620de617b44f83c7ec35350f9178c
Blueprint: keep-powered-off-nodes-off
uuidutils.generate_uuid() is going to be removed from oslo, so we
need to remove the call from our Ironic code.
http://lists.openstack.org/pipermail/openstack-dev/2013-November/
018980.html
We create new method in our Ironic common utils to wrap the
generate_uuid methods.
Change-Id: I7bc4ca8fcdb29c4ee5b3e7fc7afb0235812a1c0d
Partial-Bug: #1253497
The __metaclass__ syntax is not compatible with Python 3, this patch will
replace it with the add_metaclass decorator provided by the six library
which make it easier to add metaclasses that works on both Python 2 and 3.
The patch also grouped some imports as per PEP8.
Change-Id: If4fcee8ec4bb5e7d6971ea5a4143fba6500a09e9
Partial-Bug: #1249886
To facilitate exposing a list of drivers in the API,
and keep track of which ironic-conductor instance status,
this patch ...
* adds a new 'conductors' table in the DB
* adds a Conductor object class (with intentionally limited
functionality)
* adds db/api methods for register/unregister/get/touch
* adds periodic task to conductor to maintain its updated_at field
* adds an additional db/api method to retrieve a list of drivers
which are registered by active conductor instances
Change-Id: I1ebdb92d5c2d6ad1a6d1717dd13ff51be181ccc0