XenServer: When VM is in powered on state, plug newly added disks

Fixes: #60693
pull/60991/head
Bojan Vitnik 5 years ago committed by Abhijeet Kasurde
parent 2bbbc5fafc
commit 04e0f9d4ea

@ -0,0 +1,2 @@
bugfixes:
- xenserver_guest - when adding disks to a VM in powered on state, disks are now properly plugged/activated (https://github.com/ansible/ansible/issues/60693).

@ -708,7 +708,11 @@ class XenServerVM(XenServerObject):
}
new_disk_vbd['VDI'] = self.xapi_session.xenapi.VDI.create(new_disk_vdi)
self.xapi_session.xenapi.VBD.create(new_disk_vbd)
vbd_ref_new = self.xapi_session.xenapi.VBD.create(new_disk_vbd)
if self.vm_params['power_state'].lower() == "running":
self.xapi_session.xenapi.VBD.plug(vbd_ref_new)
elif change.get('cdrom'):
vm_cdrom_params_list = [cdrom_params for cdrom_params in self.vm_params['VBDs'] if cdrom_params['type'] == "CD"]

Loading…
Cancel
Save