Remember power state when starting vm reconfigure
This commit fixes #1391 Signed-off-by: Vyronas Tsingaras <vtsingaras@it.auth.gr>
This commit is contained in:
parent
4692df1e3c
commit
5b34f3d8bc
1 changed files with 2 additions and 1 deletions
|
@ -571,6 +571,7 @@ def reconfigure_vm(vsphere_client, vm, module, esxi, resource_pool, cluster_name
|
|||
changes = {}
|
||||
request = VI.ReconfigVM_TaskRequestMsg()
|
||||
shutdown = False
|
||||
poweron = vm.is_powered_on()
|
||||
|
||||
memoryHotAddEnabled = bool(vm.properties.config.memoryHotAddEnabled)
|
||||
cpuHotAddEnabled = bool(vm.properties.config.cpuHotAddEnabled)
|
||||
|
@ -661,7 +662,7 @@ def reconfigure_vm(vsphere_client, vm, module, esxi, resource_pool, cluster_name
|
|||
module.fail_json(
|
||||
msg="Error reconfiguring vm: %s" % task.get_error_message())
|
||||
|
||||
if vm.is_powered_off():
|
||||
if vm.is_powered_off() and poweron:
|
||||
try:
|
||||
vm.power_on(sync_run=True)
|
||||
except Exception, e:
|
||||
|
|
Loading…
Reference in a new issue