Closed sonbar95 closed 2 years ago
It is true that the script does not fail if it didn't find the cluster inputted.
# if None, get the first one
cluster = pchelper.search_for_obj(content, [vim.ClusterComputeResource], cluster_name)
if not cluster:
clusters = pchelper.get_all_obj(content, [vim.ResourcePool])
cluster = list(clusters)[0]
search_for_obj function will return None if it didn't find the object. So if the cluster name is not the name of the cluster, then it will be None, which goes into the if condition, which picks any resource pool in vCenter.
--cluster-name input should be the name of the cluster, not a host.
This script does not provide any options for picking a specific host.
The "linked_clone.py" of pyvmomi was used to confirm that VM can be replicated to the desired host. However, vm-folder and resource-pool can not be specified separately. Therefore, should we develop a new code by mixing the code of clone_vm.py with the linked_clone.py code and make a test?
Describe the bug
I want to select the host server by using pyvmomi clone_vm.py's options "--cluster-name".... but my vSphere copy the VM on the random host....
EX) clone_vm.py ~~bla bla bla --cluster-name=10.10.0.203 ~~bla bla bla ===> Result : Copied VM on the randomize Host (ex. 10.10.0.201, 10.10.0.202 etc...)
Reproduction steps
Expected behavior
clone_vm.py ~~bla bla bla --cluster-name=10.10.0.203 ~~bla bla bla ===> Result : Copied VM on the selected Host (10.10.0.203)
Additional context
No response