vmware_guest: Don't force onto specific host (#22777)
Unless we provided a specific esxi_hostname, don't force new VMs onto the first host in the cluster.
This commit is contained in:
parent
a07d42e16d
commit
58c1a9dd94
1 changed files with 5 additions and 2 deletions
|
@ -1090,6 +1090,8 @@ class PyVmomiHelper(object):
|
||||||
if self.should_deploy_from_template():
|
if self.should_deploy_from_template():
|
||||||
# create the relocation spec
|
# create the relocation spec
|
||||||
relospec = vim.vm.RelocateSpec()
|
relospec = vim.vm.RelocateSpec()
|
||||||
|
# Only provide specific host when using ESXi host directly
|
||||||
|
if self.params['esxi_hostname']:
|
||||||
relospec.host = hostsystem
|
relospec.host = hostsystem
|
||||||
relospec.datastore = datastore
|
relospec.datastore = datastore
|
||||||
relospec.pool = resource_pool
|
relospec.pool = resource_pool
|
||||||
|
@ -1113,7 +1115,8 @@ class PyVmomiHelper(object):
|
||||||
self.change_detected = True
|
self.change_detected = True
|
||||||
self.wait_for_task(task)
|
self.wait_for_task(task)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.module.fail_json(msg="TypeError was returned, please ensure to give correct inputs.")
|
e = get_exception()
|
||||||
|
self.module.fail_json(msg="TypeError was returned, please ensure to give correct inputs. %s" % e)
|
||||||
|
|
||||||
if task.info.state == 'error':
|
if task.info.state == 'error':
|
||||||
# https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2021361
|
# https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2021361
|
||||||
|
|
Loading…
Reference in a new issue