From 8a2c48338df5a0aeec252b4718fdd1ac6595e066 Mon Sep 17 00:00:00 2001 From: Alessandro Arrichiello Date: Wed, 11 Dec 2024 11:21:21 +0100 Subject: [PATCH 1/2] Fixing issue on changing "disk_mode" #2096 --- plugins/modules/vmware_guest_disk.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/modules/vmware_guest_disk.py b/plugins/modules/vmware_guest_disk.py index 960fe8917..ab277ad0a 100644 --- a/plugins/modules/vmware_guest_disk.py +++ b/plugins/modules/vmware_guest_disk.py @@ -745,6 +745,14 @@ def ensure_disks(self, vm_obj=None): disk_spec = self.get_ioandshares_diskconfig(disk_spec, disk) disk_spec.device.capacityInKB = disk['size'] disk_change = True + + # If disk is not vpmem we check if there is a change in disk mode + if disk['disk_type'] != 'vpmemdisk' and disk['disk_mode'] != disk_spec.device.backing.diskMode: + # set the operation to edit so that it knows to keep other settings + disk_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.edit + disk_spec = self.get_ioandshares_diskconfig(disk_spec, disk) + disk_spec.device.backing.diskMode = disk['disk_mode'] + disk_change = True if disk_change: self.config_spec.deviceChange.append(disk_spec) From 68d70e8ad2677520184744b6cf154a84cf875a79 Mon Sep 17 00:00:00 2001 From: Alessandro Arrichiello Date: Sat, 21 Dec 2024 18:42:08 +0100 Subject: [PATCH 2/2] Fixing the lint issue on vmware_guest_disk.py --- plugins/modules/vmware_guest_disk.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/modules/vmware_guest_disk.py b/plugins/modules/vmware_guest_disk.py index ab277ad0a..bf10860cb 100644 --- a/plugins/modules/vmware_guest_disk.py +++ b/plugins/modules/vmware_guest_disk.py @@ -745,7 +745,6 @@ def ensure_disks(self, vm_obj=None): disk_spec = self.get_ioandshares_diskconfig(disk_spec, disk) disk_spec.device.capacityInKB = disk['size'] disk_change = True - # If disk is not vpmem we check if there is a change in disk mode if disk['disk_type'] != 'vpmemdisk' and disk['disk_mode'] != disk_spec.device.backing.diskMode: # set the operation to edit so that it knows to keep other settings