Tag Archives: VMware vSphere

nVidia GRID K2 vDGA with VMware Horizon View using PCoIP

Today I’d like to share a very interesting lab session with you all – the result will be a dedicated virtual machine with one of nVidia GRID K2’s GPU Cores enabled and accessed via Horizon View’s PCoIP protocol, where we’ll take a small look at its performance and parameters.

Prerequisites

You will not need much for this very basic VMware Horizon environment – a VM where either vDGA or vSGA is present and Horizon View Agent & Horizon View Agent Direct-Connection Plugin installed to allow you to connect to it via PCoIP.  You will be connecting to this VM via the VMware Horizon Client. Continue reading

VMware vCloud Air: Virtual Private Cloud OnDemand Impressions

Foreword

I have noticed that there is a hybrid Cloud offering called VMware vCloud Air – Virtual Private Cloud OnDemand. This Platform-as-a-Service (PaaS) allows you to have your own environment in VMware’s Data Centers. Everything is metered on pay-as-you-go basis – you pay for each resource used – vCPUs, RAM, Hard Drive Storage (you can choose between SSD-accelerated and “platter-based” only), plus licensing fees for Windows OS family. It has a simple, friendly user interface, but your VM Infrastructure Administrators will want to use the integrated vCloud Director Interface that is also included.

The current promo action runs with 300€ credit for you to spend on the first 90-day trial for everyone – if you are interested go and check it out. Since I like trying out new things, I’d like to share my first moments with this brand new service. Continue reading

Book Review: VMware vSphere Design, 2nd Edition

VMware vSphere Design Book Cover

Since expanding my digital bookshelf with some more VMware-oriented books, I finally finished one hefty piece in my library, and that is a Kindle Edition of VMware vSphere Design, 2nd Edition. I like getting my hands-on experience with hardware and am intrigued by data center design, so I just had to get this piece. Continue reading

PowerCLI Session 00: Introduction to PowerShell & PowerCLI

A few words to start with

Welcome to PowerCLI Sessions, where I’ll be showing you how VMware’s PowerShell Module PowerCLI works, along with examples so you can analyze, study, and most conveniently use the knowledge you find to your own good. I’d like to start with a “0th” session, to introduce people to PowerShell-based scripting on Windows Server systems.

Starting with Windows Server 2008, Microsoft has included an object-oriented shell to its systems called PowerShell. This was to quickly replace the previous, widely used scripting engine own to the Windows OS Family, Visual Basic. Whereas I have done several Visual Basic scripts in the past, it was frankly cumbersome to work with (and I guess many of you guys who have had the pleasure of scripting in VB will agree) – debugging was quite hard, the mnemonics were not that easy to remember – in short it did its job but you had to spend some time fiddling with the code as IDEs were next to none for this scripting language.

Introducing PowerShell & PowerCLI Module

With PowerShell, your weapons in the arsenal are the so-called commandlets (or cmdlets for short), and they are almost always based on a verb-noun basis, so they are pretty easy to remember. The outputs are almost always objects with various properties (or members) that are incredibly useful as I will be showing you throughout the lessons. You will need to wrap your mind around the fact that you are now working with objects in a shell environment – no more feeding plain strings everywhere. Sometimes you will need to input an object into your command else it will fail.

How does PowerCLI come into play here then? Simply by being a Module (we can also call it a plugin, extension, etc.) for PowerShell – supplying it with many new commandlets to be used exclusively within a VMware environment – all these commandlets operate by communicating with vCenter Server, or the ESXi host itself.

Installation

First things first – make sure your core PowerShell is updated to the most recent version possible (v3 for Windows 2008 R2 and v4 for Windows Server 2012 onwards) You can get the PowerCLI Version 5.5 in VMware’s repository – you will just need an account at my.vmware.com. The installation is pretty simple. Just download the executable, follow the instructions and then launch the console with a shortcut that has been created either in your start menu or on the Desktop.

Getting warmed up

The simplest command you will use in PowerCLI is Connect-VIServer (notice the Verb-Noun mnemonic?). This will establish either a connection to the vCenter or ESXi host. If you are unsure how to use the command, just try to Get-Help for it.gethelp

Now you are ready to run the command.

connectvcenter

From there you can use Get-VMHost to list all your ESXi hosts connected to the vCenter Server, Get-VM to get all the Virtual Machines.getvmhost

To explore each object’s properties, a VERY useful tool is Get-Member – this will show you what else is hiding behind the values that were just listed. Let’s try it with Get-VMHostgetmember

As you have noticed I have used the pipe and a shortcut to this command which is gm – and you will be using a lot while learning about objects’ members. To explore a member of the first position in the array, you use a dot like this – let’s use it to check the build number of the first ESXi host:

getmember-buld

To disconnect from the vCenter Server or the ESXi host, just type in Disconnect-VIServer servername and you are done.

Congratulations! You have just tapped in the awesome world of PowerCLI – we’ll continue with introduction to variables in the next Session.

CISCO Nexus 1000V VEM v142 VUM Fix

We had an issue in our environment when upgrading Cisco Nexus 1000V VEM module on all our ESXi hosts from version 4.2.(1)SV1(5.1a), or v142 as found in the filesystem structure. The update just wouldn’t go through VMware Update Manager, either with “ERRNO 8” or error stating that “The host needs to be in the Maintenance Mode before the patch is installed”, although the host was in maintenance already. The same error was thrown when trying to make this update via esxcli.

Me and my colleague poked through this situation and finally came around the conclusion, that the upgrade function inside the vssnet-functions module didn’t properly terminate the vemdpa process. When inspecting the same module of the version we were upgrading to, the upgrade script had even a developer’s note that the vemdpa process needs to be killed with -9 switch, because SIGTERM does not do its job:image002

The modified lines vssnet-functions module will look like this:

image004

To use this script, you will need the plink utility, be able to authenticate with Active Directory – ESX Admin privileges to the ESXi host itself and a bit of patience if the script wouldn’t want to work. Below is the screenshot of patching process:

Screenshot of VEM script

And the script code is below. Notice that it is highly modular and in general you could modify it so it allows sending commands via SSH via a non-root account. How to run commands via plink under as a root even when permit root login is off will be in a scope of a future Scripting Corner.

function ESXSvc ($command, $service, $inESX) { #Function starts here
# Check if the service is running...
$running = Get-VMHostService -VMHost $inESX | Where { $_.Key -eq "$service"}  | Select -ExpandProperty Running

If ($command -eq "start") {
	If ($running -eq $false) {
		Write-Host "Starting $service Service on $inESX"
		Get-VMHostService -VMHost $inESX | Where { $_.Key -eq "$service" } | Start-VMHostService -Confirm:$false | Out-Null
	}
	ELSE {
	Write-Host "The $service Service is already running on $inESX"
	}
}
ElseIf ($command -eq "stop") {
	If ($running -eq $true) {
		Write-Host "Stopping $service Service on $inESX"
		Get-VMHostService -VMHost $inESX| Where { $_.Key -eq “$service”} | Stop-VMHostService -Confirm:$false | Out-Null
	}
	Else {
	Write-Host "The $service Service is already stopped on $inESX"
	}
}
} # Function ends here

Write-Host "--- n1k-vem fix script ---`n To be used when upgrading the module from version v142" -ForegroundColor Green

# Define username to be used for pushing the file via SCP, the user must be able to access the ESXi host with these credentials
$scpuser = Read-Host 'Enter your username in "username@domain" format'
$scppwd = Read-Host 'Enter your Account password' -AsSecureString

# Define domain here
$domain = "yourdomain.lab"

# set variables for SCP transfer
$scpapp = '.\pscp.exe'
$termapp = '.\plink.exe'
$tmp = '/tmp'
$vemfolder = '/opt/cisco/v142/nexus/vem-v142/shell/'
$vssfile = 'vssnet-functions'
$sshfile = '.\sshfeed.txt'

# Set variables for SSH and Shell Functions
$sshsvc = 'TSM-SSH'

<# Remove this multicomment if you want to estabilish a per-run, per-session connection on the script
# Define vCenter
$vcenter = Read-Host 'Enter the vCenter Server where the ESXi host resides: '
Write-Host "Connecting to vCenter $vcenter"`n
# Connect to vCenter
Connect-VIServer $vcenter | Out-Null
#>

<# If you have an array of ESXi hosts, you can input it here and comment the single ESXi input below
$esxiArray = @()
#>

<# If you have a single ESXi, comment this ForEach Cycle Definition
 orEach ($esxi in $esxiArray) {
#>

# Read ESXi hostname - used when single ESXi needs to be remediated
$esxi = Read-Host 'Enter ESXi host name without domain '

Write-Host `n"--- Processing host $esxi ---"`n -ForegroundColor Cyan
# Convert to FQDN
$esxihost = "$esxi`.$domain"
$esxiget = Get-VMHost $esxihost

Write-Host "--- Starting Remote Management Services ---"`n -ForegroundColor Green
# Enable Remote management on the ESXi host
ESXSvc "start" $sshsvc $esxihost
Write-Host "Disabling Lockdown Mode"
(Get-VMhost $esxihost | Get-View).ExitLockdownMode() | Out-Null

# Convert the secure string so it can be used with pscp and plink
$BSTR = `
    [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($scppwd)
$PlainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)

# Construct a command to copy the file from /tmp to designated location
Write-Host "Modifying vss-functions file on $esxi"

# If the host's key has not been cached before, send a "yes" before performing a blank function inside the session.
$runssh = "cmd /c echo y | $termapp -pw $PlainPassword $scpuser`@$esxi exit"
Invoke-Expression $runssh

Write-Host "---"

# Run the sshfeed.txt inside the session.
$runssh = "$termapp -m $sshfile -pw $PlainPassword $scpuser`@$esxi"
Invoke-Expression $runssh

#Reset the converted password string to NULL
$PlainPassword = $null

# Disable remote management
Write-Host "--- Stopping Remote Management Services ---"`n -ForegroundColor Green
ESXSvc "stop" $sshsvc $esxihost

Write-Host "Enabling Lockdown Mode"
(get-vmhost $esxihost | get-view).EnterLockdownMode() | Out-Null

Write-Host `n"Processing of $esxi completed."`n -ForegroundColor Cyan

# }

# Disconnect from vCenter Server if a per-run, per-session basis was used.
# Disconnect-ViServer $vcenter

Also, you will need the sshfeed.txt file which will tell the plink utility what to do:

cp /opt/cisco/v142/nexus/vem-v142/shell/vssnet-functions /tmp/vssnet-functions.orig
sed 's/doCommand kill \${DPAPID}/doCommand kill -9 \${DPAPID}/g' /tmp/vssnet-functions.orig >/tmp/vssnet-functions.tmp
sed 's/doCommand kill -TERM \${DPAPID}/doCommand kill -9 \${DPAPID}/g' /tmp/vssnet-functions.tmp > /tmp/vssnet-functions
mv /tmp/vssnet-functions /opt/cisco/v142/nexus/vem-v142/shell/
chmod +x /opt/cisco/v142/nexus/vem-v142/shell/vssnet-functions

Once you have both these files in directory, just run the script and patch the hosts’ vssnet-functions file that way.

Book Review: Mastering VMware vSphere 5.5

Book Cover

Today I’ll be sharing a short review for the of the book, Mastering VMware vSphere 5.5 – Kindle Edition. I purchased it in order to enhance my knowledge, and in hope that it will help me be better prepared for the VCP510 exam. This book has  greatly fulfilled both of my expectations.

I read it from cover to cover, as I usually read all the technically oriented books in order to soak the most knowledge I can. The book is nicely written, with sidebars providing very useful knowledge from working experience. As can be expected from a book that contains “Mastering” in its name, it focuses on every single aspect of vSphere. Starting from the basics in each of its chapters, smoothly transferring to an in-depth level. There is a step-by-step walk-through for every action that is a subject of the chapter along with screenshots. Technically complex matters are displayed graphically to enhance your imagination, which is always nice.

The paperback version has 840 pages – this translates to roughly 15 hours of reading if you don’t just want to skim through the book or just look for enlightenment in certain chapters. But it is certainly good to read the book bit by bit – I guess reading it all in one sitting would result in an information overload 🙂

I wish I could sum up each element this book covers, but I’d be just typing out all vSphere features and aspects such as networking and storage and their underlying components – that many of you are already familiar with. If you have some vSphere experience – or you grasp the concept of virtualization with some IT background and seek a book that will get you started with vSphere, would like to know how certain things work “under the hood”, or just want to see how the authors tackled some real-world scenarios, this book is for you.

As for myself, I read this book with some ~5 months of last-level operator experience and learned many new things. For example did you know that during vMotion the memory snapshot of the source VM is sent to the destination ESXi host in clear text? Or that while using NFS connection to your datastores, only one of the two uplinks being used for the data transfer, even though LACP is used? And there’s much, much more. While sweating in the exam room answering the VCP questions, I recalled what I read in this book many times. Even though this book is revolving around vSphere 5.5 and its features, it is tremendeously helpful for use with earlier versions of vSphere 5.x.

I heartily recommend this book to everyone who wants to learn more about the vast amount features in vSphere. Be it people recently introduced to virtualization, or seasoned vSphere operators who would like to know more. It will even help you to prepare for VCP if you take your time and indulge in the chapters.