Open PisikeSipelgas opened 1 year ago
I don't think this is really a problem with resizing, I think it's something else. Could you please add scsi_type: lsilogic
to your disk
and try again?
That did the trick!
disk:
- size_gb: "{{ item.size|int }}"
type: "thin"
state: present
scsi_type: lsilogic
scsi_controller: "{{ item.controller|int }}"
unit_number: "{{ item.lun|int }}"
disk_mode: persistent
datastore: "{{ item.disk_datastore }}"
TASK [vm-modify : add or resize hdd] ************************
changed: [localhost] => (item={'mountpoint': '/data', 'controller': 0, 'lun': 1, 'size': 75, 'disk_datastore': '3PAR_comp'})
It looks like the module tries to change the type to paravirtual
when neither scsi_type
nor controller_type
are set:
This is a bit... well, unexpected. I think the module shouldn't try to change the type to paravirtual
when neither scsi_type
nor controller_type
are set. At least not on existing disks, I think it's OK for new ones.
I'm not sure yet what I should do about this. But at least you have a workaround now.
That did the trick!
disk: - size_gb: "{{ item.size|int }}" type: "thin" state: present scsi_type: lsilogic scsi_controller: "{{ item.controller|int }}" unit_number: "{{ item.lun|int }}" disk_mode: persistent datastore: "{{ item.disk_datastore }}"
TASK [vm-modify : add or resize hdd] ************************ changed: [localhost] => (item={'mountpoint': '/data', 'controller': 0, 'lun': 1, 'size': 75, 'disk_datastore': '3PAR_comp'})
Interesting I added scsi_type: lsilogic and still get the same issue.
SUMMARY
Disk not resized when vmware vm scsi controller is "lsi logic" and vm is powered on
ISSUE TYPE
COMPONENT NAME
vmware_guest_disk
ANSIBLE VERSION
COLLECTION VERSION
Partial list:
CONFIGURATION
OS / ENVIRONMENT
Rocky 9.1
STEPS TO REPRODUCE
VM is deployed from template where SCSI controller is set to "LSI Logic". Deployment is successful. Vmware tools are pre-installed. VM gets powered ON. Next step is to modify additional disk, which fails (see below). At the same time resizing disk disk directly from VmWare Vsphere Web console resizing works as expected (disk is resized without any problems). Solution is to change SCSI controller to be "VmWare Paravirtual". Without any change in playbooks everything works.
where "disks" are defined in external json file like this:
EXPECTED RESULTS
VM disk attached to "LSI Logic" will be resized regardless vm is powered "on" or "off". It did work with older ansible (centos 7 & ansible 2.9).
ACTUAL RESULTS
Task fails with message: "Parameters for device 'scsi0' may not be modified while the virtual machine is powered on."