automationvirtual-machinevmwareesxiovf

Req. Ovftool command to overwrite memory size and CPU count described in ova file during deployment of VM


I have a OVA file(MyOvafile.ova) which contain MemorySize=16GB and CPU count=4. I have deployed the Ovftool on VMware ESXi server.

I am using the following command to deploy the VM:

/vmfs/volumes/DataStore1/vmware-ovftool/ovftool --memorySize:15360 --name=Test_VM -dm=thin -ds=DataStore1 /vmfs/volumes/DataStore1/OVA_V5.1_BSI-8/MyOvafile.ova

Now the problem i am facing:

As i am giving MemorySize of 15360MB but after deployment VM has the same values as defined in ova file (MyOvafile.ova i.e 16GB)

My Question:

How can i change the value of MemorySize and CPU count through ovftool command?


Solution

  • Apparently, this seems a bug in OVFTOOL (and documentation as well). CPU and memory cannot be overridden by OVFTOOL's corresponding parameters. However, there is hack by modifying it in VMX file of VM (and then using reconfigure command).

    1) Get VMXfile Location (ending with .vmx) :

    vim-cmd vmsvc/getallvms Vmid Name File Guest OS Version Annotation

    72     Test_vm [datastore2] VM_name/VM_name.vmx   rhel6_64Guest   vmx-08
    

    2) Modify vmx file (for example, using awk) for changing 'vCPUS=REQ_CPUs' entry.

    3) Reconfigure .vmx file

    vim-cmd vmsvc/reload <VM_ID>
    

    Issue reported in VMware community: https://communities.vmware.com/message/2698710#2698710