azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

azure snapshot using `begin_create_or_update` function gives DeserializationError

Open ar-schrodinger opened this issue 5 years ago • 11 comments

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.

ar-schrodinger avatar Aug 20 '21 10:08 ar-schrodinger

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:

Compute, Service Attention, customer-reported, Track2

Milestone: -

ghost avatar Aug 20 '21 10:08 ghost

route to service team

yonzhan avatar Aug 20 '21 10:08 yonzhan

@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~

zhoxing-ms avatar Aug 20 '21 10:08 zhoxing-ms

@Vaibhav-Agar Could you please look into the issue?

amjads1 avatar Aug 24 '21 18:08 amjads1

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.

ar-schrodinger avatar Aug 25 '21 10:08 ar-schrodinger

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.

ar-schrodinger avatar Aug 25 '21 12:08 ar-schrodinger

@Vaibhav-Agar any update on this? As #19188 seems to be completed.

ar-schrodinger avatar Sep 02 '21 07:09 ar-schrodinger

Any update on this would be appreciated. If more information from me is needed, please let me know.

ar-schrodinger avatar Sep 15 '21 08:09 ar-schrodinger

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?

zhoxing-ms avatar Sep 15 '21 09:09 zhoxing-ms

Ahh!! okay. Thanks for the info, will let you know.

ar-schrodinger avatar Sep 15 '21 09:09 ar-schrodinger

Closing issue, please reopen if issue not resolved.

oriwolman avatar Sep 29 '21 15:09 oriwolman