Skip to content

Fix Azure snapshot create payload for azure-mgmt-compute 38+#1188

Open
jihokim-tibero wants to merge 1 commit into
EnterpriseDB:masterfrom
jihokim-tibero:fix/azure-snapshot-strict-deserializer
Open

Fix Azure snapshot create payload for azure-mgmt-compute 38+#1188
jihokim-tibero wants to merge 1 commit into
EnterpriseDB:masterfrom
jihokim-tibero:fix/azure-snapshot-strict-deserializer

Conversation

@jihokim-tibero

@jihokim-tibero jihokim-tibero commented May 20, 2026

Copy link
Copy Markdown

Summary

Fixes #1186barman-cloud-backup --cloud-provider azure-blob-storage --snapshot-instance ... fails immediately on a fresh install because azure-mgmt-compute>=38.0.0 ships a stricter request deserializer that rejects the flat dict barman passes to snapshots.begin_create_or_update:

ERROR: Backup failed uploading data ((InvalidRequestContent) The request content was invalid
and could not be deserialized: 'Could not find member 'incremental' on object of type
'ResourceDefinition'. Path 'incremental', line 1, position 45.'.)

Snapshot._attribute_map puts incremental and creation_data under properties.* on the wire, so the flat dict is neither a Snapshot model instance nor wire-format JSON. Older azure-mgmt-compute releases accepted it leniently; 38.0.0 does not.

Change

Build the request payload with the Snapshot/CreationData model objects from azure.mgmt.compute.models instead of a flat dict. Model objects are unambiguous regardless of the SDK's deserializer mode and work on both old and new azure-mgmt-compute releases.

The model classes are resolved via the existing import_azure_mgmt_compute() helper to preserve the deferred-import pattern this module already uses.

Test plan

  • pytest tests/test_cloud_snapshot_interface.py — 172 passed (locally, Python 3.11)
  • pytest tests/test_cloud_snapshot_interface.py::TestAzureCloudSnapshotInterface — 29 passed
  • Manual verification against Azure with azure-mgmt-compute==38.0.0 — installing this branch alongside azure-mgmt-compute==38.0.0 and re-running the original barman-cloud-backup command produces a successful snapshot.

Related

  • Issue: barman-cloud-backup Azure snapshot fails with strict deserializer in azure-mgmt-compute 38+ #1186
  • Reporter has also flagged that setup.py's azure-snapshots extra has no upper bound on azure-mgmt-compute, so a fresh pip install auto-picks the broken version. With this fix applied that pin is no longer strictly required, but a documented lower bound (or short-term upper bound until this lands in a release) may still be worth considering — happy to open a follow-up if you'd like.

cc @didorgas @martinmarques

azure-mgmt-compute 38.0.0 ships a stricter request deserializer that rejects
the flat dict barman previously passed to `snapshots.begin_create_or_update`:

  ERROR: Backup failed uploading data ((InvalidRequestContent) The request
  content was invalid and could not be deserialized: 'Could not find member
  'incremental' on object of type 'ResourceDefinition'.
  Path 'incremental', line 1, position 45.'.)

`Snapshot._attribute_map` puts `incremental` and `creation_data` under
`properties.*` on the wire, so the flat dict is neither a Snapshot instance
nor wire-format JSON. Build the payload with the `Snapshot`/`CreationData`
model objects instead — that works on both the lenient and strict
deserializer tracks.

Closes EnterpriseDB#1186.
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 this pull request may close these issues.

barman-cloud-backup Azure snapshot fails with strict deserializer in azure-mgmt-compute 38+

1 participant