Skip to content

Compute Gallery Image Version Conflicts when bootstrapping #720

Open
@s4heid

Description

@s4heid

Versions

CPI Version: v52.1.0

Stemcell

Version: any
Distro:

  • Ubuntu
  • CentOS

Environment

  • Azure Environment:
    • Azure

Issue Details

With compute gallery enabled, uploading a stemcell to a BOSH Director fails with a conflict error when the same stemcell was used to deploy the director using bosh create-env.

The reason is that bosh create-env operates without a BOSH Director database, directly using the Azure CPI, while bosh upload-stemcell queries the Director's database for registered stemcells and only uploads if necessary. Since the stemcell used to deploy the director is never stored in the BOSH Director database, a new blob is uploaded to the storage account using bosh upload-stemcell.

This is not an issue when compute gallery is disabled, as the stemcell name is unique due to a uuid suffix used to store the stemcell in the storage account. However, when compute gallery is enabled, the Azure CPI attempts to create a new gallery image version using the version of the stemcell, rather than the name. This is by design, because gallery image versions must be in the format {major}.{minor}.{patch}. However, they also must be unique leading to a Conflict in this edge case.

Logs

Error message: {
  "error": {
    "code": "PropertyChangeNotAllowed",
    "message": "Changing property 'galleryImageVersion.properties.storageProfile.osDiskImage.source.uri' is not allowed.",
    "target": "galleryImageVersion.properties.storageProfile.osDiskImage.source.uri"
  }
}' in 'create_stemcell' CPI method (CPI request ID: 'cpi-856580')
Task 8 | 08:22:42 | Error: Unknown CPI error 'Bosh::AzureCloud::AzureConflictError' with message 'http_put - http code: 409

Repro steps

  1. Enable compute gallery
  2. Deploy a bosh director with bosh create-env
  3. Upload the same stemcell that was used to deploy the director

Potential Solutions

  1. Pass a hint to the Azure CPI in the create-env case to avoid gallery image creation.
  2. Pass a hint to the Azure CPI in the create-env case to create a separate gallery image definition.
  3. Add a check in the Azure CPI to validate if the Gallery image version exists and skip gallery image version creation when it exists.

@a-hassanin @fmoehler

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Pending Merge | Prioritized

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions