Skip to content

Commit

Permalink
rename "HHD" to "HDD" attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Poddubny authored and Anthony Poddubny committed Apr 13, 2021
1 parent bf6b760 commit e6c80f8
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions cloudshell/cp/vcenter/commands/command_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions cloudshell/cp/vcenter/commands/reconfigure_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def reconfigure(
vm_uuid,
cpu,
ram,
hhd,
hdd,
):
"""
Expand All @@ -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
)
22 changes: 11 additions & 11 deletions cloudshell/cp/vcenter/common/vcenter/vmomi_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def __init__(
customization_spec="",
cpu="",
ram="",
hhd="",
hdd="",
):
"""
Constructor of CloneVmParameters
Expand All @@ -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
Expand All @@ -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:
"""
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def __init__(self):
self.customization_spec = ""
self.cpu = ""
self.ram = ""
self.hhd = ""
self.hdd = ""
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def __init__(self):
self.customization_spec = ""
self.cpu = ""
self.ram = ""
self.hhd = ""
self.hdd = ""
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def __init__(self):
self.behavior_during_save = ""
self.cpu = ""
self.ram = ""
self.hhd = ""
self.hdd = ""
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def __init__(self):
self.customization_spec = ""
self.cpu = ""
self.ram = ""
self.hhd = ""
self.hdd = ""
8 changes: 4 additions & 4 deletions cloudshell/cp/vcenter/vm/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_commands/test_command_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def setUp(self):
"Behavior during save": "Powered Off",
"CPU": "",
"RAM": "",
"HHD": "",
"HDD": "",
}

self.resource = create_autospec(ResourceInfo)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vm/test_deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_vm_deployer_image(self):
"auto_delete": "True",
"cpu": "",
"ram": "",
"hhd": "",
"hdd": "",
},
}
)
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
3.0.0

0 comments on commit e6c80f8

Please sign in to comment.