VMware {code} Community
FighterNo1
Contributor
Contributor
Jump to solution

Modify guestOS IP/Gateway/DNS after cloning

:smileysilly: ,I'm using Vsphere Web Services SDK now. I clone a new vm using CloneVM_Task(). My boss requires me to enable to modify the cloned vm's ip/gateway/dns after cloning operation. What should I do? I go through the ReconfigVM_Task() api ,but I can't find a way to do my work..

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

Take a look at this blog post first: http://www.doublecloud.org/2010/04/virtual-machine-ip-address-and-mac-address-frequently-confused-co...

You'll want to use CloneVM_Task() to clone + customize your VM. If you take a look at the configuration clone spec, there is a section that defines the customization for the guest IF the OS is supported within vCenter for guest customization.

Take some time and go over the requirements for customizing a guest, it may take a few trys. VMware has created a simple vmclone.pl script which uses the vSphere SDK for Perl - http://www.vmware.com/support/developer/viperltoolkit/viperl40/doc/vsperl_util_index.html and you can take a look at the source code to figure out what you need to set. I'm sure there are equivalent PowerCLI and VI Java examples as well, but basically you can either customize during the cloning process or you call CustomizeVM_Task() but not ReconfigureVM since that applies to just the VM shell changes.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
1 Reply
lamw
Community Manager
Community Manager
Jump to solution

Take a look at this blog post first: http://www.doublecloud.org/2010/04/virtual-machine-ip-address-and-mac-address-frequently-confused-co...

You'll want to use CloneVM_Task() to clone + customize your VM. If you take a look at the configuration clone spec, there is a section that defines the customization for the guest IF the OS is supported within vCenter for guest customization.

Take some time and go over the requirements for customizing a guest, it may take a few trys. VMware has created a simple vmclone.pl script which uses the vSphere SDK for Perl - http://www.vmware.com/support/developer/viperltoolkit/viperl40/doc/vsperl_util_index.html and you can take a look at the source code to figure out what you need to set. I'm sure there are equivalent PowerCLI and VI Java examples as well, but basically you can either customize during the cloning process or you call CustomizeVM_Task() but not ReconfigureVM since that applies to just the VM shell changes.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos