Importing boot-resources always bring back the full set of resources

Bug #2023339 reported by Simon Déziel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Triaged
Medium
Unassigned

Bug Description

I'd like to bootstrap MAAS as quickly as possible so I want to fetch as few boot-resources as possible. I need Jammy ga-22.04 for amd64 only so here's what I try to get that only:

```
# maas admin boot-source-selections create 1 os=ubuntu release=jammy arches=amd64 subarches="ga-22.04" labels="*"
Success.
Machine-readable output follows:
{
    "os": "ubuntu",
    "release": "jammy",
    "arches": [
        "amd64"
    ],
    "subarches": [
        "ga-22.04"
    ],
    "labels": [
        "*"
    ],
    "boot_source_id": 1,
    "id": 2,
    "resource_uri": "/MAAS/api/2.0/boot-sources/1/selections/2/"
}
# maas admin boot-resources import
```

However, the `import` brings back the full set of images:

```
# maas admin boot-resources read | jq -r '.[] | select(.name | contains("ubuntu/jammy"))'
{
  "id": 17,
  "type": "Synced",
  "name": "ubuntu/jammy",
  "architecture": "amd64/ga-22.04",
  "resource_uri": "/MAAS/api/2.0/boot-resources/17/",
  "subarches": "generic,hwe-p,hwe-q,hwe-r,hwe-s,hwe-t,hwe-u,hwe-v,hwe-w,ga-16.04,ga-16.10,ga-17.04,ga-17.10,ga-18.04,ga-18.10,ga-19.04,ga-19.10,ga-20.04,ga-20.10,ga-21.04,ga-21.10,ga-22.04"
}
{
  "id": 25,
  "type": "Synced",
  "name": "ubuntu/jammy",
  "architecture": "amd64/ga-22.04-lowlatency",
  "resource_uri": "/MAAS/api/2.0/boot-resources/25/",
  "subarches": "generic,hwe-p,hwe-q,hwe-r,hwe-s,hwe-t,hwe-u,hwe-v,hwe-w,ga-16.04,ga-16.10,ga-17.04,ga-17.10,ga-18.04,ga-18.10,ga-19.04,ga-19.10,ga-20.04,ga-20.10,ga-21.04,ga-21.10,ga-22.04"
}
{
  "id": 26,
  "type": "Synced",
  "name": "ubuntu/jammy",
  "architecture": "amd64/hwe-22.04",
  "resource_uri": "/MAAS/api/2.0/boot-resources/26/",
  "subarches": "generic,hwe-p,hwe-q,hwe-r,hwe-s,hwe-t,hwe-u,hwe-v,hwe-w,ga-16.04,ga-16.10,ga-17.04,ga-17.10,ga-18.04,ga-18.10,ga-19.04,ga-19.10,ga-20.04,ga-20.10,ga-21.04,ga-21.10,ga-22.04"
}
{
  "id": 27,
  "type": "Synced",
  "name": "ubuntu/jammy",
  "architecture": "amd64/hwe-22.04-edge",
  "resource_uri": "/MAAS/api/2.0/boot-resources/27/",
  "subarches": "generic,hwe-p,hwe-q,hwe-r,hwe-s,hwe-t,hwe-u,hwe-v,hwe-w,ga-16.04,ga-16.10,ga-17.04,ga-17.10,ga-18.04,hwe-18.10,hwe-19.04,hwe-19.10,hwe-20.04,hwe-22.04"
}
{
  "id": 28,
  "type": "Synced",
  "name": "ubuntu/jammy",
  "architecture": "amd64/hwe-22.04-lowlatency",
  "resource_uri": "/MAAS/api/2.0/boot-resources/28/",
  "subarches": "generic,hwe-p,hwe-q,hwe-r,hwe-s,hwe-t,hwe-u,hwe-v,hwe-w,ga-16.04,ga-16.10,ga-17.04,ga-17.10,ga-18.04,ga-18.10,ga-19.04,ga-19.10,ga-20.04,ga-20.10,ga-21.04,ga-21.10,ga-22.04"
}
{
  "id": 29,
  "type": "Synced",
  "name": "ubuntu/jammy",
  "architecture": "amd64/hwe-22.04-lowlatency-edge",
  "resource_uri": "/MAAS/api/2.0/boot-resources/29/",
  "subarches": "generic,hwe-p,hwe-q,hwe-r,hwe-s,hwe-t,hwe-u,hwe-v,hwe-w,ga-16.04,ga-16.10,ga-17.04,ga-17.10,ga-18.04,hwe-18.10,hwe-19.04,hwe-19.10,hwe-20.04,hwe-22.04"
}
```

# Additional information

```
# snap list maas maas-test-db
Name Version Rev Tracking Publisher Notes
maas 3.3.3-13184-g.3e9972c19 27405 3.3/stable canonical✓ -
maas-test-db 14.2-29-g.ed8d7f2 131 3.3/stable canonical✓ -
```

Tags: lxd-cloud
Simon Déziel (sdeziel)
summary: - Importing boot-resources always bring back the full set
+ Importing boot-resources always bring back the full set of resources
Changed in maas:
status: New → Triaged
Revision history for this message
Jack Lloyd-Walters (lloydwaltersj) wrote (last edit ):

I've followed the same set-up step, output is as expected.
```
$ maas admin boot-source-selections create 1 os=ubuntu release=jammy arches=amd64 subarches="ga-22.04" labels="*"
Success.
Machine-readable output follows:
{
    "os": "ubuntu",
    "release": "jammy",
    "arches": [
        "amd64"
    ],
    "subarches": [
        "ga-22.04"
    ],
    "labels": [
        "*"
    ],
    "boot_source_id": 1,
    "id": 2,
    "resource_uri": "/MAAS/api/2.0/boot-sources/1/selections/2/"
}
```

However, reading back the boot-sources, I've noticed the subarches field now contains a wildcard. My hunch is the import process has introduced that into the selection.

```
maas admin boot-source-selections read 1
Success.
Machine-readable output follows:
[ ...
    {
        "os": "ubuntu",
        "release": "jammy",
        "arches": [
            "amd64"
        ],
        "subarches": [
            "*"
        ],
        "labels": [
            "*"
        ],
        "boot_source_id": 1,
        "id": 2,
        "resource_uri": "/MAAS/api/2.0/boot-sources/1/selections/2/"
    }
]
```

@sdeziel can you verify your MAAS instance exhibits the same behaviour?

Changed in maas:
importance: Undecided → Medium
milestone: none → 3.4.x
Revision history for this message
Simon Déziel (sdeziel) wrote (last edit ):

@lloydwaltersj, yes I can confirm the same behaviour here.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.