diff --git a/src/command_modules/azure-cli-vm/HISTORY.rst b/src/command_modules/azure-cli-vm/HISTORY.rst index dc01fd1b3b4..56ca10fdb94 100644 --- a/src/command_modules/azure-cli-vm/HISTORY.rst +++ b/src/command_modules/azure-cli-vm/HISTORY.rst @@ -5,12 +5,16 @@ unreleased ---------- * diagnostics: Fix incorrect Linux diagnostics default config with update for LAD v.3.0 extension * disk: support cross subscription blob import +* disk: add --no-wait flag to disk create, update, and delete. +* disk: add `az disk wait` command. +* BC: disk: add confirmation prompt to `az disk delete`. * vm: support license type on create * BC: vm open-port: command always returns the NSG. Previously it returned the NIC or Subnet. * vm: fix "vm extension list" crash if the VM has no extensions * vmss: update arg description for 'vmss delete-instances --instance-ids' * vmss: hide arg 'vmss show --ids', which is not supposed to work because of 'instance-id' arg + 2.0.6 (2017-05-09) ++++++++++++++++++ * Minor fixes. diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_help.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_help.py index a38f1fe9e26..fee845874d5 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_help.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_help.py @@ -964,6 +964,12 @@ short-summary: Update a managed disk. """ +helps['disk wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the managed disk is met. +""" + + helps['disk grant-access'] = """ type: command short-summary: Grant read access to a managed disk. diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py index ff5913c3b08..24b237cec63 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/commands.py @@ -247,16 +247,18 @@ def transform_av_set_collection_output(av_sets): # VM Disk op_var = 'disks_operations' op_class = 'DisksOperations' - cli_command(__name__, 'disk create', custom_path.format('create_managed_disk')) + cli_command(__name__, 'disk create', custom_path.format('create_managed_disk'), no_wait_param='no_wait') cli_command(__name__, 'disk list', custom_path.format('list_managed_disks')) cli_command(__name__, 'disk show', mgmt_path.format(op_var, op_class, 'get'), cf_disks, exception_handler=empty_on_404) - cli_command(__name__, 'disk delete', mgmt_path.format(op_var, op_class, 'delete'), cf_disks) + cli_command(__name__, 'disk delete', mgmt_path.format(op_var, op_class, 'delete'), cf_disks, no_wait_param='raw', confirmation=True) cli_command(__name__, 'disk grant-access', custom_path.format('grant_disk_access')) cli_command(__name__, 'disk revoke-access', mgmt_path.format(op_var, op_class, 'revoke_access'), cf_disks) cli_generic_update_command(__name__, 'disk update', 'azure.mgmt.compute.compute.operations.{}#{}.get'.format(op_var, op_class), 'azure.mgmt.compute.compute.operations.{}#{}.create_or_update'.format(op_var, op_class), custom_function_op=custom_path.format('update_managed_disk'), - setter_arg_name='disk', factory=cf_disks) + setter_arg_name='disk', factory=cf_disks, no_wait_param='raw') + cli_generic_wait_command(__name__, 'disk wait', 'azure.mgmt.compute.compute.operations.{}#{}.get'.format(op_var, op_class), cf_disks) + op_var = 'snapshots_operations' op_class = 'SnapshotsOperations' cli_command(__name__, 'snapshot create', custom_path.format('create_snapshot')) diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py index e3712f68d3e..6e3c912346b 100644 --- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py +++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py @@ -298,7 +298,7 @@ def create_managed_disk(resource_group_name, disk_name, location=None, source=None, # pylint: disable=unused-argument # below are generated internally from 'source' source_blob_uri=None, source_disk=None, source_snapshot=None, - source_storage_account_id=None): + source_storage_account_id=None, no_wait=False): from azure.mgmt.compute.models import Disk, CreationData, DiskCreateOption, ImageDiskReference location = location or get_resource_group_location(resource_group_name) if source_blob_uri: @@ -319,7 +319,7 @@ def create_managed_disk(resource_group_name, disk_name, location=None, disk = Disk(location, disk_size_gb=size_gb, creation_data=creation_data, account_type=sku) client = _compute_client_factory() - return client.disks.create_or_update(resource_group_name, disk_name, disk) + return client.disks.create_or_update(resource_group_name, disk_name, disk, raw=no_wait) def update_managed_disk(instance, size_gb=None, sku=None):