Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve resources data for create instance from copy operation #13999

Closed
mas-who opened this issue Aug 28, 2024 · 2 comments · Fixed by #14139
Closed

Improve resources data for create instance from copy operation #13999

mas-who opened this issue Aug 28, 2024 · 2 comments · Fixed by #14139
Assignees
Milestone

Comments

@mas-who
Copy link

mas-who commented Aug 28, 2024

Issue description

Currently when making a request to POST /1.0/instances and setting source.type=copy and source.source to the source instance snapshot within the payload, the resulting InstanceCreate operation will allocate the snapshot to resources.instances and resources.containers within the operation response body (see below example).

{
  "running": [
    {
      "id": "388b0be4-b40a-4aa2-9e11-d81e9edb0bdd",
      "class": "task",
      "description": "Creating instance",
      "created_at": "2024-08-27T10:25:22.454012783Z",
      "updated_at": "2024-08-27T10:25:22.454012783Z",
      "status": "Running",
      "status_code": 103,
      "resources": {
        "containers": [
          "/1.0/instances/alpine-2-poopoo-copy",
          "/1.0/instances/alpine-2%2Fpoopoo"
        ],
        "instances": [
          "/1.0/instances/alpine-2-poopoo-copy",
          "/1.0/instances/alpine-2%2Fpoopoo"
        ]
      },
      "metadata": null,
      "may_cancel": false,
      "err": "",
      "location": "none"
    }
  ]
}

I believe this behaviour is caused by this line and introduced in this commit.

IMO this is a bit confusing and the operation can be improved and made more clear if the snapshot is added to the resources.instances_snapshots field instead (similar to how it's done here). We would just need to determine if the source is a snapshot first.

@mas-who mas-who changed the title Improve create instance from copy operation resources content Improve resources data for create instance from copy operation Aug 28, 2024
@tomponline
Copy link
Member

@boltmark care to take a look at this one and see if @mas-who suggestion is viable? Thanks

@tomponline tomponline added this to the lxd-6.2 milestone Aug 28, 2024
@tomponline
Copy link
Member

@boltmark any news on this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants