VMware

VMware vSphere PowerCLI – Power Off & On Guests

Looking for a method to restart a non-persistent environment in ESXi or vCenter, I was able to use PowerCLI to issue the commands needed. Originally I was looking to automate the recovery of a snapshot when it dawned on me that a non-persistent disk would facilitate the same thing.  However I would need to power off the server and back on again for it to work.

And this is what came from my searching and trial and error

Powering Off

Powering On

Both – Power Off wait then Power On

Next was to use a batch file to run a task to execute the PowerCLI commands. This was done by doing the following set as a scheduled task

 Thanks Hristo for your help

Quest to automate snapshots in ESXi

I am looking for a way to run a instance and have it revert back to its snapshot every 24 hours. I started toying around with the idea to use the vim-cmd features however there doesn’t seem to be a way to set a task for this.

So far here are the steps I used

Looked up the ID of the VM in question by running:

vim-cmd vmsvc/getallvms

View your VM’s snapshot tree by passing its ID to this command (this example uses the VM with ID 50):

vim-cmd vmsvc/get.snapshotinfo 80

And issues the command to revert the snapshot

vim-cmd vmsvc/snapshot.revert VM_ID 0 SNAPSHOT_ID suppressPowerOff

 

The output looks something like this in my testing

This works and now all I need is to somehow automate and schedule this.

Unmount local ISO before making it an OVF Template

So you have made an awesome system in VMware ESXi and exported it an OVF Template. Later to find that something has gone very wrong and the template will not import and gives you the following error

If you have encountered this it means that your Template was originally created with a ISO image still attached to the device .

By this point you may be thinking that the template is broken. Don’t  worry yet, you still have a chance to fix this and move forward.

One method is to use the OFV Tools from VMware to extract and repackage your OVA Template, or you can use the method I have used (more than once) and turn to our two open source friends; 7-Zip and Notepad++

Here are the steps I normal take to tackle this problem 

Step 1 –  is to extract your ova template (after all its only a zip)

You will notice 3 files once extracted

*.vmdk – is your disk containing all your data

*.ovf  – is the configuration (also the file that we will edit)

*.mf  – is a manifest containing a reference to the vmdk and ovf, also holding a SHA1 hash which ESXi will check for validation.  This file needs to be deleted as we are making a change to the ovf and this will surely break that hash.

Example of what the contents of the .mf file looks like:

SHA1(template.ovf)= 908e804f140ffa58083b8bd154dace330b440c78
SHA1(template-disk1.vmdk)= 29c2d44d908d0207005360dabb58967f01a13c2e

Step 2 – open the *.ovf file with Notepad++ and search for vmware.cdrom.iso

You will notice that this is contained in a blog which looks like this:

Example – just in-case you can see the screenshot above

<Item ovf:required=”false”>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:ElementName>CD/DVD drive 1</rasd:ElementName>
<rasd:InstanceID>8</rasd:InstanceID>
<rasd:Parent>4</rasd:Parent>
<rasd:ResourceSubType>vmware.cdrom.iso</rasd:ResourceSubType>
<rasd:ResourceType>15</rasd:ResourceType>
</Item>

Remove those lines and save the *.ovf file

Step 3 – Delete the file with the *.mf extension. If this exists ESXi will attempt to validate and throw an error about the templates integrity being invalid

So once this has been deleted you can deploy your OVF Template

I hope these steps help someone  and I am giving a twitter to twitter shout-out to Jonathan Frappier @jfrappier who followed me and one of his posts titled “ProTip – don’t forget to unmount local ISO from your VM before turning it into a template” inspired me to do this little write up.

Thanks

vCloud Air – I want it

From our friends over at VMware we now have news of vCloud Air. A public cloud platform built on the trusted foundation of vSphere, compatible with your on-premises data center, that includes infrastructure, disaster recovery.

With vCloud Air  you can migrate existing onsite virtual machines (VMs) to the public cloud.  vCloud Air’s billing mode uses the IaaS (infrastructure-as-a-service) model making it very appealing for testers and developers looking for short term environments as well is companies looking to expand into new infrastructure without the need to acquire new hardware.

Best of all, its using the same vCenter, ESXi environments you come to know, trust, support and *love.

Checkout the CPU performance and I/O performance comparisons for more information.

vCloud Air has the  Support and Services You Know to help you extend beyond your data center.

Oh and vCloud Air 35% Cheaper Than Azure and 83% Cheaper Than AWS

For more info http://vcloud.vmware.com/

PPTP VPN Connection issues on ESXi 5.5

Issue: 

I am unable to connect to a VPN server hosted as a guest on VMware ESXi 5.5. After much troubleshooting it seems that the issue with my PPTP connections is that GRE isn’t making it to my server.

In my logs I found the following:

vyatta pptpd[2777]: CTRL: PTY read or GRE write failed (pty,gre)=(6,7)
vyatta pptpd[2787]: GRE: read(fd=6,buffer=8058640,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs

Fix / Workaround:

Change the guest machines adapter type to VMXNET3

Steps to do this:

  • Connect directly to the ESXi 5.5 using the vSphere Client.
  • Select the virtual machine, Right Click
  • Click Edit Settings… to open the Virtual Machine Properties window.
  • On the Hardware tab, select the Network Adapter and click Remove.
  • Click Add.
  • From the Device Type middle panel, select Ethernet Adapter.
  • Click Next.
  • Choose Adapter Type VMXNET3

 

I hope you enjoyed this post
Please visit me on Facebook @ http://www.facebook.com/jermsmitcom & via twitter: #jermsmit

Get the 3ware 9650SE working with ESXi 5.x

At the office we recently built two white box, built it yourself servers (lego’s). I called them Lego’s due to the fact they are build your own types and not OEM. For each of these powerhouse systems we got 3ware 9650SE RAID controllers (3ware 9650SE-4LPML PCI Express Lanes: 4 SATA II Controller Card RAID Levels 0, 1, 5, 10, Single Disk, JBOD, KIT).

After getting ESXi 5.x installed to a USB Stick to boot from I encountered an issue where the 3ware controller was not recognized by the system. Well this could only be one thing. Drivers.

This is where installing of the controller driver fun begins.

I first navigated to the LSI website and their support page to download the drivers for these controllers. Where I was able to find drivers for VMware ESXi 5.0 update 1 driver for 9650SE/9690SA

After downloading the zip archive of the driver, I extracted and used WinSCP to upload the drivers to the /tmp directory of my ESXi 5.x hosts.

I then logged into the ESXi 5.x using SSH with Putty.

After changing my directory to /tmp I ran the following command:

esxcli software vib install -v /tmp/scsi-3w-9xxx-2.27.08.036-1OEM.500.0.0.472560.x86_64.vib

Soon after I got the following messages:

Installation Result
Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
Reboot Required: true
VIBs Installed: LSI_bootbank_scsi-3w-9xxx_2.27.08.036-1OEM.500.0.0.472560
VIBs Removed:
VIBs Skipped:

After the install I followed the instruction to reboot and after the systems were up and running again I was able to see the controller and create my new data-stores.

Link(s):

https://my.vmware.com/web/vmware/details?productId=242&downloadGroup=DT-ESXi50-SAS-3w9xxx-22708036

buslogic SCSI adapter is not supported for 64-bit guests

After converting a Linux (Debian) machine using VMware vCenter Converter Standalone, to have a copy of my virtual machine running on ESXi 5.x in VMware Player. I encountered the following error on start-up: buslogic SCSI adapter is not supported for 64-bit guests

There isn’t an option in the VMware Player to change the scsi type, so I turned to editing the virtual machine’s .vmx file changing the following steps.

  1. Opened the .vmx file for the virtual machine with a text editor; in my case notepad++
  2. Located the following line: scsi0.virtualDev = “buslogic”
  3. Replaced the line scsi0.virtualDev = “buslogic” with scsi0.virtualDev = “lsilogic”
  4. Saved the .vmx file and returned back to VMware Player and started my virtual machine.

 

Convert VirtualBox VDI to VMware VMDK

I am in the process of moving VirtualBox vdi’s over the VMware ESXi host so what better chance is there to post the process I am taking to make this happen. To perform this “magic” trick you will be using the VBoxManger tool to clone the VirtualBox disk into VMware formatted disk types.

I am using the following steps to convert my disks.

  • Open a terminal or ssh into machine hosting the virtual box disks
  • Ensure the disk is not  being used by a running system
  • Locate the disk image, change into the directory
  • Type the following command:
    VBoxManage clonehd “<vdi file >” <new.vmdk> –format vmdk
  • You can monitor the output as it will look somewhat like this via the console: 0%…10%…20%…30%…40%…50%…60%…

Once completed you have your new VMDK disk image which you can then copy over to a VMware Player, or ESX host to run from there.

Please note: You can do similar to above with other disk formats, however in this post I am just covering VDI to VMDK.

More info on VBoxManage here

Did you like this post, please stop by my Facebook Page and give us a Like

SSH into ESXi 5 host using public key authentication

CLI

I do this with my other linux host over here @ jermsmit.com so why not with my ESXi 5 hosts. Using OpenSSH Public Key Authentication on ESXi 5 required a few things.

  1. You need to enable SSH
  2. You need an SSH client (I use putty)
  3. If you already have a authorized_keys file handy use it or make a new one
  4. And Filezilla or WinSCP handy will also help.

Now all you need to do is locate the following directory on your ESXi 5 host: /etc/ssh/keys-root and copy your authorized_keys file to this location. Unlike standard linux system where the file is located /.ssh/ ESXi has a different layout.

I used WinSCP to do my file copies to my system here, use whatever you feel is best for you. And that’s about it, you can now ssh into yourself w/o the need of entering your password.

Next I think I will attempt my hand at some scripting to automate some tasks; when I do, you will all be the first to know.

Feel free to leave jermsmit.com and head over to this link on Public-key cryptography. The more you know the better we all are

Enable SNMP on ESXi5

Looking to enable SNMP to do some external monitoring on my ESXi Boxen. I took a quick dive into the CLI and found a way to do this.

Using our friend putty, I connected to my ESXi host via SSH. I then changed directory to the /etc/vmware/ folder: ~ # cd /etc/vmware/

ESXi 5 doesn’t have nano (best CLI editor on earth) so I use the original best ‘vi’. Simply type vi snamp.xml ( /etc/vmware # vi snmp.xml ) you will see the following:

<config><snmpSettings><enable>false</enable><communities></communities><targets></targets></snmpSettings></config>

At this point things should be obvious. Press ‘i’ to insert data and change all that is false to ‘true‘ and add Public between the <communities></communities> ( end result <communities>Public</communities> ) and you just need to press Esc followed by :wq to save and quit.

Lastly you need to restart some management services. This is done by typing: /etc/vmware # services.sh restart now you should be able to monitor your ESXi 5 boxen.

Good Luck to you…

– Jermal