Commit Graph

65 Commits

Author SHA1 Message Date
Harald Jensås 364fa23916 list_instances - cache allocations
When listing instances fetch all allocations to a cache,
fetch each nodes allocation from the cache. This is
significantly faster than calling get_allocation for each
node.

time metealsmith list # 250 nodes:
  real 0m54.970s vs real 1m45.048s without "cached".

Story: 2010571
Task: 47318
Change-Id: Ic4cef61e338fb57bea5de4f96eb3584386cc5152
2023-02-08 10:08:06 +01:00
Dmitry Tantsur 77d802f3d6 Deprecate instance network boot
Remove or update the corresponding CI jobs. Use the new custom Cirros
image in the HTTP job to avoid relying on CentOS.

Temporary increase complexity requirements while we have a deprecation
warning in the provisioner.

Change-Id: I5e65f9949ee3b78430309017800b88c1ba21dd02
2022-08-24 13:19:52 +02:00
Harald Jensås f98dfa61c1 Write network_data.json metadata to config-dirve
cloud-init will use fall-back config when network metadata
is *not* present. This works fine if the first NIC on the node is
connected to a network with DHCP. But, when the first NIC is not
used for provisioning, cloud-init will only write a fallback config
for the first NIC. This causes the provisioned node to be unavailable.

Extend instance configuration to include network metadata so that
cloud-init can configure node networking.

Story: 2009238
Task: 43378
Change-Id: I70f1a972a6d5a0398cd348f00308957386d66067
2021-09-22 14:50:02 +02:00
Dmitry Tantsur 65f85451d0 Do not wipe instance_info on normal unprovisioning
Ironic uses information from instance_info on tear down and removes
it afterwards automatically.

Change-Id: I88ea06b7cb07d648cc68b677e905bf403ae8e1ed
2021-01-26 19:19:05 +01:00
Iury Gregory Melo Ferreira c765bbe8a8 Stop using six library
Since we've dropped support for Python 2.7, it's time to look at
the bright future that Python 3.x will bring and stop forcing
compatibility with older versions.
This patch removes the six library from requirements, not
looking back.

Change-Id: I19384db89fc2a68376efc3f9f2e05fbd05046fd6
2019-12-03 15:15:20 +01:00
Dmitry Tantsur 2d801e2526 Stop requiring root size for whole disk images
This requirement has been fixed in newer versions of ironic.

Change-Id: I4460755ee66b4aa0b8a651b6bd142c769d669ee2
2019-11-05 18:29:16 +01:00
Steve Baker a77cfb2ce6 Set useful port name when hostname is provided
It is useful to see the purpose of a port when viewing a port list or
port details. This change will set the port name to
<hostname>-<net-name> when the hostname is provided to the NICs
constructor.

Change-Id: Ic5789c0c3808afaa6b45408bce51d6c4ca86dbe5
2019-08-12 01:00:20 +00:00
Steve Baker 6f316bbad4 Set instance_info.display_name to the hostname
This makes metalsmith consistent with what the nova ironic driver
does, and provides a way of discovering the hostname for a node
without needing to query the allocation API.

Change-Id: I40bbf155421cd2b382f8262eb38393c3300478cd
2019-08-06 22:54:09 +00:00
Dmitry Tantsur 97311ce7fb Clean up exceptions metalsmith raises
This change switches from a mix of metalsmith and SDK exceptions
to consistently using metalsmith exceptions.

Change-Id: I43339686a42644877dbe40d1116db1585a8a0800
2019-08-02 13:59:12 +02:00
Dmitry Tantsur e9c25b02e5 Use allocation name for hostname instead of a custom field
This concludes the switch to the allocation API.

Change-Id: I25cdae7d17604140f728fdbcfea4110cbd222679
2019-06-07 11:08:48 +02:00
Zuul b1769b01cc Merge "Split InstanceConfig into GenericConfig and CloudInitConfig" 2019-05-27 09:00:18 +00:00
Dmitry Tantsur 349e5074e3 Split InstanceConfig into GenericConfig and CloudInitConfig
As a side effect allows providing custom user data, not only users.

Change-Id: Ia4c305ea996b3bb58c5898777cc7a3c8b93a413d
2019-05-24 15:18:18 +02:00
Dmitry Tantsur 0e7fa76b5a Remove features deprecated in Stein
Change-Id: I9825df90c69233acaf3c712f371e33aaf2042d4c
2019-05-24 14:20:08 +02:00
Dmitry Tantsur 4920cc26a3 Allow disabling clean up on deployment failure
Change-Id: Iaa9e7ec1c2cd2b71047388e51255ec69d52d6a83
2019-05-17 14:13:10 +02:00
Dmitry Tantsur 814611f022 Switch to allocation API instead of reservations via instance_id
Change-Id: I45882ddd18d2a91db9c3592c6ed527676b91091b
2019-05-17 13:28:58 +02:00
Dmitry Tantsur 0161effc3a Build configdrives on ironic side
Change-Id: Ia058a410d1b1277497fbb645fc102c8b0a7aba4f
2019-05-17 10:30:41 +02:00
Dmitry Tantsur 1afa4ac4ed Expose Allocation objects on Instance
Change-Id: If62a6829478c532428aff2f5f51edc35df8ee2e1
2019-05-16 12:15:52 +02:00
Dmitry Tantsur 9be7472236 Accept hostname in reserve_node in addition to provision_node
With the allocation API we will need to provide the hostname as
the allocation name. Thus, we have to do it earlier.

Change-Id: I8afd8af23ad929fd9768e95a82fecd114fdcbfd9
2019-03-15 14:49:58 +01:00
Dmitry Tantsur 8e7b8d3f39 Ensure instance_info is clean before deploy and after failure
Currently stale values can be left in instance_info (and reused next time)
if a deployment attempts fails. This change ensures that we:
1) Purge instance_info completely on failures
2) Only keep traits and capabilities in instance_info on deploy.

Change-Id: I52a85620d9ac2f471bca6498294871f3bb16d47f
2019-03-08 14:31:47 +01:00
Dmitry Tantsur d64e020fd0 Make resource class required
Allocation API requires a resource class, so we have to require it now.

Change-Id: Ic3729fb8aa02c82379eceb2a2555fc9c0ba9bc57
2019-03-01 15:39:51 +01:00
Dmitry Tantsur e795f6c841 Make sure to not try reserving a reserved node
After the switch to openstacksdk we no longer have a sufficient check
on node's availability or maintenance. This patch restores it.

Change-Id: I2c85cf0adb02061b3dd85f19dd10c8a5af1118da
2019-01-22 18:08:53 +01:00
Dmitry Tantsur 02932096df Clean up the edge cases around states
Currently show_instance returns an Instance even if the requested node
is not actually an instance (e.g. just an available node). This change
corrects it. Make list_instances consistent with it.

Also make the states a proper enum to avoid consumers from using invalid
values (I did it several times when working on this patch).

Change-Id: If9aad0d7f4d10a7119d1f0bccc1cc32a918a72e3
2019-01-18 17:49:01 +01:00
Dmitry Tantsur 47e9e9319d Support specifying a subnet for NIC
This may be required in case of routed networks as an alternative
to specifying a fixed_ip.

Change-Id: I8187f950cb961f60131af8b07fb54eee69019dbc
2019-01-16 16:27:02 +01:00
Dmitry Tantsur eee74d31b8 Completely switch to openstacksdk
Change-Id: I1729797fa03095d200c7334281915abc284b5732
2019-01-15 10:24:52 +01:00
Dmitry Tantsur 928dfaf636 Remove deprecated root_disk_size
Change-Id: I647edc2bde4f78994dce57b4db2bb51fc099c056
2018-11-21 13:09:43 +01:00
Dmitry Tantsur b9cdef8ced Deprecate not providing resource_class (again)
It is not going to be compatible with the proposed allocation API,
because the API will have to be compatible with Placement, which
requires resource class.

Change-Id: Ib288e7f933f421d6ff756e6bc4877fd344515c74
Story: #2004341
Task: #28027
2018-11-21 13:03:45 +01:00
Dmitry Tantsur cea2cda604 Use the Connection.baremetal adapter for ironicclient Session
The result of get_session does not respect baremetal-specific options
like baremetal_endpoint_override in clouds.yaml.

Change-Id: Idccf4a0fc055dc9b81705b9e3b632a61a8891cfa
2018-11-06 14:46:35 +01:00
Dmitry Tantsur 47fe222b6d Accept optional fixed_ip for nics
Covers a popular case of nodes having a pre-defined IP.

Also moves NICs code to a separate module for clarity.

Change-Id: Id8272cc30728ca68e7ce2efd4f3a2f9887ef7449
Story: #2002171
Task: #26340
2018-09-14 16:59:11 +02:00
Dmitry Tantsur 2afd20938d Support creating a swap partition
BREAKING: --root-disk-size => --root-size

Story: #2002171
Task: #20033
Change-Id: I5d6b38e1a9e71b608b40e140e34c4509b896a1ff
2018-09-10 17:00:41 +02:00
Dmitry Tantsur c06e2c9baf Allow overriding traits in provision_node (similar to capabilities)
Change-Id: If6cfba9773dd2b5896d359d2bd1aa12f4062cfdf
Story: #2003685
Task: #26356
2018-09-10 16:49:01 +02:00
Dmitry Tantsur df831309ba Support traits for scheduling
Story: #2003685
Task: #26209
Change-Id: I4895c414abc55ece6cf56133f13ffaa7cd4f5f92
2018-09-07 16:57:57 +02:00
Dmitry Tantsur 51a006e307 Rework scheduling filters
Remove ValidationFilter, make it a part of reservation to avoid calling
it too many times. Fix AttributeError on failing the custom predicate.
Remove double validation in the reserver, we do another validation later
on anyway.

BREAKING: changes the exception classes.

Change-Id: Ibc3815989917ab777298a05810fd8f3e64debc8f
Story: #2003584
Task: #26178
2018-09-07 15:37:33 +02:00
Dmitry Tantsur 6bdd479773 Support for HTTP image location
Story: #2002048
Task: #19695
Change-Id: I75f33ebca3ea65274dcfcd8f4ddbd193f34706a9
2018-09-07 10:04:38 +02:00
Dmitry Tantsur f57e7547af Remove indirection when accessing Image and Network API
Change-Id: I1c6bc900088eb1bc925ef0471f4405208e874348
2018-09-06 18:57:47 +02:00
Dmitry Tantsur a638cec066 Allow filtering by arbitrary predicate and conductor_group
BREAKING: changed order of arguments in reserve_node.

BREAKING: changed exceptions inheriting ReservationFailed.

Change-Id: I79cc9b2794d8332cdb818af0b7effb28d4e9a786
Story: #2003584
Task: #24890
2018-09-05 12:25:11 +02:00
Dmitry Tantsur a34d0e0951 Foundation for different deployment sources
Change-Id: I7c9538e37476d9d3ea5b9cc403419dda95cf77cc
Story: #2002048
Task: #26064
2018-09-04 17:20:40 +02:00
Dmitry Tantsur d20abe3c79 Implement list_instances and `metalsmith list`
Change-Id: I51f83fcebf665be8b290774433fbf1da5108ec27
Story: #2003585
Task: #24891
2018-08-29 12:02:24 +02:00
Dmitry Tantsur 5aacd7bbdb Allow specifying a list of nodes to pick from
Makes resource class no longer mandatory.

Change-Id: If14d5846e7b50a867950ae439985bbe877998bc7
Story: #2002171
Task: #20034
2018-07-05 19:54:57 +02:00
Dmitry Tantsur 2d6ccf26d8 Store requested capabilities in instance_info
Also allow overriding them in the provision_node call.

Story: #2002171
Task: #20031
Change-Id: I4b3de4db6c3b6371e5a36921e32953ea354784cc
2018-07-05 19:54:32 +02:00
Dmitry Tantsur ef7521e294 Change wait_for_provisioning to return Instance objects
Change-Id: Iea7aece885a5ea4c42000c0d220060a102db03c8
2018-07-03 15:11:39 +02:00
Dmitry Tantsur 6030b02bb3 Separate wait_for_provision_state method
Change-Id: I27d976162c503ff494d5786649e273a6385207d2
2018-06-28 15:39:55 +02:00
Dmitry Tantsur 703bddb775 Pass in InstanceConfig instead of ssh_keys
Change-Id: I7b313174896917d583bf8356207abf57ea08a197
2018-06-22 17:12:16 +02:00
Dmitry Tantsur 72995b1117 Rename image_ref -> image and get_image_info -> get_image
Change-Id: I85c2967935f9394b424beb1d79682700e41de1bf
2018-06-21 13:24:07 +02:00
Dmitry Tantsur 4e16c2f6f7 Separate NIC validation
Change-Id: Icfc15cb4780d4682ed20aa2e5796578e81496c87
2018-06-19 10:28:46 +02:00
Dmitry Tantsur 7b3561bb9a Move Instance to its own file
Change-Id: I607b804f719e2a660c2e52a672b68b9281af4569
2018-06-18 17:01:24 +02:00
Dmitry Tantsur 320144a73e Add command and function to show instances
Story: #2002170
Task: #20027
Change-Id: I78991f75ea45ea61553d75301117c77a16ea8885
2018-06-08 16:38:46 +02:00
Dmitry Tantsur 1cda22151d Support custom hostnames
Story: #2002170
Task: #20036
Change-Id: Ida169c96128459b22e495ca92d454dd3f08f7eb3
2018-06-08 15:42:26 +02:00
Dmitry Tantsur 22361ce9d1 Move logging IP addresses to the CLI itself
Add Instance.ip_addresses for similar use cases.

Change-Id: I1e788e507783f69b1970ab8eca5994aff9f0ea12
2018-05-29 15:30:28 +02:00
Dmitry Tantsur b55ba7e2f5 Add output formatters for CLI commands
Change-Id: I712e597856617acf13cc33e0ad2aa757326ff9f5
2018-05-29 13:04:13 +02:00
Dmitry Tantsur 23d44e318c Do not clean up nodes after the deployment has started
If something fails during provisioning, we need to leave the node
intact for debugging. The undeploy command should be used to clean up.

Change-Id: If4bbeceb0307a4df07dbae912db1d7f69c94e3c5
2018-05-28 18:38:48 +02:00