0

I have been using the code located at https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/clone_vm.py to clone VMs for over a year. My inputs were based upon the following simplistic vCenter configuration:

vcenter
    A-Datacenter
      A-Cluster
            A-ResourcePool[1-9]
      A-Datastore[1-9]
      AA-Folder
      AB-Folder
      A-Template

Hence, my input values for clone_vm.py were:

./clone_vm.py -s host -o port -u user -p passwd -nossl \
-v MyVM \
--template A-Template \
--datacenter-name A-Datacenter \
--vm-folder AA-Folder \
--datastore-name A-Datastore4 \
--cluster-name A-Cluster \
--resource-pool  A-ResourcePool2 \
--power-on 

Everything worked fine up until the another datacenter was created in vcenter which contained multiple clusters and reassigned hosts from A-ResourcePool.

vcenter 
    A-Datacenter
      A-Cluster
            A-ResourcePool[1-7]
      A-Datastore[1-9]
      AA-Folder
      AB-Folder
      A-Template
    
    B-Datacenter
      B-Cluster
            B-ResourcePool[8]
      B-Datastore[1-9]
      BA-Folder
      B-Template

      C-Cluster
            C-ResourcePool[9]
      C-Datastore[1-9]
      CA-Folder

Now, when entering the above values, one of two errors appear "spec.pool" or "spec.location.pool".

cloning VM...
there was an error
(vmodl.fault.InvalidArgument) {
   dynamicType = <unset>,
   dynamicProperty = (vmodl.DynamicProperty) [],
   msg = 'A specified parameter was not correct: spec.location.pool',
   faultCause = <unset>,
   faultMessage = (vmodl.LocalizableMessage) [],
   invalidProperty = 'spec.location.pool'
}

VMs can be successfully created manually by using templates in the respective Datacenter, but obviously the script is better. Datastore[1-9] appears to be available to both Datacenters.
What value is not specific enough to A-Datacenter and/or A-Cluster to cause the spec.pool error?

user2569618
  • 517
  • 3
  • 16
  • 42
  • If you can rule out insufficient permissions or network issues and the cluster and ressource pool names are correct, you could try a more specific `--resource-pool` argument by providing the full path to the resource pool: `--resource-pool "A-Datacenter/A-Cluster/A-ResourcePool2"` – nadine May 19 '23 at 15:51

0 Answers0