oxidecomputer / omicron

Omicron: Oxide control plane

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

omdb could use a command to find previous propolis instance IDs

leftwo opened this issue · comments

When debugging, I found myself looking for logs from an instance that had been stopped
then started again, which changes the propolis_id.

To get older instance IDs, you can (I've been told) use the database:

select * from vmm where instance_id = $instanceId order by time_created

We sould make an omdb command that does something similar.

We have an instance:

root@oxz_switch0:~# omdb db instances 2> /dev/null| egrep "NAME|3d681dd7"
ID                                   NAME   STATE    PROPOLIS_ID                          SLED_ID                              HOST_SERIAL 
d07b0fcc-17d0-479c-9688-1bc5731f0d6a p2     running  3d681dd7-7f06-4001-975f-646eb6c6bfbf 5f6720b8-8a31-45f8-8c94-8e699218f28b BRM42220017 

The database has this:

root@[fd00:1122:3344:105::3]:32221/omicron> select * from vmm where instance_id = 'd07b0fcc-17d0-479c-9688-1bc5731f0d6a';
                   id                  |         time_created          |         time_deleted          |             instance_id              |   state   |      time_state_updated       | state_generation |               sled_id                |        propolis_ip        | propolis_port
---------------------------------------+-------------------------------+-------------------------------+--------------------------------------+-----------+-------------------------------+------------------+--------------------------------------+---------------------------+----------------
  1bf7e251-3e84-46b8-94bc-ff2b1f9eb811 | 2024-04-08 20:43:40.005221+00 | 2024-04-08 20:58:06.852985+00 | d07b0fcc-17d0-479c-9688-1bc5731f0d6a | destroyed | 2024-04-08 20:58:05.41333+00  |                8 | f15774c1-b8e5-434f-a493-ec43f96cba06 | fd00:1122:3344:105::1:27b |         12400
  1c1f8cc4-b185-4d2b-98c8-01cc6d5f0c96 | 2024-03-27 23:32:02.594476+00 | 2024-03-29 23:44:44.288525+00 | d07b0fcc-17d0-479c-9688-1bc5731f0d6a | destroyed | 2024-03-29 23:44:23.514168+00 |                8 | 5f6720b8-8a31-45f8-8c94-8e699218f28b | fd00:1122:3344:109::1:124 |         12400
  3d681dd7-7f06-4001-975f-646eb6c6bfbf | 2024-04-08 20:58:24.382643+00 | NULL                          | d07b0fcc-17d0-479c-9688-1bc5731f0d6a | running   | 2024-04-08 20:58:35.740662+00 |                3 | 5f6720b8-8a31-45f8-8c94-8e699218f28b | fd00:1122:3344:109::1:1f3 |         12400
  4a969f82-abd5-44ed-8697-2e04ac6d8268 | 2024-03-17 05:58:47.650036+00 | 2024-03-20 03:54:22.384174+00 | d07b0fcc-17d0-479c-9688-1bc5731f0d6a | destroyed | 2024-03-20 03:54:20.00463+00  |                8 | a2adea92-b56e-44fc-8a0d-7d63b5fd3b93 | fd00:1122:3344:102::1:9f  |         12400
  6b435da7-f63e-47a5-88e7-4bda43a771fd | 2024-03-25 19:38:23.061857+00 | 2024-03-27 17:07:04.497004+00 | d07b0fcc-17d0-479c-9688-1bc5731f0d6a | destroyed | 2024-03-27 17:07:02.384734+00 |               10 | 71def415-55ad-46b4-ba88-3ca55d7fb287 | fd00:1122:3344:10b::1:12c |         12400
  73d81b9a-16a2-4224-9513-d3a3cc8932d1 | 2024-03-22 15:50:46.200278+00 | 2024-03-23 04:30:55.648397+00 | d07b0fcc-17d0-479c-9688-1bc5731f0d6a | destroyed | 2024-03-23 04:30:53.889599+00 |                7 | f15774c1-b8e5-434f-a493-ec43f96cba06 | fd00:1122:3344:105::1:156 |         12400
  8271215a-ba60-42d4-a1dd-9480b3369b3a | 2024-03-20 20:55:01.985518+00 | 2024-03-22 04:12:36.918859+00 | d07b0fcc-17d0-479c-9688-1bc5731f0d6a | destroyed | 2024-03-22 04:12:35.673908+00 |                7 | dd83e75a-1edf-4aa1-89a0-cd8b2091a7cd | fd00:1122:3344:10a::1:b9  |         12400
  886e1386-bbdb-42dc-b01e-096cd3197e9c | 2024-03-14 20:48:04.530595+00 | 2024-03-16 23:20:07.949965+00 | d07b0fcc-17d0-479c-9688-1bc5731f0d6a | destroyed | 2024-03-16 23:20:05.834991+00 |                8 | f15774c1-b8e5-434f-a493-ec43f96cba06 | fd00:1122:3344:105::1:13a |         12400
  e0c545f0-849c-456d-aa60-bd95e9207cea | 2024-03-30 17:18:23.167118+00 | 2024-04-02 07:03:28.783895+00 | d07b0fcc-17d0-479c-9688-1bc5731f0d6a | destroyed | 2024-04-02 07:02:44.597918+00 |                8 | b886b58a-1e3f-4be1-b9f2-0c2e66c6bc88 | fd00:1122:3344:106::1:16e |         12400
(9 rows)

So, maybe we want to print in order from newest (NULL) to oldest of time deleted with.
id (which is propolis id and is/was the zone name), sled_id or seld serial number, created, deleted,