Showing posts with label Virtual Machine. Show all posts
Showing posts with label Virtual Machine. Show all posts

Saturday, April 12, 2008

Virtual Center 2.0.1 refresh issue

Today one of college who also happen to work on VMWare side was trying to define the path for snapshot file to a different location other than VM’s home directory. He was following the instruction on our internal wiki which instructed him to shut down the VM’s and then edit the VMX file. Once the file was edited then he was instructed by wiki to unregister the VM’s and then reregister it. He did exactly and then he lost control over the VM. He lost the option of unregistering from the VC. When we had look from VC we have option to shut the VM and also restarting the VM .When we tried that option we got a message “This VM is already shut down”. So we thought lets try it from console and we got some soap error . Tried unregistering VM and we got the message “there is no such VM”. We then thought lets try to stop VM forcibly using “vmware-cmd stop force “ and that did not help. So we restarted all the “vpx” and “hostd” agent on the host and this did not help as well. I told college of mine let me sit at my cubi and check some other option (as if there were some knowledge GOD around). Humm yeah sometime it really work once I sit on my chair (hehehe). When I looked through my VC I have all the option (Was there Knowledge GOD around ?). I unregistered the VM from the VC and was able to reregister it without any error message. I went back to his desk and told him see it is working. He was like Vikash what magic you did ? I told nothing my Knowledge GOD helped me J . It was just a refresh issue with VC. We have oversubscribed the VC(current version 2.1 support 100 host). If my college would have logged of and logged back in it should have work. More of process on our internal wiki has to fixed to when you are trying to make changes in VMX file make sure you unregister the VM first and then make changes. Once the changes is completed then reregister it back.

Tuesday, March 25, 2008

How to rename Virtual Server

NOTE: If you are renaming any Virtual Machine make sure that there is NO snapshots associated with the server.


A. Change name in Windows OS:
Logon to the Virtual Server
Open system properties and then select "Computer Name"
Hit change and then supply new name of the server.
It will ask for reboot, but cancel this and shut down the machine.

METHOD1 :

B. Change name on VMware Host:

Unregister the virtual server in Virtual Center: right-click on server name, select Remove.
Using an SSH client, connect to the VMware Host Service Console where the VM resides.
Rename the Virtual Server's Home Directory any drives associated with the Virtual Server

cd /vmfs/volume/"LUN of Virtual Server"
sudo mv "oldservername" "newservername"
cd "newservername>"
Now rename all the file as shown in the pic. To rename the file use the following command

sudo mv "old file name" "newfile name"



After the rename the file should look like




PS: Here we are renaming server from NTDBPH2057M00 to NTAPPH2057M00

4. Update the descriptor file for each disk . In the above example the file would be ntapph2057m00_1.vmdk and ntapph2057m00.vmdk. Use VI or SCP to edit the file .You will find following entry RW 25165824 VMFS "ntdbph2057m00-flat.vmdk" and this need to be changed to RW 25165824 VMFS "ntapph2057m00-flat.vmdk"

5. Update the .vmxf file . In above example we have to update ntapph2057m00.vmxf. There will be something like ntdbph2057m00.vmx. Update the server name here

6. Update the file .vmx . In the above example we have to change following lines
nvram = "ntbph2057m00.nvram"
displayName = "ntdbph2057m00"
extendedConfigFile = "ntdbph2057m00.vmxf"

and remove following lines from the VMX file
migrate.hostlog = "./ntdbph2057m00-63889e62.hlog"
sched.swap.derivedName = "/vmfs/volumes/47963ca5-78df4610-1696-01a4bbe0612/ntdbph2057m00/ntdbph2057m00-63889e62.vswp"

7. Register the vmx file with the host and for example
sudo vmware-cmd -s register /vmfs/volumes/vmsan-p21-416/ntapph2057m00/ntapph2057m00.vmx.
8. VM with the new name should be avilable under Virtual Center. Edit the setting for the VM’s and point it to the correct Hard Disk. Make sure you remove the Hard Disk and then re—add them back.

9. Power On the machine and it will ask to confirm if you have to create a new identifier. Create a new one. VM will power on if every thing has been setup correctly

METHOD2 :

  1. Shut down the virtual machine.
  2. Rename the virtual machine inside the VC by right click and select rename.
  3. Once you are done with rename migrate this virtual machine to a different lun.
  4. As this machine move to different lun it rename all the required files which has been described in above steps.