Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

blob copy failed when requires sync #16337

Open JasonYuchen opened 3 years ago

JasonYuchen commented 3 years ago

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug az storage blob copy start with --requires-sync failed on block blob with CannotVerifyCopySource error. the copy is successful if remove the --requires-sync

To Reproduce az storage blob copy start ....... --requires-sync

Expected behavior The copy operatiion returns on completion without any error.

Environment summary

Install Method: interactive script

CLI version: azure-cli 2.16.0 core 2.16.0 telemetry 1.0.6 Python location '/usr/bin/python3' Extensions directory '/home/jiancheng/.azure/cliextensions' Python (Linux) 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] Your CLI is up-to-date.

OS version: CentOS 7 Shell Type: bash

Additional context

yonzhan commented 3 years ago

storage

Juliehzl commented 3 years ago

dupe of https://github.com/Azure/azure-cli/issues/13478.

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

Issue Details
> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62 **Describe the bug** az storage blob copy start with --requires-sync failed on block blob with CannotVerifyCopySource error. the copy is successful if remove the --requires-sync **To Reproduce** az storage blob copy start ....... --requires-sync **Expected behavior** The copy operatiion returns on completion without any error. **Environment summary** Install Method: interactive script CLI version: azure-cli 2.16.0 core 2.16.0 telemetry 1.0.6 Python location '/usr/bin/python3' Extensions directory '/home/jiancheng/.azure/cliextensions' Python (Linux) 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] Your CLI is up-to-date. OS version: CentOS 7 Shell Type: bash **Additional context**
Author: JasonYuchen
Assignees: Juliehzl
Labels: `Service Attention`, `Storage`
Milestone: S182
Juliehzl commented 3 years ago

I could reproduce the issue with even track2 SDK. Here is my trace:

azure.cli.core.util.handle_exception is called with an exception:
Traceback (most recent call last):
  File "e:\microsoft\azurecli\azure-cli-extensions\src\storage-blob-preview\azext_storage_blob_preview\vendored_sdks\azure_storage_blob\v2020_02_10\_blob_client.py", line 1761, in start_copy_from_url
    return self._client.blob.start_copy_from_url(**options)
  File "e:\microsoft\azurecli\azure-cli-extensions\src\storage-blob-preview\azext_storage_blob_preview\vendored_sdks\azure_storage_blob\v2020_02_10\_generated\operations\_blob_operations.py", line 2245, in start_copy_from_url
    raise models.StorageErrorException(response, self._deserialize)
azext_storage_blob_preview.vendored_sdks.azure_storage_blob.v2020_02_10._generated.models._models_py3.StorageErrorException: Operation returned an invalid status 'The specified resource does not exist.'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Microsoft\AzureCLI\azure-cli-extensions\env\lib\site-packages\knack\cli.py", line 215, in invoke
    cmd_result = self.invocation.execute(args)
  File "e:\microsoft\azurecli\azure-cli\src\azure-cli-core\azure\cli\core\commands\__init__.py", line 654, in execute
    raise ex
  File "e:\microsoft\azurecli\azure-cli\src\azure-cli-core\azure\cli\core\commands\__init__.py", line 719, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "e:\microsoft\azurecli\azure-cli\src\azure-cli-core\azure\cli\core\commands\__init__.py", line 711, in _run_job
    return cmd_copy.exception_handler(ex)
  File "e:\microsoft\azurecli\azure-cli-extensions\src\storage-blob-preview\azext_storage_blob_preview\__init__.py", line 265, in new_handler
    raise ex
  File "e:\microsoft\azurecli\azure-cli\src\azure-cli-core\azure\cli\core\commands\__init__.py", line 688, in _run_job
    result = cmd_copy(params)
  File "e:\microsoft\azurecli\azure-cli\src\azure-cli-core\azure\cli\core\commands\__init__.py", line 325, in __call__
    return self.handler(*args, **kwargs)
  File "e:\microsoft\azurecli\azure-cli\src\azure-cli-core\azure\cli\core\__init__.py", line 784, in default_command_handler
    return op(**command_args)
  File "e:\microsoft\azurecli\azure-cli-extensions\src\storage-blob-preview\azext_storage_blob_preview\operations\blob.py", line 441, in copy_blob
    return client.start_copy_from_url(source_url=source_url, metadata=metadata, incremental_copy=False, **kwargs)
  File "E:\Microsoft\AzureCLI\azure-cli-extensions\env\lib\site-packages\azure\core\tracing\decorator.py", line 83, in wrapper_use_tracer
    return func(*args, **kwargs)
  File "e:\microsoft\azurecli\azure-cli-extensions\src\storage-blob-preview\azext_storage_blob_preview\vendored_sdks\azure_storage_blob\v2020_02_10\_blob_client.py", line 1763, in start_copy_from_url
    process_storage_error(error)
  File "e:\microsoft\azurecli\azure-cli-extensions\src\storage-blob-preview\azext_storage_blob_preview\vendored_sdks\azure_storage_blob\v2020_02_10\_shared\response_handlers.py", line 147, in process_storage_error
    raise error
azure.core.exceptions.ResourceNotFoundError: The specified resource does not exist.
RequestId:d255b339-201e-0015-7634-d89cde000000
Time:2020-12-22T07:35:15.6610028Z
ErrorCode:CannotVerifyCopySource
Error:None

It doesn't work for my BlockBlob and PageBlob.

Juliehzl commented 3 years ago

@xiafu-msft could you help take a look? could we transfer the issue to sdk repo? it doesn't work for both track1 and track2 SDK.

xiafu-msft commented 3 years ago

hi @Juliehzl and @JasonYuchen

It seems for sync copy, you need to provide the sas token along with source url, can you try to use an url in this format your_account_url?your_sas_token and this if it helps?

JasonYuchen commented 3 years ago

Sorry, our project uses account name and key to access the blob resources. It would be better the "--requires-sync true" could work as expectation.

BTW, I tried --source-uri with sas token, which also failed with "The specified resource does not exist"