Description
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
- Enable compute gallery
- Deploy a bosh director with
bosh create-env
- Upload the same stemcell that was used to deploy the director
Potential Solutions
- Pass a hint to the Azure CPI in the create-env case to avoid gallery image creation.
- Pass a hint to the Azure CPI in the create-env case to create a separate gallery image definition.
- Add a check in the Azure CPI to validate if the Gallery image version exists and skip gallery image version creation when it exists.