VMware Cloud Community
vpnprasad
Contributor
Contributor

Changing the configuration after moving the VM from one Esxserver to other

Hi,

I am looking for help to change the configuration after moving the VM from one Esx to other. I am also not clear what all I need to change.

If I dont change the config and try to power on, Vcenter is showing msg asking whether we have moved or copied. We can proceed selecting 'Moved' and I believe Vcenter is changing the config. I want to achieve the same thing using VI sdk. Great if someone can give me some pointers or point me to any code for reference.

Thanks,

Prasad

0 Kudos
4 Replies
ramkrishna1
Enthusiast
Enthusiast

Hi  vpnprasad,

Welcome to the communities.

If you need exact copy of source system then please select copy option and then change IP & host name .

If you are moving completely then select move option and change IP if require and as per sub net that network using.

"concentrate the mind on the present moment."
0 Kudos
prashanthbgoud
Enthusiast
Enthusiast

How did you move the files?? Copy paste the config files of the VM??? if that is the case,

Each virtual machine is automatically assigned a UUID and associated PID also will be created while creation.

when copy or move the file to other ESX manually then it need to be registerd in the ESX. Cold or Hot migration helps you in soft movement instead of copied files manually.

If you find this information useful, please award points for "correct" or "helpful" Best Regards, Prashanth
0 Kudos
vpnprasad
Contributor
Contributor

Thanks for the replies...the files are replicated through mirroring across FC LUNs. Here is the usecase. There are two sites...VMs will be up on Esx1 at site1...when user initiates failover, we need to bring the VMs down on Esx1, and bring them up on a diff Esx2. Now when I register the VMs to Esx2, and try to power on, VC is showing the msg "Copied/Moved". I want to suppress this programmitically in our client code.

I manually edited the vmx file and put an entry "uuid.action = create" which resulted in creating new uuid and suppressed this msg. I am just wondering if there is any API to do this...or I should do this only by opening the file and updating the content.

Also as this is move of VM from one Esx to other, what all config changes we need to take care.

Thanks,

Prasad

0 Kudos
vpnprasad
Contributor
Contributor

I have set the config.locationId to blank which made the locationId to get it generated during the poweron. This suppressed the Moved/Copied msg.

Code snippet:

VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();               
vmConfigSpec.locationId = ""; //Setting this to empty so that it gets regenerated.
ManagedObjectReference taskMoRef = m_vimService.ReconfigVM_Task(vmMoRef, vmConfigSpec);
Thanks,
Prasad
               
0 Kudos