Archive

Archive for the ‘VMWare’ Category

Free VMware training!!!

April 21, 2011 Leave a comment

Well . .some free training . . and no . . not VCDX or anything too exciting, but VMware have at least provided some online training / eBooks to help all those people who will soon need to transition to ESXi, from ESX (ESX of course will be end of lifed soon)

On VMware.com blogs:

Great news for all VMware customers: the VMware Education Services team has just made available a new, FREE elearning course dedicated to ESXi , “Transition to ESXi Essentials”. The course is a self-paced three-hour online training that provides the knowledge necessary to make fundamental design decisions to successfully add VMware ESXi to a vSphere environment and to take advantage of all of the new features included in ESXi 4.1. The training is ideal for system administrators, consultants and engineers responsible for managing and supporting a vSphere environment.


More here . . .

Troubleshooting VMware issues with MindMaps

April 7, 2011 Leave a comment

The guys on VMTN have released a few new mindmaps to help with various bits of troubleshooting.
Initially, I thought, great, another flowchart . . but I run a few scenarios through my lab, thinking that instead of troubleshooting myself, I would simply follow the mind map and I was surprised at how well they cover the kind of problems we see both regularly on our various environments and also how well they cover issues that I regularly see on the VMware communities site.

Oddly, I had never spotted these before – but it seems there are a bunch available at http://communities.vmware.com/community/vmtn/general/knowledgebase?view=documents

Below are the 4 that I figure are going to be most pertinent in current environments – a very hany tool indeed.

Mindmap – vSphere Troubleshooting Network Issues
Mindmap – vSphere Troubleshooting Management Issues
Mindmap – VMware Troubleshooting View Management Issues
Mindmap – VMware Update Manager Issues

What I really like about these is not simply that they produce a ‘flow chart’ for troubleshooting, but the fact that once you get to the lowest level on the mind map, there is a little infinity sign that you can click on – which takes you to a knowledge base article for each solution. this means that just about anyone, no matter what their level, can use these

Categories: VMWare Tags:

Installing VMware SDK with Visual Studio 2010 / Visual Studio 2010 Express – workaround

March 31, 2011 Leave a comment

This is just a quick workaround to get the installation done – nothing else (really a reminder to myself)

I have a project to provision VMs from a customised front-end,
I have created a C# tool – that integrates with SCCM as well as our various asset management tools and some scripting environments, to allow for a ‘1 button deployment’

Of course . . to be a true one button deployment, I’d like to be able to actually create a VM when using the same ‘Big Red Button’

Anyway, my development environment happens to be Visual Studio 2010 – so yes simple . . let’s get going, surely we just follow the setup guide provided at :

http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/sdk40setupguide.pdf – page 19

Well, that would work, except that the SDK kit has not yet gotten the relevant batch files for a Visual Studio 2010 installation.

The solution to get the installation working was to get a copy of the amended cmd from the VMWare communities:
http://communities.vmware.com/servlet/JiveServlet/download/1225636-21465/genvimstubs2.cmd
and copy it to your .\sdk\samples\DotNet directory

Next, go to : Start Menu\Programs\Microsoft Visual Studio 2010\Visual Studio Tools and select Visual Studio Command Prompt (2010)

Now, make sure that you have the environmental variable VCINSTALLDIR set to point to your Visual Studio installation path (type ‘set’ to see your environmental variables)
I had to set it like this:

SET VSINSTALLDIR="c:\Program Files (x86)\Microsoft Visual Studio 10.0"

Finally, I had to run the installer.]
In my case, the SDK was at d:\VMWare\SDK\samples, so I ran:

D:\VMWare\SDK\samples\DotNet>genvimstubs2.cmd d:\VMWare\SDK\wsdl\vim25 Vim25Api stage Vim25Objects.cs . Vim25Service2005

Installation looks like this:

D:\VMWare\SDK\samples\DotNet>genvimstubs2.cmd d:\VMWare\SDK\wsdl\vim25 Vim25Api
stage Vim25Objects.cs . Vim25Service2005
Checking and Creating stage
The system cannot find the file specified.
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version
2.0.50727.1432]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file ‘stage\Vim25Objects.cs’.
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.4926
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) Xml Serialization support utility
[Microsoft (R) .NET Framework, Version
2.0.50727.1432]
Copyright (C) Microsoft Corporation. All rights reserved.
Serialization Assembly Name: Vim25Service2005.XmlSerializers, Version=0.0.0.0, C
ulture=neutral, PublicKeyToken=null.
Generated serialization assembly for assembly D:\VMWare\SDK\samples\DotNet\vim25
service2005.dll –> ‘.\Vim25Service2005.XmlSerializers.dll’.
Optimizing generated stubs…
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.4926
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

Stub generation Done.
ECHO is off.

From here you can continue using the instructions in the getting started guide above.

Categories: Scripting, VMWare Tags: ,

Upgrading ESXi without VUM

March 24, 2011 Leave a comment

It seems that VMWare are getting rid of VUM (I assume something new will be released soon to replace it), so more and more people are going to need to manage ESXi upgrades from the command line.
I suspect that the people that will be most affected by this are people running the free version of ESXi.

Anyway, here is a quick how to, for ESXi upgrades.

First enable ssh access to the ESXi4.0 box.

At the ESXi console:
1. alt-f1
2. Type unsupported (You will not see your typing)
3. root pw
4. vi /etc/inetd.conf
5. uncomment the 2 ssh lines, i.e delete the “#” preceding the ssh config lines (esc x to delete a character in vi)
6. :wq to save the changes in vi and quit the vi editor
7. services.sh restart (if necessary reboot the ESXi box if ssh still does not work)

If you are running ESX4.1, follow this guide to enable SSH access to ESXi4.1 Host
(again at the console)

1.Press F2 to Customize System Settings
2.Navigate to Troubleshooting Options
3.Select ‘Enable remote Tech support (SSH)

Note – you can also adjust the tech support timeout here – so you could limit how long tech support stays enabled for.

Next, you will need to download your upgrade bundle from VMWare –

You now have 2 Options,

Run the installation – Option 1 – from a webserver
If you are able to store the upgrade bundle on a webserver, you could do the following:
Place the file upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip at the root directory of your web server.
I use Apache Tomcat 7.0 on Windows XP to host the file upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip
Ensure the Windows Firewall allows access from external hosts to your web server (In the case of Apache Tomcat, I had to open port 8080)
VMotion all the VMs off of you host, or Shut down all VMs, and put the host into maintenance mode.
SSH to your ESXi4.0 box and at the CLI type:
esxupdate –bundle http://ipaddress:8080/upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip update (Of course this value will change dependent on your filename)
The zip file will be downloaded from your web server and installed. Reboot the ESXi server when prompted.

Run the installation – Option 2 – from a local instance of the upgrade bundle
If you do not have a web server handy, you could copy the bundle locally on the ESXi host. – or even on a shared datastore accessed by multiple ESXi hosts if you have shared storage.
Using FastSCP(my preference, but any SCP style tool will work e.g. WinSCP) – Copy the upgrade bundle to the ESXi host(or shared store)
VMotion all the VMs off of you host, or Shut down all VMs, and put the host into maintenance mode.
SSH to the host (I use putty, but any SSH tool will work)
From the command line of the host, execute the command: esxupdate –bundle /vmfs/volumes/<datastorename>/<myfolder>/upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip update
The zip file will be extracted and installed

Reboot the host
Reboot the host when done. Once that’s complete, take the host back out of maintenance mode, and power on the virtual machines.
You’ll possibly have new VMtools available, so upgrade these.

If your host refuses to start up and you are having issues, you should be able to revert to your previous installation by hitting Shift-R as the host boots up.

Categories: VMWare

Finding VMs with disks on multiple different datastores – Script of the Day

March 23, 2011 Leave a comment

I was looking at a VM on one of our hosts and noticed the rather odd configuration showed that the VM had 2 disks provisioned (not unusual), and that the 2 disks had been presented on different storage (very unusual for non clustered VMs in our environment)

I figured, the easiest way to identify all of the VMs that are using VMDKs on multiple different datastores was PowerCli.

The result – just a one liner.

PS:7 >get-vm | ?{$_.DatastoreIdList.count -gt 1}

Name                 PowerState Num CPUs Memory (MB)
----                 ---------- -------- -----------
labserver001     PoweredOn  1        8192
labserver 17a         PoweredOn  2        1280
labserver21        PoweredOn  1        8192
labserver17b         PoweredOn  2        1152

Copying data to a VM datastore using PowerCli – Script of the Day

March 8, 2011 Leave a comment

Ever needed to copy data from your local machine to a VMware datastore . .and not felt like messing around with winSCP / FastSCP, the Datastore browser etc?

PowerCli / PowerShell lets you create a new PSProvider item for your datastore, which in turn lets you copy data using the normal Copy-Item syntax. (though using Copy-DatastoreItem instead)

So, if you have a Datastore in your ESX environment called ‘Datatstore1’ and you want to copy an iso from your C:\ISO directory, it would be as simple as

PS: >new-PSDrive -location (get-datastore 7523_local) -name myds -PSProvider VimDatastore -Root '\'
Name           Used (GB)     Free (GB) Provider      Root                                               CurrentLocation
----           ---------     --------- --------      ----                                               ---------------
myds                                   VimDatastore  \lonlab001@443\Prod\7523_local
PS: >Copy-DatastoreItem -item C:\ISO\install.iso -Destination myds:\ISOS\Myiso.iso -force

Also, as the drive is now a normal PSProvider path, normal commands like get-childitem work like they do on a local drive

PS: >gci myds:
   Datastore path: [7523_local]

            LastWriteTime            Type       Length Name
            -------------            ----       ------ ----
     21/04/2010     07:40          Folder              esxconsole-4bcdbd...
     08/03/2011     16:31          Folder              ISOS

Genius,

Of course this gives you full access to all of the datat on your datastores directly form a PowerCli session, so you can run any sort of reports / inventories etc that you may need. Happy days . .

Categories: Powershell, Scripting, VMWare

‘Upgrading’ from ESX to ESXi – a multipart series – Tools

March 2, 2011 Leave a comment

Setting up the test environment

In order to get this whole build tested, we need a repeatable and accessible Lab environment.

If you are unfortunate enough to not have an ESX lab environment that you can play on, you could build a workstation and emulate your production environment right on your desktop using VMware workstation.

Tools that we’ll require (so need to download if you do not have them already) are as follows:

PowerCli

· Installation guide http://www.vmware.com/support/developer/windowstoolkit/wintk40/doc/viwin_install.pdf

· Download : http://www.vmware.com/download/download.do?downloadGroup=sdkwin41u1 (you’ll need a free logon)

You favourite script editor

· I use PowerGui : http://www.powergui.org/index.jspa – but you can use anything you like

A VMware ESXi Server, or VMware workstation to run tests on, along with a copy of the ESXi Installable media

· https://www.vmware.com/tryvmware – you can get trials of both from here

Copies of the various tools we’ll be testing

· UDA (Ultimate Deployment Appliance) – http://www.ultimatedeployment.org/download.html

· EDA (ESX Deployment appliance) – http://virtuall.eu/downloads/

· VMware’s own ‘Auto Deploy’ – http://labs.vmware.com/flings/vmware-auto-deploy

· SD / USB duplication – WinImage – http://www.winimage.com/download.htm

· V-PXEServer – http://www.epic.ca/lab/V-PXEServer.zip

· Manual installation – Just the Install ISO above

Assuming that not everyone has spare hardware at their disposal, I guess it would be useful to create VMs to act as ESXi hardware on which to test our installations.

If you’re using VMWare workstation as your lab – Full guide at: http://www.vladan.fr/how-to-install-esxi-4-1-inside-of-vmware-workstation-7-1/

Quick Video:

If you are using an ESX(i) host to run your test ESXi VMs on, follow the guide at : http://www.vcritical.com/2009/05/vmware-esx-4-can-even-virtualize-itself/

For each appliance based deployment method, we’ll create a new VM – these will be detailed as we test each appliance

Categories: Virtualisation, VMWare

‘Upgrading’ from ESX to ESXi – a multipart series – Intro

March 2, 2011 Leave a comment

‘Upgrading’ from VMWare ESX 4.0 to ESXi 4.1(u1) – with as few button clicks as possible.

Anyone reading the official docs from VMware at : http://www.vmware.com/products/vsphere/esxi-and-esx/upgrade.html#c177045 is likely to be annoyed and frustrated at the lack of actual information as to how to manage the ‘upgrade’ (migration) from ESX to ESXi.

There is no direct way to upgrade directly as the 2 products are effectively 2 different operating systems that behave in exactly the same way. (well not really, but they are installed totally differently and are managed slightly differently)

Anyway, we have about 80 ESX hosts to migrate to ESXi, so I decided to find the easiest method to do so.

A scour of the web found several great resources. – and some valuable information. It seems that nobody has yet delivered a full ‘upgrade’ solution, but several people have provided automated deployments of the core installation and several other people have created configuration scripts for the newly installed ESX. So I have decided to add an additional ‘information gathering’ step, then ‘borrow’ some of the work done elsewhere and put together an ‘upgrade’ solution.

Scratching my head, I have been working on a simpler way to manage the deployment / upgrade.

The way I see it, the ‘upgrade’ needs 3 parts:

1) Capture configuration from the existing ESX host that we will be replacing (we may need to interpret and reformat it for our new ESXi Host

2) Deploy new ESXi instance on the hardware

3) Deploy captured config to our new ESXi host.

Whilst I realise that this probably will not be enough to make it a full ‘upgrade’ the idea is to get as much done as quickly as possible.

Coming up will be several posts, documenting comparisons of 5 methods of deployment, as well as some PowerCli code and a look into Host Profiles for easing this process.

On the off chance that one of the vendors that do ‘migration’ tools feel like offering me a free license to trial their tool and write up a process doc, I may even be inclined to review that for people with $$$ – but it is important that it is noted that I promise no allegiance to any tools, as would like this review to be fair and open to all. The end product of the series should provide a decision as to my preferred FREE method for doing the migration.

At the end of the series, I’ll create a comparison table comparing the various products, as a springboard for anyone who’ll soon be in the same situation as me.

For environments where there are only 2 or 3 ESX hosts, I’d consider building a solution like this going overboard, so I will make the assumption that readers of the series are people who have large numbers of hosts to upgrade and therefore will be wanting to work on ESX / ESXi rather than VMware workstation. As such, I will endeavour to get all tools working on ESXi and will highlight tweaks required (several of the tools I have tested so far were created on VMware workstation and therefore do not import directly to ESX hosts)

Products that I will be including in my review for the deployment include:

1. UDA (Ultimate Deployment Appliance) –

2. EDA (ESX Deployment appliance) – (0.90 in VMware appliance Marketplace, but 0.94 available at: )

3. VMware’s own ‘Auto Deploy’ –

4. SD / USB duplication

5. Manual installation (I will include this as a benchmark – remember ESXi requires very few clicks as is to get running, so manual may still be the way to go)

I will go through the options for the deployment of ESXi, before doing the capture and deploy steps above (I need a deployment workframe to work on, so it makes sense in this case)

All tests for now will be run in my isolated lab, with the convenient luxury of the deployment servers being located on the same subnets etc as the Hosts I’ll be deploying to, but once I have selected a solution and start the migration of 80 ESX hosts to ESXi, I will of course post details of any further tweaks required for deployment.

 

Categories: Virtualisation, VMWare Tags:

Script of the Day – Scripted start of Virtual Center when hosted as a VM

February 25, 2011 Leave a comment

There are many threads on the VM communities, debating whether it is better to run a VC on a physical host, or a VMWare host.

My answer is always that running it as a VM is better, but the arguement always comes back that if I have catastrophic faiilure and don’t know where my VC last lived . . I will be in trouble.

Of course, plan a is to simply set the restart policy on the VM to start with the host, but people tell me they have had mixed results with this approach.

The alternative is a quick PowerCli script that quickly connects to each ESX host in the cluster, checks if it owns the VM, then starts the VM.

</code>

$vCenters = "ESXHost1", "ESXhost2", "ESXHost3"
$VCServer = "VCServer"
$userName = "username"
$passwd = Read-Host ("Password for " + $userName) -AsSecureString:$true
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $userName,$passwd

<code>

One catch to be aware of though is that if you are using AD for DNS and all AD servers are VMs, you will be unable to resolve the ESX host names for the script to work, so you’ll need to specify IP addresses to the ESX hosts.

You do not however need to specify the DNS server IP for the VM, as the script look s as VM Names and

You could extend the above script then to start a series of VMs with a set wait time between VMs (e.g. start the DC for DNS etc, then start the SQL server, then start the VC, wait 60 seconds between each start)

</code>
<pre>Disconnect-VIServer * -Confirm:$false
$vCenters = "10.1.1.1", "10.1.1.2", "10.1.1.3"
$vms = "DNSServer", "SQLServer", "VCServerName"
$userName = "root"
$passwd = Read-Host ("Password for " + $userName) -AsSecureString:$true
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $userName,$passwd
# time to wait before starting next VM
$waittime = 60

Foreach ($vm in $vms){
 ForEach ($vCenter in $vCenters) {
 connect-VIServer -Server $vCenter -Credential $cred
 If (get-vm $VCServer -ea 0)
 {
 Start-VM $vm
 Write-Host "VM $VM Starting on $vCenter" -ForegroundColor Green
 Write-Host "Sleeping for $waittime to allow $vm to start up"
 sleep $waittime
 }
 disconnect-VIserver -confirm:$false
 }
}</pre>
<code>

And if you are feeling really flash, you could get each VM start, then monitor that VM for a particular services on thon that VM to run, before starting the next VM (if you have relevant access rights etc)

Prime example here is where I need a VM running my AD/DNS to start, before I can start the SQL server. Then, I want te SQL server to start and the service running, before I can start the Virtual Center.

</code>
# remove any VI connections that you may create in your PS Profile
Disconnect-VIServer * -Confirm:$false
# List of ESX hosts (by IP here as we are assuming DNS lives on a VM)
$ESXHosts = "10.1.1.1", "10.1.1.2", "10.1.1.3"
# 2 dimensional array, each row reflecting the VM to start and the service that I need to monitor
$vms = ("ADDNSServerName", "DNS"), ("SQLServerName","MSSQLSERVER"),("VCServerName","vpxd")
$userName = "root"
$passwd = Read-Host ("Password for " + $userName) -AsSecureString:$true
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $userName,$passwd

# Connect to all ESX hosts in array $ESXHosts
ForEach ($ESXHost in $ESXHosts) {connect-VIServer -Server $ESXHost -Credential $cred}
Foreach ($vm in $vms){
 Write-Host "Searching for $vm[0]" -ForegroundColor Blue
 ForEach ($ESXHost in $ESXHosts) {
 If (get-vm -Name $vm[0] -server $ESXHost -ea 0)
 {
 Start-VM -VM $vm[0] -Server $ESXHost
 Write-Host "VM $VM Starting on $ESXHost" -ForegroundColor Green
 $i = 0
 $running = "no"
 do {$running = Get-Service -ComputerName $vm[0] -Name $vm[1] -ea 0 | % {$_.status}; sleep 1; $i++; Write-Host "Waiting for $vm[1] service to start on $vm[0]- $i seconds elapsed" -ForegroundColor Yellow}
 while ($running -ne "Running")
 Write-Host "$vm[1] service started on $vm[0]" -ForegroundColor Green
 }
 }
}
Write-Host "VC should now be up and running" -ForegroundColor Red

Specifying your own MAC address on a VM

February 24, 2011 Leave a comment

So let’s say we have a VM and it has a VMWare assigned Mac Address – but we want to specify a different MAC for the VM (either a previously assigned automatic VM one, or a 3rd Party one)

You have a few options.

1) VMware provide this: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=507 – but I have had mixed results and sometimes needed to use MAC addresses that are not VM specific

2) 3rd party tools for changing the MAC in the OS (Windows in this case) http://download.cnet.com/SMAC-MAC-Address-Changer/3000-2085_4-10536535.html

3) Edit the Mac Address on the NIC itself in TCPIP properties for the NIC (though often software can get around this .

4) Have a hack around the VMX files:

 

But we need to assign our own Mac Address. How do we do it?

Well there are a few posted articles, showing us how to assign VMware approved Macs (00:50:56:XX:XX:XX), but let’s say my software is licensed to a MAC 00:50:56:22:22:44 . and I have converted the host using a P2V . . what now?

Using the edit settings option for a VM only allows Macs within the alloted range. Annoyingly, even the the MAC address is stored in the .vmx file . . changing it here does not always reflect a change, as the minute you make a change to the NIC (e.g. change port group) it will validate the Mac Address and again kick up errors and get all emotional.

Even worse, the database for the VC saves the old MAC, so it may even revert to the VMware assigned MAC that was provisioned when you created the NIC – or will do so each time you make a subsequent change to the vNic.

Well first of all, let’s have a look at the .vmx file (stored at /vmfs/volumes/<datatsore>/<VMname>/<VMname.vmx> (by default at least)

You can access this by using a tool like WinSCP to connect to the ESX host directly.

If we look in this .vmx file, we see the following Ethernet related entries:

ethernet1.present = “true”
ethernet1.virtualDev = “vmxnet3”
ethernet1.networkName = “BACKUP_32_10.0.224.0”
ethernet1.addressType = “vpx”
ethernet1.generatedAddress = “00:50:56:b2:63:25”
ethernet1.pciSlotNumber = “160”
ethernet1.features = “1”
ethernet1.startConnected = “TRUE”

OK, we want to flush the history in the VC and create a new adapter with our own select MAC.

First of all, let’s remove the NIC from the VM (Right click the VM – Edit Settings)

If we now re-open the .vmx file we get the following ethernet entries:

ethernet1.present = “false”

Great, the remaining entries have been flushed.

Now, we’d like to edit the .vmx file and commit changes, so we need to unregister the VM – we can use the VC for this (right-click Vm and select ‘remove from Inventory’

Now let’s re-add the old details to the .vmx file, but

Sspecify these for a new adapter number

Amend the Mac Address

Amend the PCI Slot Number (incremented it by 10 this time – hit and miss though)

ethernet2.present = “true”
ethernet2.virtualDev = “vmxnet3”
ethernet2.networkName = “BACKUP_32_10.0.224.0”
ethernet2.addressType = “STATIC”
ethernet2.address = “00:00:00:12:34:56”
ethernet2.pciSlotNumber = “180”
ethernet2.features = “1”
ethernet2.startConnected = “TRUE”
ethernet2.checkMACaddress=”FALSE”

Note, if the MAC is a non VMware one, you’ll need to specify :

ethernet2.addressType = “STATIC”
ethernet2.address = “00:00:00:12:34:56”

If it is a VMware on that you are recycling:
ethernet1.addressType = “vpx”
ethernet1.generatedAddress = “00:50:56:b2:63:25”

Now simply right click the .vmx file from the Datastore Browser and Viola!

Of course, I under no circumstance endorse or support this, but I have to mention that I have been forced to use this for applications where applications were licensed to Mac addresses and I had migrated to VMware.

Categories: VMWare Tags: