VTwinDude's Blog

rss

Thoughts and updates from VTwinDude


I've been working with VMware a long time and it works really well when you want to separate environments (IE VMs, clusters), have a single management tool set and save money via server consolidation.

We are now turning a new leaf as we move away from datacenter centric environments to application centric environments. I think that Kubernetes potentially will become the gateway to infrastructure. Being able to take an action directly against the ESXi kernel that run Kubernetes removes a lot of complexity.  However, I do believe that VMs and containers will be here for a long time, apps aren’t that easy to refactor.

There are many ways of doing Kubernetes. I do think VMware got it right by making Kubernetes part of the vSphere platform natively (ESXi kernel). This makes Kubernetes containers a 'first class citizen' on infrastructure instead of Infra-VM-OS-Container-app. This new way allows applications to scale as the application requires. That means that we will be able to manage 'both 1st class citizens (VMs and containers)' with one tool (VC) on one platform (vSphere) that enables operations and developers to do their job more efficiently! VMware DRS will still to the resource placement for workloads-the scheduler is very good at what it does.

This means that automation will be built-in to the platform to simply scale based on application's needs via policies and configurations. Today we simply automate what humans are doing as repetitive tasks, scripting things to be more efficient. But what we don't do is script application needs. As an example, imaging an application that needs more resources. You can now 'spin up another VM/container' or script logic to spin up another VM on another host. This builds resiliency into the application layer while keeping configuration consistent. Now we will be able to simply configure a policy to always have 3 containers up and running in a pod which can be built across hosts (IE ESXi cluster) and scale up as the application requires. The new way of automation where we won't need other agents, or to react, but the system will simply do it based on the configuration/policy is the future.

Kubernetes has a logical construct called a namespace which can be a collection of many things including VMs, PODs, and services along with other objects. A namespace allows for polices to be applied to it just like if it was a VM or storage or network, awesome right! Think about Kubernetes cluster running beside a VM cluster in the same Virtual Center that allows developers to run API commands directly to Kubernetes – there’s no need to learn a new tool.

Also, I would like to note that Kubernetes will run across all of the cloud providers as VMware is on top of them today. This should allow for multi-cloud models that are app centric! What if we were able to run an application with a node on-prem and 2 nodes in different clouds?

There are a lot of things that will mature over the next year. It will be great to learn and grow as a powerful platform continues to enable organizations to build modernized applications and support them.


 


OK… script away ---

A friend of my (Jeremy) helped write this with me learning sometime back however I cleaned it up some. It is and was a great tool in another role I use to be in. I removed list items 4-9 as we used it to setup specific performance settings for a technology/vendor product, but you do not need it for this script to help you with setting up the VI side of things. I do know that some of the PowerCLI commands are older but we had older ESX/ESXI versions we needed to cover. Also we haven’t had time to redo it with newer commands.

We wrote this originally to help implement VI settings as and as overwrite/correct settings. So please test it. You are using this at your own risks.

There is a step in here at the beginning to kill all VC connections… I used it for testing…
Here is a few of the settings we targeted at each layer – single host or vCluster or vDC

Enable Firewall Port Settings
Disconnect Media Devices from VMs
Modify Syslog Settings
Create Persistent Scratch Location
Modify Domain Name and DNS
Modify NTP settings
Modify Storage Settings (add, scan, rename, mount NFS share)
Enter/Exit Host from Maintenance Mode
Connect, Disconnect ESXi Host from vCenter
Change Root Password
View ESXi Logs
Enable\Disable SSH
Modify Networking Global Settings
Modify Networking for vSwitch 0, 1, 2

I would like to ask if you modify or update the Script then please share it back with us.
Please provide feedback/comments so we can make it better and report any issues you find.

I am not a GURU at scripting.. I just like to get creative sometimes and scripting helps with applying that creativity quickly.

Download - PowerVIConfigurator_v2.txt

 

Thanks
@vTwindude

 


So I was asked how to audit the VMware license in use vs portal? Meaning what we have vs what VMWare portal says we have vs what are we using. License is a big cost for most. For me I was thinking for sure there is a tool to do a compare, hmmm not that I can find. Sure you can look in your VMware portal to see what you have paid for. However if you are in the middle of a migration/upgrade it could become a mess to see what you have and how much you have paid for. So the fun begins…
This is a very large organization with many different levels of license as well as versions. At that point I was asking if there’s a tool to compare what are allotted vs used vs portal. As you know license can be a mess to maintain but surely there’s a tool to do an audit, well not so fast. I did search the web however i did not see what I was looking for, however I was thinking, surely someone has done this. So I turned to my social media friends for help. I put out a twitt to ask about a script to put this information. Sure enough some folks started to point me to scripting, and someone had one…. Thanks Jonathan Meed.
Requirement is to gather the following:

·         Hostname
·         License key assigned to the host
·         Name of the VC managing the host
·         License type
·         Flexibility to collect the information for multiple Virtual Centers

So I got a script from Jonathan and massaged it some however I couldn’t get it to do what we needed. This was on me as I was trying to understand each piece of the script. Great Job Jonathan!
So I did a little reading:
API - https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.LicenseManager.html
Understanding ‘Functions’ - http://www.thomas-franke.net/including-scripts-functions-modules/ 

At this point I decided to just create a script. I asked a friend Matt Derk for some help, he knows scripting pretty good. In any case here is what we came up with and it works,,,, yay
Disclaimer – We tested against VC 5.5

First set the script to collect data from multiple virtual centers:
I saw an error at first so we worked through this to stop the prompting for invalid cert.

# Set to multiple VC Mode
if(((Get-PowerCLIConfiguration).DefaultVIServerMode) -ne "Multiple") {
    Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -InvalidCertificateAction Ignore -Confirm:$false | Out-Null
}

Then we wanted to allow for inputting multiple hosts:
#Define VC hosts – IPs or FQDN
$VChosts = @(
"VC1.ron.com",
"VC1.ron.com",
"VC3.ron.com"
);
Write-Host "Connecting to VC Server(s)"

Then connect to the hosts: We didn’t really want to prompt so the script will use the session you are logged in with. If you want to use different creds, right click and choose ‘Run As’.

Connect-VIServer -Server $VChosts

Then we need to define some variables for the data we want to grab
#Define variables for license and host functions
#API - https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.LicenseManager.html

$servInst = Get-View ServiceInstance
$licMgr = Get-View $servInst.Content.licenseManager
$licAssignMgr = Get-View $licMgr.licenseAssignmentManager

Now let’s throw in a function to do this work:

function Get-VMHostId($Name)
{
    $vmhost = Get-VMHost $Name | Get-View
    return $vmhost.Config.Host.Value
}
function Get-License($VMHostId)
{
    $details = @()
    $detail = "" |select LicenseKey,LicenseType,Host,VC,Total,Used,ExpirationDate
    $license = $licAssignMgr.QueryAssignedLicenses($VMHostId)
    $license = $license.GetValue(0)
    $detail.VC = ([Uri]$licAssignMgr.Client.ServiceUrl).Host
    $detail.Host = $license.EntityDisplayName
    $detail.LicenseKey = $license.AssignedLicense.LicenseKey
    $detail.LicenseType = $license.AssignedLicense.Name
    $detail.Total = $license.AssignedLicense.Total
    $detail.Used = $license.AssignedLicense.Used
    $details += $detail
    return $details
}

Now run this against all hosts and puke out the data to a file. The script is setup to create the path/folders if not there.

# Run Query Against All Hosts
$vmhosts = Get-VMHost
$details = @()
foreach ($vmhost in $vmhosts) {
    $vmhostname = Get-VMHostId $vmhost.name
    $detail = Get-License $vmhostname
    $details += $detail
}
$details
if(!(Test-Path -Path C:\Temp )){New-Item -ItemType directory -Path C:\Temp}
write-host "output being save to C:\Temp\Host-Licenseinfo.csv"
$details | Export-Csv -NoTypeInformation C:\Temp\Host-Licenseinfo.csv
 
I can assure you I’m no pro at this but hey it works…. J However it seems that the “expire date” is in a different area and couldn’t get it to work within one script so we created second one to grab that. I know it’s not ideal but a manual combine is better than none.
Sample output; now you can sort and do all kinds of things with the data.




 

 

 

 

 

I am sure others can make these better. Thanks for reading and happy auditing your license.

Thanks Matt & Jonathan for your time and consideration.  

 

Download script:  Licenseinfo-01.txt


A complete guide for all your essential vSphere 5.1 docs

http://vsphere-land.com/news/vsphere-51-link-o-rama.html

Great Reading!


MS's new version seems to include WAN vMotion... wow without OTV (Overlay Transport Virtualization) or at least that what I’m reading. It will be very impressive to have WAN vMotion for many reasons including DR/BC>...  Great article here on CIO:

http://www.cio.com/article/690019/Microsoft_Cracks_Live_Migration_Problem?taxonomyId=3112

The MS version of HyperV3 will give us the right things we "need" not wants. VMware gives us something’s for free or at least until you move to Vsphere5 and get hit with the vTax. They did make some changes to licenses but not enough to stop people from looking at other products that get the job done! HyperV-3 vs vSphere 5 - http://www.tomsitpro.com/articles/hyper-v-virtualization-windows-server-8-vsphere,1-16.html

I truly think that over time we will see the virtual scene change to more of a tiered approach. VMware is the lead today but what the future brings is going to have to wait and see! I think based on cost and seeing some try to put virtualization directly in at the chip level, its going to get fun for us engineers and admins.

Ivan Pepelnjak has a great article on VXLAN-LISP-OTV ----http://blog.ioshints.info/2011/09/vxlan-otv-and-lisp.html

Great reading from Thomas Mauer - Hyper-V & UCS combo: http://www.thomasmaurer.ch/2011/05/how-microsoft-hyper-v-and-the-cisco-ucs-changed-our-lives/


VMWKST - 8 has some new features and pretty nice ones if i may say... i will beging to explore these over the coming weeks/month