Fix premium IO disk bug (#840)
This commit is contained in:
Родитель
0bf92a4e9a
Коммит
dd01335fac
|
@ -4572,6 +4572,7 @@
|
|||
<Compile Include="src\virtual-wan\setup.py" />
|
||||
<Compile Include="src\vm-repair\azext_vm_repair\commands.py" />
|
||||
<Compile Include="src\vm-repair\azext_vm_repair\custom.py" />
|
||||
<Compile Include="src\vm-repair\azext_vm_repair\exceptions.py" />
|
||||
<Compile Include="src\vm-repair\azext_vm_repair\repair_utils.py">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -1828,8 +1828,8 @@
|
|||
],
|
||||
"vm-repair": [
|
||||
{
|
||||
"downloadUrl": "https://azurecomputeaidrepair.blob.core.windows.net/prod/vm_repair-0.1.1-py2.py3-none-any.whl",
|
||||
"filename": "vm_repair-0.1.1-py2.py3-none-any.whl",
|
||||
"downloadUrl": "https://azurecomputeaidrepair.blob.core.windows.net/prod/vm_repair-0.1.2-py2.py3-none-any.whl",
|
||||
"filename": "vm_repair-0.1.2-py2.py3-none-any.whl",
|
||||
"metadata": {
|
||||
"classifiers": [
|
||||
"Development Status :: 4 - Beta",
|
||||
|
@ -1866,9 +1866,9 @@
|
|||
"metadata_version": "2.0",
|
||||
"name": "vm-repair",
|
||||
"summary": "Auto repair commands to fix VMs.",
|
||||
"version": "0.1.1"
|
||||
"version": "0.1.2"
|
||||
},
|
||||
"sha256Digest": "22f956b98b4c9cad015317eab624384101e1ef5cacc23c63c205d0f5c0961b67"
|
||||
"sha256Digest": "ab4cef3b70ef3c6ef97ef665024c5cb2c164f971fd9773bdedb2e4070e2008a1"
|
||||
}
|
||||
],
|
||||
"webapp": [
|
||||
|
|
|
@ -74,8 +74,9 @@ def create(cmd, vm_name, resource_group_name, repair_password=None, repair_usern
|
|||
if is_managed:
|
||||
logger.info('Source VM uses managed disks. Creating repair VM with managed disks.\n')
|
||||
# Copy OS disk command
|
||||
copy_disk_command = 'az disk create -g {g} -n {n} --source {s} --location {loc} --query id -o tsv' \
|
||||
.format(g=resource_group_name, n=copy_disk_name, s=target_disk_name, loc=source_vm.location)
|
||||
disk_sku = source_vm.storage_profile.os_disk.managed_disk.storage_account_type
|
||||
copy_disk_command = 'az disk create -g {g} -n {n} --source {s} --sku {sku} --location {loc} --query id -o tsv' \
|
||||
.format(g=resource_group_name, n=copy_disk_name, s=target_disk_name, sku=disk_sku, loc=source_vm.location)
|
||||
# Validate create vm create command to validate parameters before runnning copy disk command
|
||||
validate_create_vm_command = create_repair_vm_command + ' --validate'
|
||||
|
||||
|
@ -184,7 +185,7 @@ def create(cmd, vm_name, resource_group_name, repair_password=None, repair_usern
|
|||
return_dict['resourceTag'] = resource_tag
|
||||
return_dict['createdResources'] = created_resources
|
||||
|
||||
logger.info('\n' + return_dict['message'] + '\n')
|
||||
logger.info('\n%s\n', return_dict['message'])
|
||||
return return_dict
|
||||
|
||||
|
||||
|
@ -261,5 +262,5 @@ def restore(cmd, vm_name, resource_group_name, disk_name=None, repair_vm_id=None
|
|||
'you may choose to delete the source OS disk \'{src_disk}\' within resource group \'{rg}\' manually if you no longer need it, to avoid any undesired costs.' \
|
||||
.format(disk=disk_name, n=vm_name, src_disk=source_disk, rg=resource_group_name)
|
||||
|
||||
logger.info('\n' + return_dict['message'] + '\n')
|
||||
logger.info('\n%s\n', return_dict['message'])
|
||||
return return_dict
|
||||
|
|
|
@ -6,19 +6,15 @@
|
|||
|
||||
class AzCommandError(Exception):
|
||||
"""Raised when az command called and returns error"""
|
||||
pass
|
||||
|
||||
|
||||
class SkuNotAvailableError(Exception):
|
||||
"""Raised when unable to find compatible SKU for repair VM"""
|
||||
pass
|
||||
|
||||
|
||||
class UnmanagedDiskCopyError(Exception):
|
||||
"""Raised when error occured during unmanaged disk copy"""
|
||||
pass
|
||||
|
||||
|
||||
class WindowsOsNotAvailableError(Exception):
|
||||
"""Raised the Windows image not available from gallery."""
|
||||
pass
|
||||
|
|
|
@ -31,6 +31,10 @@ def _call_az_command(command_string, run_async=False, secure_params=None):
|
|||
"""
|
||||
|
||||
tokenized_command = shlex.split(command_string)
|
||||
|
||||
# If command does not start with 'az' then raise exception
|
||||
if not tokenized_command or tokenized_command[0] != 'az':
|
||||
raise AzCommandError("The command string is not an 'az' command!")
|
||||
# If run on windows, add 'cmd /c'
|
||||
windows_os_name = 'nt'
|
||||
if os.name == windows_os_name:
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -87,7 +87,7 @@ class LinuxManagedDiskCreateRestoreTest(ScenarioTest):
|
|||
assert len(vms) == 1
|
||||
|
||||
# Test create
|
||||
result = self.cmd('vm repair create -g {rg} -n {vm} --repair-username azureadmin --repair-password !Passw0rd2018').get_output_in_json()
|
||||
result = self.cmd('vm repair create -g {rg} -n {vm} --repair-password !Passw0rd2018').get_output_in_json()
|
||||
|
||||
# Check repair VM
|
||||
repair_vms = self.cmd('vm list -g {}'.format(result['repairResouceGroup'])).get_output_in_json()
|
||||
|
@ -120,7 +120,7 @@ class LinuxUnmanagedDiskCreateRestoreTest(ScenarioTest):
|
|||
assert len(vms) == 1
|
||||
|
||||
# Test create
|
||||
result = self.cmd('vm repair create -g {rg} -n {vm} --repair-password !Passw0rd2018 --repair-username azureadmin').get_output_in_json()
|
||||
result = self.cmd('vm repair create -g {rg} -n {vm} --repair-password !Passw0rd2018').get_output_in_json()
|
||||
|
||||
# Check repair VM
|
||||
repair_vms = self.cmd('vm list -g {}'.format(result['repairResouceGroup'])).get_output_in_json()
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
from codecs import open
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
VERSION = "0.1.1"
|
||||
VERSION = "0.1.2"
|
||||
|
||||
CLASSIFIERS = [
|
||||
'Development Status :: 4 - Beta',
|
||||
|
|
Загрузка…
Ссылка в новой задаче