From e6c80f8a8954ce859cda5011c564fe262f8791bd Mon Sep 17 00:00:00 2001 From: Anthony Poddubny Date: Tue, 13 Apr 2021 11:19:17 +0300 Subject: [PATCH] rename "HHD" to "HDD" attribute --- .../vcenter/commands/command_orchestrator.py | 6 ++--- .../cp/vcenter/commands/reconfigure_vm.py | 4 ++-- .../vcenter/common/vcenter/vmomi_service.py | 22 +++++++++---------- ...terDeployVMFromLinkedCloneResourceModel.py | 2 +- .../vCenterCloneVMFromVMResourceModel.py | 2 +- .../models/vCenterVMFromImageResourceModel.py | 2 +- .../vCenterVMFromTemplateResourceModel.py | 2 +- cloudshell/cp/vcenter/vm/deploy.py | 8 +++---- .../test_command_orchestrator.py | 2 +- tests/test_vm/test_deployer.py | 2 +- version.txt | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/cloudshell/cp/vcenter/commands/command_orchestrator.py b/cloudshell/cp/vcenter/commands/command_orchestrator.py index 9d277e7..975c591 100644 --- a/cloudshell/cp/vcenter/commands/command_orchestrator.py +++ b/cloudshell/cp/vcenter/commands/command_orchestrator.py @@ -667,13 +667,13 @@ def get_snapshots(self, context): ) return set_command_result(result=res, unpicklable=False) - def reconfigure_vm(self, context, cpu, ram, hhd): + def reconfigure_vm(self, context, cpu, ram, hdd): """Reconfigure CPU/RAM/disks on the VM :param context: :param cpu: :param ram: - :param hhd: + :param hdd: :return: """ resource_details = self._parse_remote_model(context) @@ -683,7 +683,7 @@ def reconfigure_vm(self, context, cpu, ram, hhd): resource_details.vm_uuid, cpu, ram, - hhd, + hdd, ) return set_command_result(result=res, unpicklable=False) diff --git a/cloudshell/cp/vcenter/commands/reconfigure_vm.py b/cloudshell/cp/vcenter/commands/reconfigure_vm.py index cbb1297..3d30ad7 100644 --- a/cloudshell/cp/vcenter/commands/reconfigure_vm.py +++ b/cloudshell/cp/vcenter/commands/reconfigure_vm.py @@ -26,7 +26,7 @@ def reconfigure( vm_uuid, cpu, ram, - hhd, + hdd, ): """ @@ -51,5 +51,5 @@ def reconfigure( ) return self.pyvmomi_service.reconfigure_vm( - vm=vm, cpu=cpu, ram=ram, hhd=hhd, logger=logger + vm=vm, cpu=cpu, ram=ram, hdd=hdd, logger=logger ) diff --git a/cloudshell/cp/vcenter/common/vcenter/vmomi_service.py b/cloudshell/cp/vcenter/common/vcenter/vmomi_service.py index 34f7af2..df042fe 100644 --- a/cloudshell/cp/vcenter/common/vcenter/vmomi_service.py +++ b/cloudshell/cp/vcenter/common/vcenter/vmomi_service.py @@ -498,7 +498,7 @@ def __init__( customization_spec="", cpu="", ram="", - hhd="", + hdd="", ): """ Constructor of CloneVmParameters @@ -514,7 +514,7 @@ def __init__( :param customization_spec: str: the name of the customization specification :param cpu: str: the amount of CPUs :param ram: str: the amount of RAM - :param hhd: str: the amount of disks + :param hdd: str: the amount of disks """ self.si = si @@ -529,7 +529,7 @@ def __init__( self.customization_spec = customization_spec self.cpu = cpu self.ram = ram - self.hhd = hhd + self.hdd = hdd class CloneVmResult: """ @@ -603,7 +603,7 @@ def clone_vm(self, clone_params, logger, cancellation_context): vm=template, cpu=clone_params.cpu, ram=clone_params.ram, - hhd=clone_params.hhd, + hdd=clone_params.hdd, ) clone_spec = self.vim.vm.CloneSpec() @@ -685,17 +685,17 @@ def _get_device_unit_number_generator(self, vm): f"Unable to create a new disk device. {self.MAX_NUMBER_OF_VM_DISKS} disks limit has been exceeded" ) - def reconfigure_vm(self, vm, cpu, ram, hhd, logger): + def reconfigure_vm(self, vm, cpu, ram, hdd, logger): """ :param vm: :param cpu: :param ram: - :param hhd: + :param hdd: :param logger: :return: """ - config_spec = self._prepare_vm_config_spec(vm=vm, cpu=cpu, ram=ram, hhd=hhd) + config_spec = self._prepare_vm_config_spec(vm=vm, cpu=cpu, ram=ram, hdd=hdd) task = vm.ReconfigVM_Task(spec=config_spec) @@ -725,13 +725,13 @@ def _get_device_controller_key(self, vm): return controller_key - def _prepare_vm_config_spec(self, vm, cpu, ram, hhd): + def _prepare_vm_config_spec(self, vm, cpu, ram, hdd): """Prepare VM Config Spec. :param vm: :param cpu: :param ram: - :param hhd: + :param hdd: :return: """ config_spec = vim.vm.ConfigSpec() @@ -744,11 +744,11 @@ def _prepare_vm_config_spec(self, vm, cpu, ram, hhd): if ram: config_spec.memoryMB = int(ram * 1024) - if hhd: + if hdd: disks = {} for disk_data in [ - disk_data for disk_data in hhd.split(";") if ":" in disk_data + disk_data for disk_data in hdd.split(";") if ":" in disk_data ]: disk_name, disk_size = disk_data.split(":") disks[int(re.search(r"\d+", disk_name).group())] = float(disk_size) diff --git a/cloudshell/cp/vcenter/models/VCenterDeployVMFromLinkedCloneResourceModel.py b/cloudshell/cp/vcenter/models/VCenterDeployVMFromLinkedCloneResourceModel.py index ba3766f..bb7d8ca 100644 --- a/cloudshell/cp/vcenter/models/VCenterDeployVMFromLinkedCloneResourceModel.py +++ b/cloudshell/cp/vcenter/models/VCenterDeployVMFromLinkedCloneResourceModel.py @@ -17,4 +17,4 @@ def __init__(self): self.customization_spec = "" self.cpu = "" self.ram = "" - self.hhd = "" + self.hdd = "" diff --git a/cloudshell/cp/vcenter/models/vCenterCloneVMFromVMResourceModel.py b/cloudshell/cp/vcenter/models/vCenterCloneVMFromVMResourceModel.py index 6237bc2..d8a5a35 100644 --- a/cloudshell/cp/vcenter/models/vCenterCloneVMFromVMResourceModel.py +++ b/cloudshell/cp/vcenter/models/vCenterCloneVMFromVMResourceModel.py @@ -16,4 +16,4 @@ def __init__(self): self.customization_spec = "" self.cpu = "" self.ram = "" - self.hhd = "" + self.hdd = "" diff --git a/cloudshell/cp/vcenter/models/vCenterVMFromImageResourceModel.py b/cloudshell/cp/vcenter/models/vCenterVMFromImageResourceModel.py index 324a9bc..ac750b3 100644 --- a/cloudshell/cp/vcenter/models/vCenterVMFromImageResourceModel.py +++ b/cloudshell/cp/vcenter/models/vCenterVMFromImageResourceModel.py @@ -18,4 +18,4 @@ def __init__(self): self.behavior_during_save = "" self.cpu = "" self.ram = "" - self.hhd = "" + self.hdd = "" diff --git a/cloudshell/cp/vcenter/models/vCenterVMFromTemplateResourceModel.py b/cloudshell/cp/vcenter/models/vCenterVMFromTemplateResourceModel.py index f87eb03..ca83a5b 100644 --- a/cloudshell/cp/vcenter/models/vCenterVMFromTemplateResourceModel.py +++ b/cloudshell/cp/vcenter/models/vCenterVMFromTemplateResourceModel.py @@ -16,4 +16,4 @@ def __init__(self): self.customization_spec = "" self.cpu = "" self.ram = "" - self.hhd = "" + self.hdd = "" diff --git a/cloudshell/cp/vcenter/vm/deploy.py b/cloudshell/cp/vcenter/vm/deploy.py index a735ffd..732277b 100644 --- a/cloudshell/cp/vcenter/vm/deploy.py +++ b/cloudshell/cp/vcenter/vm/deploy.py @@ -191,7 +191,7 @@ def _deploy_a_clone( customization_spec=deploy_params.customization_spec, cpu=deploy_params.cpu, ram=deploy_params.ram, - hhd=deploy_params.hhd, + hdd=deploy_params.hdd, ) if cancellation_context.is_cancelled: @@ -271,13 +271,13 @@ def deploy_from_image( self.pv_service.destroy_vm(vm=vm, logger=logger) raise Exception("Action 'Deploy from image' was cancelled.") - if any([image_params.cpu, image_params.ram, image_params.hhd]): + if any([image_params.cpu, image_params.ram, image_params.hdd]): try: self.pv_service.reconfigure_vm( vm=vm, cpu=image_params.cpu, ram=image_params.ram, - hhd=image_params.hhd, + hdd=image_params.hdd, logger=logger, ) except Exception as e: @@ -367,7 +367,7 @@ def _get_deploy_image_params(data_holder, host_info, vm_name): image_params.vcenter_name = data_holder.vcenter_name image_params.cpu = data_holder.cpu image_params.ram = data_holder.ram - image_params.hhd = data_holder.hhd + image_params.hdd = data_holder.hdd return image_params diff --git a/tests/test_commands/test_command_orchestrator.py b/tests/test_commands/test_command_orchestrator.py index 24dbf78..c92bc60 100644 --- a/tests/test_commands/test_command_orchestrator.py +++ b/tests/test_commands/test_command_orchestrator.py @@ -61,7 +61,7 @@ def setUp(self): "Behavior during save": "Powered Off", "CPU": "", "RAM": "", - "HHD": "", + "HDD": "", } self.resource = create_autospec(ResourceInfo) diff --git a/tests/test_vm/test_deployer.py b/tests/test_vm/test_deployer.py index 270d880..7105a92 100644 --- a/tests/test_vm/test_deployer.py +++ b/tests/test_vm/test_deployer.py @@ -195,7 +195,7 @@ def test_vm_deployer_image(self): "auto_delete": "True", "cpu": "", "ram": "", - "hhd": "", + "hdd": "", }, } ) diff --git a/version.txt b/version.txt index 276cbf9..4a36342 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.3.0 +3.0.0