oxidecomputer / omicron

Omicron: Oxide control plane
Mozilla Public License 2.0
245 stars 38 forks source link

Deleted disks/snapshot show up as available images #4667

Closed labbott closed 9 months ago

labbott commented 9 months ago

3475ce54-251b-4f18-bacd-51dc17a671f9 and 1d83a6c1-d64c-4eff-8933-5c3e5a60cb70 should be deleted but they are showing up as images

[labbott@labbott-the-desktop oxide.rs]$ oxide image list --project laura-testing
Image {
    block_size: ByteCount(
        512,
    ),
    description: "Rust deps",
    digest: None,
    id: 3475ce54-251b-4f18-bacd-51dc17a671f9,
    name: Name(
        "hubris-installed",
    ),
    os: "",
    project_id: Some(
        dfd91414-1d12-4a9b-b84c-9cb04d0c5d3b,
    ),
    size: ByteCount(
        214748364800,
    ),
    time_created: 2023-10-24T14:39:03.075098Z,
    time_modified: 2023-10-24T14:39:03.075098Z,
    url: None,
    version: "",
}
Image {
    block_size: ByteCount(
        512,
    ),
    description: "oh this",
    digest: None,
    id: 866093dd-f9b0-4996-849d-974ab09146d6,
    name: Name(
        "permission-slip-server-4d7j9gby9vz04pjm1d4azsadsdchh5wi",
    ),
    os: "NixOS",
    project_id: Some(
        dfd91414-1d12-4a9b-b84c-9cb04d0c5d3b,
    ),
    size: ByteCount(
        1073741824,
    ),
    time_created: 2023-12-11T14:40:14.248477Z,
    time_modified: 2023-12-11T14:40:14.248477Z,
    url: None,
    version: "0.0.0",
}
Image {
    block_size: ByteCount(
        512,
    ),
    description: "oh this",
    digest: None,
    id: 1d83a6c1-d64c-4eff-8933-5c3e5a60cb70,
    name: Name(
        "permission-slip-server-5c8vqp138gh1jdyp6fqilj40kr6xbf1j",
    ),
    os: "NixOS",
    project_id: Some(
        dfd91414-1d12-4a9b-b84c-9cb04d0c5d3b,
    ),
    size: ByteCount(
        1073741824,
    ),
    time_created: 2023-12-07T19:44:12.540176Z,
    time_modified: 2023-12-07T19:44:12.540176Z,
    url: None,
    version: "0.0.0",
}
[labbott@labbott-the-desktop oxide.rs]$ oxide disk list --project laura-testing
Disk {
    block_size: ByteCount(
        512,
    ),
    description: "Disk of hubris-build-gimlet-c-dev",
    device_path: "/mnt/hubris-disk-gimlet-c-dev",
    id: dca68c14-ced2-498c-99cc-8313155d0099,
    image_id: Some(
        3475ce54-251b-4f18-bacd-51dc17a671f9,
    ),
    name: Name(
        "hubris-disk-gimlet-c-dev",
    ),
    project_id: dfd91414-1d12-4a9b-b84c-9cb04d0c5d3b,
    size: ByteCount(
        214748364800,
    ),
    snapshot_id: None,
    state: Faulted,
    time_created: 2023-11-09T20:50:48.174339Z,
    time_modified: 2023-11-09T20:50:48.174339Z,
}
Disk {
    block_size: ByteCount(
        512,
    ),
    description: "Disk of hubris-build-gimlet-d-lab",
    device_path: "/mnt/hubris-disk-gimlet-d-lab",
    id: 576bab88-dfae-4437-adce-1de12b5d76f1,
    image_id: Some(
        3475ce54-251b-4f18-bacd-51dc17a671f9,
    ),
    name: Name(
        "hubris-disk-gimlet-d-lab",
    ),
    project_id: dfd91414-1d12-4a9b-b84c-9cb04d0c5d3b,
    size: ByteCount(
        214748364800,
    ),
    snapshot_id: None,
    state: Faulted,
    time_created: 2023-11-09T14:48:44.198460Z,
    time_modified: 2023-11-09T14:48:44.198460Z,
}
Disk {
    block_size: ByteCount(
        512,
    ),
    description: "Disk of hubris-build-oxide-rot-1",
    device_path: "/mnt/hubris-disk-oxide-rot-1",
    id: 3e43251e-f7f4-4a6b-8c37-54a5fbbb1fd9,
    image_id: Some(
        3475ce54-251b-4f18-bacd-51dc17a671f9,
    ),
    name: Name(
        "hubris-disk-oxide-rot-1",
    ),
    project_id: dfd91414-1d12-4a9b-b84c-9cb04d0c5d3b,
    size: ByteCount(
        214748364800,
    ),
    snapshot_id: None,
    state: Faulted,
    time_created: 2023-11-10T18:49:47.981235Z,
    time_modified: 2023-11-10T18:49:47.981235Z,
}
Disk {
    block_size: ByteCount(
        512,
    ),
    description: "asdfasdfd",
    device_path: "/mnt/this-disk",
    id: 2a4503f5-58f8-47e4-979a-4904afe9b6c0,
    image_id: None,
    name: Name(
        "this-disk",
    ),
    project_id: dfd91414-1d12-4a9b-b84c-9cb04d0c5d3b,
    size: ByteCount(
        1073741824,
    ),
    snapshot_id: None,
    state: Detached,
    time_created: 2023-12-11T14:38:56.750002Z,
    time_modified: 2023-12-11T14:38:56.750002Z,
}
[labbott@labbott-the-desktop oxide.rs]$ oxide snapshot list --project laura-testing
Snapshot {
    description: "snapshot of finalized disk 2a4503f5-58f8-47e4-979a-4904afe9b6c0",
    disk_id: 2a4503f5-58f8-47e4-979a-4904afe9b6c0,
    id: 367d47f3-464c-4b14-851c-efc725858c12,
    name: Name(
        "permission-slip-server-4d7j9gby9vz04pjm1d4azsadsdchh5wi-snap",
    ),
    project_id: dfd91414-1d12-4a9b-b84c-9cb04d0c5d3b,
    size: ByteCount(
        1073741824,
    ),
    state: Ready,
    time_created: 2023-12-11T14:40:12.903480Z,
    time_modified: 2023-12-11T14:40:12.903480Z,
}
[labbott@labbott-the-desktop oxide.rs]$ oxide instance list --project laura-testing

I can also create an image out of one of the deleted images. This may just be a side effect of how deletion works but it's pretty confusing for me as an end user.

labbott commented 9 months ago

I'm looking at this again and can't remember what I thought was wrong here...

david-crespo commented 9 months ago

That's a relief because I was pretty confused.

jmpesp commented 9 months ago

My understanding of this is (taking one of the disks as an example), please correct me if I'm wrong!

Now, hopefully I have this right, because you said:

I can also create an image out of one of the deleted images.

which would definitely be a bug. If there was a delete request for that image, but that image was eithere not deleted, or un-deleted, then that's another type of bug that I should definitely follow up on.

The fact that you see disks that you previously deleted now show up as Faulted is expected after omicron#4547, though I agree with your chat comment that this could have been better communicated to the user and is confusing. I'm not sure about the best was to communicate this though - maybe appending to the description?

-description: "Disk of hubris-build-gimlet-c-dev"
+description: "Disk of hubris-build-gimlet-c-dev (:ghost:)"

Deleting the disk should not delete the image, nor the contents of the image, as long as the image is still around. Likewise, deleting an image should not delete a disk or the contents of a disk that has that image as a source. Nexus should be accurately reference counting for the underlying Crucible resources and not deleting any of those unless the ref counts have gone to zero. If that's not true, then we have another type of bug on our hands.

labbott commented 9 months ago

Yeah I'm pretty sure this is a user error where I forgot that I deleted snapshots, disks, but not images and wasn't reading correctly.