VMware Cloud Community
t-readyroc
Contributor
Contributor

ovftool to move template fails: ConfigSpec.files.vmPathName invalid

We use a promotion script with all of our Packer templates. This script uses ovftool (v4.4.1) to move the template from one folder to another. The command in the script is:

 

ovftool \
    --targetSSLThumbprint="$TARGET_THUMBPRINT" \
    --sourceSSLThumbprint="$SOURCE_THUMBPRINT" \
    --machineOutput             \
    --overwrite                 \
    --diskMode=thin             \
    --name="${TARGET_NAME}"     \
    --importAsTemplate          \
    --datastore="${DATASTORE}"  \
    --vmFolder="${DEST_FOLDER}" \
    "vi://$PBUILDER_USER:$PBUILDER_PASS@$LAB00_VCSA/lab00-dc/vm/packer-templates/${SOURCE_VM}" \
    "vi://$PBUILDER_USER:$PBUILDER_PASS@$LAB00_VCSA/lab00-dc/host/lab01/$LAB00_HOST/"

 

The command that generates the error is for the templates, "windows-10-a117011d," and "windows-2019-a117011d." The output generated is:

 

+ <Errors>
+ <Error>
+ <Type>
+ vmodl.fault.InvalidArgument
+ </Type>
+ <LocalizedMsg>
+ A specified parameter was not correct: ConfigSpec.files.vmPathName
+ </LocalizedMsg>
+ <Arg type="vmodl.PropertyPath" fieldName="invalidProperty">
+ ConfigSpec.files.vmPathName
+ </Arg>
+ </Error>
+ </Errors>

 

Indeed, running ovftool in verbose mode shows that this property is not being correctly populated; only the datastore portion is populated:

 

configSpec = (vim.vm.ConfigSpec) {
      changeVersion = <unset>, 
      name = "windows-10", 
      version = "vmx-14", 
      createDate = <unset>, 
      uuid = <unset>, 
      instanceUuid = <unset>, 
      npivNodeWorldWideName = <unset>, 
      npivPortWorldWideName = <unset>, 
      npivWorldWideNameType = <unset>, 
      npivDesiredNodeWwns = <unset>, 
      npivDesiredPortWwns = <unset>, 
      npivTemporaryDisabled = <unset>, 
      npivOnNonRdmDisks = <unset>, 
      npivWorldWideNameOp = <unset>, 
      locationId = <unset>, 
      guestId = "windows9_64Guest", 
      alternateGuestName = <unset>, 
      annotation = <unset>, 
      files = (vim.vm.FileInfo) {
         vmPathName = "[lab00-raid10-local]",

 

 However, if I run govc against the exact same templates, I see that this value is, in fact, correctly specified:

 

#> govc vm.info -json windows-10-a117011d | jq '.VirtualMachines[0].Config.Files.VmPathName'

"[lab00-raid10-local] windows-10-a117011d/windows-10-a117011d.vmtx"

#> govc vm.info -json windows-2019-a117011d | jq '.VirtualMachines[0].Config.Files.VmPathName'
"[lab00-raid10-local] windows-2019-a117011d/windows-2019-a117011d.vmtx"

 

We're not experiencing this issue with any other templates (we run a nightly build that uses the same promotion script). I'm not sure why I'm having an issue with these 2 templates.

0 Kudos
0 Replies