azure snapshot using `begin_create_or_update` function gives DeserializationError
similar to #19188
Describe the bug
azure snapshot creation using begin_create_or_update function on a VM disk gives the below error.
Unable to build a model: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get', DeserializationError: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'
To Reproduce
get_scratch_disk = compute_client.disks.get(resource_group_name, template_vm)
snapshot_parameters = {
'location': self._virtual_cluster.getLocations().getMainRegion(),
'description': f'Snapshot of Instance template for Virtual Cluster {self._virtual_cluster.getName()}',
'creation_data': {
'createOption': 'Copy',
'source_resource_id': get_scratch_disk.id
},
'tags': tags
}
operation_snapshot=self._compute_client.snapshots.begin_create_or_update(resource_group_name,template_name,snapshot_parameters)
Expected behavior
function results metadata about the created snapshot
Environment summary Environment summary CentOS 8 az-cli 2.27.1 python 3.6.8 pip 20.0.1
Additional context Aim is to create a clone of VM and generalize it to create a generalized image of the VM without rendering the original VM unusable.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @avirishuv, @vaibhav-agar, @amjads1.
Issue Details
similar to #19188
Describe the bug
azure snapshot creation using begin_create_or_update function on a VM disk gives the below error.
Unable to build a model: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get', DeserializationError: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'
To Reproduce
get_scratch_disk = compute_client.disks.get(resource_group_name, template_vm)
snapshot_parameters = {
'location': self._virtual_cluster.getLocations().getMainRegion(),
'description': f'Snapshot of Instance template for Virtual Cluster {self._virtual_cluster.getName()}',
'creation_data': {
'createOption': 'Copy',
'source_resource_id': get_scratch_disk.id
},
'tags': tags
}
operation_snapshot=self._compute_client.snapshots.begin_create_or_update(resource_group_name,template_name,snapshot_parameters)
Expected behavior
function results metadata about the created snapshot
Environment summary Environment summary CentOS 8 az-cli 2.27.1 python 3.6.8 pip 20.0.1
Additional context Aim is to create a clone of VM and generalize it to create a generalized image of the VM without rendering the original VM unusable.
| Author: | ar-schrodinger |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
route to service team
@ar-schrodinger Could you send me specific commands, parameters and the debug logs printed during execution by email?
You can add parameter --debug at the end of the original command, then send me the printed information.
My email address is [email protected], thanks~
@Vaibhav-Agar Could you please look into the issue?
Apologies for the delay in providing the traceback. I am running this all remotely through a shell script so was having problem with debug mode. The debug logs will following shortly.
Traceback :
Error message was: Unable to build a model: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get', DeserializationError: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'
File "/usr/local/lib/python3.6/site-packages/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py", line 149, in begin_create_or_update
**kwargs
File "/usr/local/lib/python3.6/site-packages/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py", line 86, in _create_or_update_initial
body_content = self._serialize.body(snapshot, 'Snapshot')
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 623, in body
SerializationError, "Unable to build a model: "+str(err), err)
File "/usr/local/lib/python3.6/site-packages/msrest/exceptions.py", line 51, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 620, in body
data = deserializer._deserialize(data_type, data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1442, in _deserialize
value = self.deserialize_data(raw_value, attr_desc['type'])
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1631, in deserialize_data
return self._deserialize(obj_type, data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1446, in _deserialize
raise_with_traceback(DeserializationError, msg, err)
File "/usr/local/lib/python3.6/site-packages/msrest/exceptions.py", line 51, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1428, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1193, in rest_key_case_insensitive_extractor
return attribute_key_case_insensitive_extractor(key, None, working_data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1222, in attribute_key_case_insensitive_extractor
return data.get(found_key)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1428, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1193, in rest_key_case_insensitive_extractor
return attribute_key_case_insensitive_extractor(key, None, working_data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1222, in attribute_key_case_insensitive_extractor
return data.get(found_key)
AttributeError: 'str' object has no attribute 'get'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 620, in body
data = deserializer._deserialize(data_type, data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1442, in _deserialize
value = self.deserialize_data(raw_value, attr_desc['type'])
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1631, in deserialize_data
return self._deserialize(obj_type, data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1446, in _deserialize
raise_with_traceback(DeserializationError, msg, err)
File "/usr/local/lib/python3.6/site-packages/msrest/exceptions.py", line 51, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1428, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1193, in rest_key_case_insensitive_extractor
return attribute_key_case_insensitive_extractor(key, None, working_data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1222, in attribute_key_case_insensitive_extractor
return data.get(found_key)
msrest.exceptions.DeserializationError: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/sbin/vc-instance-manager", line 2209, in createTemplate
snapshot_parameters)
File "/usr/local/lib/python3.6/site-packages/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py", line 149, in begin_create_or_update
**kwargs
File "/usr/local/lib/python3.6/site-packages/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py", line 86, in _create_or_update_initial
body_content = self._serialize.body(snapshot, 'Snapshot')
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 623, in body
SerializationError, "Unable to build a model: "+str(err), err)
File "/usr/local/lib/python3.6/site-packages/msrest/exceptions.py", line 51, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 620, in body
data = deserializer._deserialize(data_type, data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1442, in _deserialize
value = self.deserialize_data(raw_value, attr_desc['type'])
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1631, in deserialize_data
return self._deserialize(obj_type, data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1446, in _deserialize
raise_with_traceback(DeserializationError, msg, err)
File "/usr/local/lib/python3.6/site-packages/msrest/exceptions.py", line 51, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1428, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1193, in rest_key_case_insensitive_extractor
return attribute_key_case_insensitive_extractor(key, None, working_data)
File "/usr/local/lib/python3.6/site-packages/msrest/serialization.py", line 1222, in attribute_key_case_insensitive_extractor
return data.get(found_key)
msrest.exceptions.SerializationError: Unable to build a model: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get', DeserializationError: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'
Let me know if you require more information from me.
@Vaibhav-Agar any update on this? As #19188 seems to be completed.
Any update on this would be appreciated. If more information from me is needed, please let me know.
snapshot_parameters = { 'location': self._virtual_cluster.getLocations().getMainRegion(), 'description': f'Snapshot of Instance template for Virtual Cluster {self._virtual_cluster.getName()}', 'creation_data': { 'createOption': 'Copy', 'source_resource_id': get_scratch_disk.id }, 'tags': tags }
@ar-schrodinger Actually, the createOption should be create_option, could you please fix this typo and then have a try?
Ahh!! okay. Thanks for the info, will let you know.
Closing issue, please reopen if issue not resolved.