Open danilo-patrucco-sev1tech opened 1 year ago
I think the --esx-ip parameter is a bit of a misnomer. Based on the fault line:
File "create_vm.py", line 31, in create_vm
destination_host = pchelper.get_obj(content, [vim.HostSystem], host_ip)
it is trying to find a host that has the name with the esx-ip. If your hosts are added with the host name, or qualified domain name (e.g. esx1, or esx1.example.com), then you should use that name as the argument.
The sample could have been better/cooler if it leveraged another method:
si.content.searchIndex.FindByIp(dc, hostIp, False)
but alas, it did not and should have been clearer of what the parameter is expecting.
It definitely does not use IP address, as @prziborowski said, it takes the fqdn, I used localhost.localdomain in my case.
Describe the bug
This is the command I'm sending to run the create_vm.py function
python3 create_vm.py -s vcenter.address.something -u my_svc_account -p 'my-svc-account-pass' -v test --datacenter-name 'dc-01' --datastore-name 'ds-11' --esx-ip {ip of vcenter}
and this is the error I'm getting in output :
The esxi-ip I found using nslookup on the vcenter address. I believe this may be the problem, but from what I can see the esxi ip is not mandatory information, and when I keep it out it returns the same error but there is nothing between "managed object" and "not found".
Reproduction steps
python3 create_vm.py -s vcenter.address.something -u my_svc_account -p 'my-svc-account-pass' -v test --datacenter-name 'dc-01' --datastore-name 'ds-11' --esx-ip {ip of vcenter}
, to find the esx-ip nslookup the URL for center or leave it emptyExpected behavior
Create a VM but it fail to start it because a value is wrong or empty
Additional context
No response