Skip to content

Commit 8942988

Browse files
authored
Merge pull request #1232 from rackerlabs/trigger-storage_on_server_create
feat: Trigger storage automation on server create
2 parents 33b129a + 60a1092 commit 8942988

16 files changed

+854
-40
lines changed

docs/operator-guide/rabbitmq.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ kubectl -n openstack exec -it rabbitmq-server-0 -c rabbitmq -- rabbitmqadmin --v
6262
kubectl -n openstack cp rabbitmq-server-0:/tmp/test.json -c rabbitmq /tmp/test.json
6363
```
6464

65+
### Republish captured message
66+
67+
1. Save the exact JSON body of the message/event into file (see commands above how to get that).
68+
2. Republish like this:
69+
70+
```bash
71+
cat /tmp/full-unpacked.json| kubectl -n openstack exec -it rabbitmq-server-0 -c rabbitmq -- rabbitmqadmin --vhost=ironic publish exchange=ironic routing_key=ironic_versioned_notifications.info
72+
```
73+
6574
### To dump, print, list-events, and requeue an openstack notifications rabbitmq queue
6675

6776
use [OpenStack RabbitMQ Queue Dump Tool](https://github.com/rackerlabs/understack/tree/main/examples/openstack-notifications)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"oslo.version": "2.0",
3+
"oslomessage": "{\"message_id\": \"1412008d-9bcb-4218-97d0-abac657e856f\", \"publisher_id\": \"ironic-conductor.1327175-hp3\", \"event_type\": \"baremetal.node.provision_set.end\", \"priority\": \"INFO\", \"payload\": {\"ironic_object.name\": \"NodeSetProvisionStatePayload\", \"ironic_object.namespace\": \"ironic\", \"ironic_object.version\": \"1.17\", \"ironic_object.data\": {\"instance_info\": {\"image_source\": \"5048de36-4c01-4047-b638-195e639cb1e3\", \"root_gb\": \"480\", \"swap_mb\": \"0\", \"display_name\": \"marek-ovnsrv\", \"vcpus\": \"16\", \"nova_host_id\": \"nova-compute-ironic-0\", \"memory_mb\": \"98304\", \"local_gb\": \"445\", \"project_id\": \"5f5955bc89e148e59a12110a3945e4d7\", \"project_name\": \"marek-ironic-hook\", \"user_id\": \"5f9179b7e200cd85c55e8a26400e266c6b4f7209f6d3fb2adc3cf8e1113c378c\", \"user_name\": \"[email protected]\", \"flavor_name\": \"gp2.small\", \"fixed_ips\": \"[]\", \"floating_ips\": \"[]\", \"image_type\": \"whole-disk\", \"configdrive\": \"******\", \"image_url\": \"******\", \"image_checksum\": null, \"image_os_hash_algo\": \"sha256\", \"image_os_hash_value\": \"11220de71f1a42982818e6cc79a4f3ceb482d37d3f9ddc6e89433a6fae0fc4af\", \"image_disk_format\": \"raw\", \"image_container_format\": \"bare\", \"image_tags\": [], \"image_properties\": {\"owner_specified.openstack.md5\": \"\", \"owner_specified.openstack.object\": \"images/Ubuntu-24.04\", \"owner_specified.openstack.sha256\": \"\", \"stores\": \"file\", \"os_distro\": \"ubuntu\", \"hash_value\": \"9b1a105707a63c0ae4873db066e83ca0dd7758c2328b55b70a1eac78cf706e0aa1f32db741f37f59308a4adc01250fd905e79eb42ca61d2c26cecff70a945e09\", \"owner_id\": \"32e02632f4f04415bab5895d1e7247b7\", \"virtual_size\": 4028497920, \"hash_algo\": \"sha512\", \"location\": {\"cloud\": \"\", \"region_name\": null, \"zone\": null, \"project\": {\"id\": null, \"name\": null, \"domain_id\": null, \"domain_name\": null}}, \"os_version\": \"24.04\"}}, \"driver_internal_info\": {\"clean_steps\": null, \"agent_erase_devices_iterations\": 1, \"agent_erase_devices_zeroize\": true, \"agent_continue_if_secure_erase_failed\": false, \"agent_continue_if_ata_erase_failed\": false, \"agent_enable_nvme_secure_erase\": true, \"agent_enable_ata_secure_erase\": true, \"disk_erasure_concurrency\": 4, \"agent_erase_skip_read_only\": false, \"last_power_state_change\": \"2025-09-03T17:03:28.343462\", \"agent_version\": \"10.1.1.dev15\", \"agent_last_heartbeat\": \"2025-09-03T17:02:21.564254\", \"hardware_manager_version\": {\"generic_hardware_manager\": \"1.2\"}, \"agent_cached_clean_steps_refreshed\": \"2025-09-03T16:00:55.336400\", \"deploy_steps\": null, \"agent_cached_deploy_steps_refreshed\": \"2025-09-03T17:01:36.052321\", \"dnsmasq_tag\": \"cad76ddd-ab76-4443-baa2-156b1728325b\", \"automatic_lessee\": true, \"is_whole_disk_image\": true, \"agent_secret_token\": \"******\", \"agent_url\": \"https://10.4.50.76:9999\", \"agent_verify_ca\": \"/var/lib/ironic/certificates/461737c4-037c-41bf-9c17-f4f33ff20dd7.crt\"}, \"event\": \"done\", \"previous_provision_state\": \"deploying\", \"previous_target_provision_state\": \"active\", \"clean_step\": {},\"conductor_group\": \"\", \"console_enabled\": false, \"created_at\": \"2025-07-17T19:21:17Z\", \"deploy_step\": {}, \"description\": null, \"driver\": \"idrac\", \"extra\": {}, \"boot_mode\": \"uefi\", \"secure_boot\": false, \"inspection_finished_at\": \"2025-07-17T19:22:28Z\", \"inspection_started_at\": null, \"instance_uuid\": \"5027885e-52a8-48f9-adf4-14d8f5f4ccb8\", \"last_error\": null, \"maintenance\": false, \"maintenance_reason\": null, \"fault\": null, \"bios_interface\": \"idrac-redfish\", \"boot_interface\": \"http-ipxe\", \"console_interface\": \"no-console\", \"deploy_interface\": \"direct\", \"inspect_interface\": \"idrac-redfish\", \"management_interface\": \"idrac-redfish\", \"network_interface\": \"neutron\", \"power_interface\": \"idrac-redfish\", \"raid_interface\": \"idrac-redfish\", \"rescue_interface\": \"no-rescue\", \"storage_interface\": \"noop\", \"vendor_interface\": \"idrac-redfish\", \"name\": \"Dell-G3GSW04\", \"owner\": \"32e02632f4f04415bab5895d1e7247b7\", \"lessee\": \"5f5955bc89e148e59a12110a3945e4d7\", \"power_state\": \"power on\", \"properties\": {\"vendor\": \"Dell Inc.\", \"memory_mb\": 98304, \"cpus\": 32, \"cpu_arch\": \"x86_64\", \"local_gb\": \"445\", \"capabilities\": \"boot_mode:uefi\"}, \"protected\": false, \"protected_reason\": null, \"provision_state\": \"active\", \"provision_updated_at\": \"2025-09-03T17:03:56Z\", \"resource_class\": \"baremetal.gp2.small\", \"retired\": false, \"retired_reason\": null, \"target_power_state\": null, \"target_provision_state\": null, \"traits\": [], \"updated_at\": \"2025-09-03T17:03:56Z\", \"uuid\": \"461737c4-037c-41bf-9c17-f4f33ff20dd7\"}}, \"timestamp\": \"2025-09-03 17:03:56.310769\", \"_unique_id\": \"940e1337d2a64a1b9efa0775744da7f1\", \"_context_user\": null, \"_context_project_id\": null, \"_context_system_scope\": null, \"_context_project\": null, \"_context_domain\": null, \"_context_user_domain\": null, \"_context_project_domain\": null, \"_context_is_admin\": false, \"_context_read_only\": false, \"_context_show_deleted\": false, \"_context_auth_token\": null, \"_context_request_id\": \"req-68307ef2-55b9-4fc9-b93e-0a7bbafdce66\", \"_context_global_request_id\": \"req-9ba1663c-abaf-4256-8725-937087e47754\", \"_context_resource_uuid\": null, \"_context_roles\": [], \"_context_user_identity\": \"- - - - -\", \"_context_is_admin_project\": true, \"_context_auth_token_info\": null}"
4+
}
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
{
2+
"message_id": "1412008d-9bcb-4218-97d0-abac657e856f",
3+
"publisher_id": "ironic-conductor.1327175-hp3",
4+
"event_type": "baremetal.node.provision_set.end",
5+
"priority": "INFO",
6+
"payload": {
7+
"ironic_object.name": "NodeSetProvisionStatePayload",
8+
"ironic_object.namespace": "ironic",
9+
"ironic_object.version": "1.17",
10+
"ironic_object.data": {
11+
"instance_info": {
12+
"image_source": "5048de36-4c01-4047-b638-195e639cb1e3",
13+
"root_gb": "480",
14+
"swap_mb": "0",
15+
"display_name": "marek-ovnsrv",
16+
"vcpus": "16",
17+
"nova_host_id": "nova-compute-ironic-0",
18+
"memory_mb": "98304",
19+
"local_gb": "445",
20+
"project_id": "5f5955bc89e148e59a12110a3945e4d7",
21+
"project_name": "marek-ironic-hook",
22+
"user_id": "5f9179b7e200cd85c55e8a26400e266c6b4f7209f6d3fb2adc3cf8e1113c378c",
23+
"user_name": "[email protected]",
24+
"flavor_name": "gp2.small",
25+
"fixed_ips": "[]",
26+
"floating_ips": "[]",
27+
"image_type": "whole-disk",
28+
"configdrive": "******",
29+
"image_url": "******",
30+
"image_checksum": null,
31+
"image_os_hash_algo": "sha256",
32+
"image_os_hash_value": "11220de71f1a42982818e6cc79a4f3ceb482d37d3f9ddc6e89433a6fae0fc4af",
33+
"image_disk_format": "raw",
34+
"image_container_format": "bare",
35+
"image_tags": [],
36+
"image_properties": {
37+
"owner_specified.openstack.md5": "",
38+
"owner_specified.openstack.object": "images/Ubuntu-24.04",
39+
"owner_specified.openstack.sha256": "",
40+
"stores": "file",
41+
"os_distro": "ubuntu",
42+
"hash_value": "9b1a105707a63c0ae4873db066e83ca0dd7758c2328b55b70a1eac78cf706e0aa1f32db741f37f59308a4adc01250fd905e79eb42ca61d2c26cecff70a945e09",
43+
"owner_id": "32e02632f4f04415bab5895d1e7247b7",
44+
"virtual_size": 4028497920,
45+
"hash_algo": "sha512",
46+
"location": {
47+
"cloud": "",
48+
"region_name": null,
49+
"zone": null,
50+
"project": {
51+
"id": null,
52+
"name": null,
53+
"domain_id": null,
54+
"domain_name": null
55+
}
56+
},
57+
"os_version": "24.04"
58+
}
59+
},
60+
"driver_internal_info": {
61+
"clean_steps": null,
62+
"agent_erase_devices_iterations": 1,
63+
"agent_erase_devices_zeroize": true,
64+
"agent_continue_if_secure_erase_failed": false,
65+
"agent_continue_if_ata_erase_failed": false,
66+
"agent_enable_nvme_secure_erase": true,
67+
"agent_enable_ata_secure_erase": true,
68+
"disk_erasure_concurrency": 4,
69+
"agent_erase_skip_read_only": false,
70+
"last_power_state_change": "2025-09-03T17:03:28.343462",
71+
"agent_version": "10.1.1.dev15",
72+
"agent_last_heartbeat": "2025-09-03T17:02:21.564254",
73+
"hardware_manager_version": {
74+
"generic_hardware_manager": "1.2"
75+
},
76+
"agent_cached_clean_steps_refreshed": "2025-09-03T16:00:55.336400",
77+
"deploy_steps": null,
78+
"agent_cached_deploy_steps_refreshed": "2025-09-03T17:01:36.052321",
79+
"dnsmasq_tag": "cad76ddd-ab76-4443-baa2-156b1728325b",
80+
"automatic_lessee": true,
81+
"is_whole_disk_image": true,
82+
"agent_secret_token": "******",
83+
"agent_url": "https://10.4.50.76:9999",
84+
"agent_verify_ca": "/var/lib/ironic/certificates/461737c4-037c-41bf-9c17-f4f33ff20dd7.crt"
85+
},
86+
"event": "done",
87+
"previous_provision_state": "deploying",
88+
"previous_target_provision_state": "active",
89+
"clean_step": {},
90+
"conductor_group": "",
91+
"console_enabled": false,
92+
"created_at": "2025-07-17T19:21:17Z",
93+
"deploy_step": {},
94+
"description": null,
95+
"driver": "idrac",
96+
"extra": {},
97+
"boot_mode": "uefi",
98+
"secure_boot": false,
99+
"inspection_finished_at": "2025-07-17T19:22:28Z",
100+
"inspection_started_at": null,
101+
"instance_uuid": "5027885e-52a8-48f9-adf4-14d8f5f4ccb8",
102+
"last_error": null,
103+
"maintenance": false,
104+
"maintenance_reason": null,
105+
"fault": null,
106+
"bios_interface": "idrac-redfish",
107+
"boot_interface": "http-ipxe",
108+
"console_interface": "no-console",
109+
"deploy_interface": "direct",
110+
"inspect_interface": "idrac-redfish",
111+
"management_interface": "idrac-redfish",
112+
"network_interface": "neutron",
113+
"power_interface": "idrac-redfish",
114+
"raid_interface": "idrac-redfish",
115+
"rescue_interface": "no-rescue",
116+
"storage_interface": "noop",
117+
"vendor_interface": "idrac-redfish",
118+
"name": "Dell-G3GSW04",
119+
"owner": "32e02632f4f04415bab5895d1e7247b7",
120+
"lessee": "5f5955bc89e148e59a12110a3945e4d7",
121+
"power_state": "power on",
122+
"properties": {
123+
"vendor": "Dell Inc.",
124+
"memory_mb": 98304,
125+
"cpus": 32,
126+
"cpu_arch": "x86_64",
127+
"local_gb": "445",
128+
"capabilities": "boot_mode:uefi"
129+
},
130+
"protected": false,
131+
"protected_reason": null,
132+
"provision_state": "active",
133+
"provision_updated_at": "2025-09-03T17:03:56Z",
134+
"resource_class": "baremetal.gp2.small",
135+
"retired": false,
136+
"retired_reason": null,
137+
"target_power_state": null,
138+
"target_provision_state": null,
139+
"traits": [],
140+
"updated_at": "2025-09-03T17:03:56Z",
141+
"uuid": "461737c4-037c-41bf-9c17-f4f33ff20dd7"
142+
}
143+
},
144+
"timestamp": "2025-09-03 17:03:56.310769",
145+
"_unique_id": "940e1337d2a64a1b9efa0775744da7f1",
146+
"_context_user": null,
147+
"_context_project_id": null,
148+
"_context_system_scope": null,
149+
"_context_project": null,
150+
"_context_domain": null,
151+
"_context_user_domain": null,
152+
"_context_project_domain": null,
153+
"_context_is_admin": false,
154+
"_context_read_only": false,
155+
"_context_show_deleted": false,
156+
"_context_auth_token": null,
157+
"_context_request_id": "req-68307ef2-55b9-4fc9-b93e-0a7bbafdce66",
158+
"_context_global_request_id": "req-9ba1663c-abaf-4256-8725-937087e47754",
159+
"_context_resource_uuid": null,
160+
"_context_roles": [],
161+
"_context_user_identity": "- - - - -",
162+
"_context_is_admin_project": true,
163+
"_context_auth_token_info": null
164+
}

python/understack-workflows/tests/test_netapp_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def test_create_volume_success(self, mock_volume_class, netapp_client):
215215
mock_volume_instance = MagicMock()
216216
mock_volume_instance.name = "test-volume"
217217
mock_volume_instance.uuid = "volume-uuid-123"
218-
mock_volume_instance.size = "1TB"
218+
mock_volume_instance.size = 1024
219219
mock_volume_instance.state = "online"
220220
mock_volume_class.return_value = mock_volume_instance
221221

@@ -231,7 +231,7 @@ def test_create_volume_success(self, mock_volume_class, netapp_client):
231231
assert isinstance(result, VolumeResult)
232232
assert result.name == "test-volume"
233233
assert result.uuid == "volume-uuid-123"
234-
assert result.size == "1TB"
234+
assert result.size == 1024
235235
assert result.state == "online"
236236
assert result.svm_name == "test-svm"
237237

python/understack-workflows/tests/test_netapp_value_objects.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,21 +321,21 @@ def test_valid_volume_result(self):
321321
result = VolumeResult(
322322
name="test-volume",
323323
uuid="vol-uuid-123",
324-
size="1TB",
324+
size=1024,
325325
state="online",
326326
svm_name="test-svm",
327327
)
328328

329329
assert result.name == "test-volume"
330330
assert result.uuid == "vol-uuid-123"
331-
assert result.size == "1TB"
331+
assert result.size == 1024
332332
assert result.state == "online"
333333
assert result.svm_name == "test-svm"
334334

335335
def test_volume_result_without_svm_name(self):
336336
"""Test volume result without SVM name."""
337337
result = VolumeResult(
338-
name="test-volume", uuid="vol-uuid-123", size="1TB", state="online"
338+
name="test-volume", uuid="vol-uuid-123", size=1024, state="online"
339339
)
340340

341341
assert result.svm_name is None
@@ -346,7 +346,7 @@ def test_volume_result_various_states(self):
346346

347347
for state in states:
348348
result = VolumeResult(
349-
name="test-volume", uuid="vol-uuid-123", size="1TB", state=state
349+
name="test-volume", uuid="vol-uuid-123", size=1024, state=state
350350
)
351351
assert result.state == state
352352

python/understack-workflows/tests/test_netapp_volume_service.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_create_volume_success(
5252
mock_client.create_volume.return_value = VolumeResult(
5353
name=expected_volume_name,
5454
uuid="volume-uuid-123",
55-
size=size,
55+
size=1024,
5656
state="online",
5757
svm_name=expected_svm_name,
5858
)
@@ -253,21 +253,20 @@ def test_volume_spec_creation(
253253
):
254254
"""Test that volume specification is created correctly."""
255255
project_id = "test-project-789"
256-
size = "2TB"
257256
aggregate_name = "test-aggregate"
258257

259258
mock_client.create_volume.return_value = VolumeResult(
260-
name="vol_test-project-789", uuid="uuid-123", size=size, state="online"
259+
name="vol_test-project-789", uuid="uuid-123", size=2048, state="online"
261260
)
262261

263-
volume_service.create_volume(project_id, size, aggregate_name)
262+
volume_service.create_volume(project_id, "2048M", aggregate_name)
264263

265264
# Verify the volume spec is created correctly
266265
call_args = mock_client.create_volume.call_args[0][0]
267266
assert call_args.name == "vol_test-project-789"
268267
assert call_args.svm_name == "os-test-project-789"
269268
assert call_args.aggregate_name == aggregate_name
270-
assert call_args.size == size
269+
assert call_args.size == "2048M"
271270

272271
def test_namespace_spec_creation(
273272
self, volume_service, mock_client, mock_error_handler
@@ -304,7 +303,7 @@ def test_exists_volume_found(self, volume_service, mock_client, mock_error_handl
304303
mock_volume_result = VolumeResult(
305304
name=expected_volume_name,
306305
uuid="volume-uuid-123",
307-
size="1TB",
306+
size=1024,
308307
state="online",
309308
svm_name=expected_svm_name,
310309
)

0 commit comments

Comments
 (0)