Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing issue on changing "disk_mode" #2096 #2271

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions plugins/modules/vmware_guest_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,13 @@ 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)
Expand Down
Loading