All posts by Vikas Shitole

About Vikas Shitole

Vikas Shitole is a Senior Tech Lead at VMware by Broadcom, VCF division, India, where he leads system test efforts—including scale, stress, and resiliency testing—and drives product quality across VMware Cloud Foundation (VCF), Broadcom’s flagship private cloud platform. He is an AI and Kubernetes enthusiast, and is passionate about VMware customers and automation around vSphere and VCF. Vikas has been honoured as a vExpert for 13 consecutive years (2014–2026) for his sustained technical contributions and community leadership. He is the author of two VMware Flings, holds multiple industry certifications including VCF admin 9.0, and is one of the top contributors to the VMware API Sample Exchange, where his automation scripts have been downloaded over 50,000 times. Vikas has shared his expertise as a speaker at international conferences such as VMworld Europe and VMworld USA, and was selected as an official VMworld 2018 blogger. He also served as lead technical reviewer for the Packt-published books vSphere Design and VMware Virtual SAN Essentials. Beyond tech, Vikas is a dedicated cricketer, cycling enthusiast, and a lifelong learner in fitness and nutrition, with the personal goal of completing an Ironman 70.3

How to schedule VM power cycle when the guest OS reboots?

Couple of weeks back vSphere 6.7 U3 released vCenter release notes & ESXi release notes and once again an update release has got great content. Apart from several other changes gone into vSphere 6.7 U3, one of the utilities I found really useful. i.e. Ability to schedule the VM power cycle when the guest OS reboots. This post is focused on the same. Before we dig into, below is what ESXi release note says about it.

PR 2394247: You cannot set virtual machines to power cycle when the guest OS reboots

After a microcode update, sometimes it is necessary to re-enumerate the CPUID for virtual machines on an ESXi server. By using the configuration parameter vmx.reboot.powerCycle = TRUE you can schedule virtual machines for power-cycle when necessary.

This issue is resolved in this release.

Based on above description, it is clear that one of the motivations behind this cool utility is the recent meltdown/spectre patches. After applying each of these patches, it was required to do cold power cycle of the VMs in order to re-enumerate the CPUID(s) introduced by that particular patch. Performing cold power cycle (power off and power on) is always tricky to plan and painful activity. This utility enables an user to schedule power cycle as part of guest OS reboots itself. How cool is that!

In order to simulate a scenario where we should see CPUIDs are re-enumerated on a VM, I created a cluster with 2 hosts, where both hosts Max EVC mode supported was “Broadwell” but I enabled EVC on “ivy-bridge” EVC mode. Then I created a GOS VM, powered on it and used below powerCLI script to add ” vmx.reboot.powerCycle = TRUE ” into vmx file.

[powershell] 
 #PowerCLI script to add vmx entry "vmx.reboot.powerCycle"
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
Connect-VIServer -Server 10.1.1.1 -User Administrator@vsphere.local -Password VMware@123 #replace your server (VC or ESXi) name

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.extraConfig += New-Object VMware.Vim.OptionValue
$spec.extraConfig[0].key = "vmx.reboot.powerCycle"
$spec.extraConfig[0].value = "TRUE"

(get-view (Get-VM -Name VMW).ID).ReconfigVM_Task($spec)  #replace your vm name

Disconnect-VIServer -Server 10.1.1.1 -Confirm:$false #replace your server (VC or ESXi) name 
 [/powershell] 

You can run above script against either vCenter or ESXi as endpoint. User also can add above vmx entry using ESXi host client as shown below.

Add parameter into vmx file

After running above script against my VM, I see that vmx file has got ” vmx.reboot.powerCycle = TRUE ” entry . Before I restart the GOS, I checked (from MOB) CPUIDs available on this VM at ivy-bridge EVC mode and below is how it looks.

CPUIDs at ivy-bridge EVC mode
VM cpuids at ivy-bridge EVC mode

In continuation to simulate the scenario, I disabled EVC on the cluster,where max EVC mode supported is “Broadwell” i.e. ideally VMs should be running on Broadwell cpu set but since we had created our VM when EVC was enabled on “ivy-bridge”, it will continue to use “ivy-bridge” cpu set/features even though underlying host is “Broadwell”. Before 6.7 U3, we had to do cold power cycle (power off, power on) to have VM on “Broadwell” cpu set. Since we added vmx entry already, we need not to do power cycle but guest reboot in-turn will do power cycle as well and CPUIDs will be re-enumerated. Below are the CPUIDs I see on VM when I restarted the Guest OS as it is now using broadwell cpu instruction set.

VM cpuids re-enumerated to broadwell

Key observations.
1. I see vmx entry works only when it is added on the Powered ON VM.
2. When I added vmx entry onto PowerOff VM, it got added but as soon as I powered on, it got removed. It will persist during suspend and resume.
3. I observed that this setting is one time i.e. when user restarts the Guest OS, I do not see vmx entry i.e. vmx.reboot.powerCycle = TRUE any more. Hence next time you want to have similar functionality, you need to set it once again on powered ON VM.
4. This utility is just not only for cpuid re-enumeration. cpuid re-enumeration is one of the use-cases. I think it is great idea to schedule the power Cycle when you upgrade VM hardware version or upgrade vmware tools.

I hope enjoyed the post. Let me know if you have any comment.

How to configure Hybrid Linked Mode (HLM) using vCenter REST API

This is going to be my first 2019 post and in this post, I am excited to share couple of ways to configure Hybrid Linked Mode (HLM) using REST API. One of the ways is using UI REST client i.e. apiexplorer and another way is using python. If you are not already familiar with vCenter server REST APIs, I would suggest to first go over my earlier post i.e. Getting started with vCenter REST APIs.
Before I move further, I would like to point out that I am not explaining end to end steps required to configure HLM since Emad already has a detailed post on it here. My focus is on vCenter REST API required to link your Onprem vCenter server to VMware cloud on AWS (Cloud vCenter).

Notes:
1. As you might know, there are 2 ways from which user can configure HLM. One way is to configure HLM from Cloud vCenter,where you can see both VCs (onprem and cloud VC) from cloud vCenter vSphere client (H5C) and another way is to configure HLM using vCenter cloud gateway,which allows users to see both VCs  from vCenter cloud gateway H5C. Here is my new post on configuring HLM through vCenter cloud gateway using API

2. Just to avoid any confusion: Since this HLM linking operation is done from vCenter server or vCenter cloud gateway, REST API also comes from vCenter itself and not from CSP (Cloud services platform APIs, which are about Cloud services console operations)

3. Great news  is that API remains exactly same no matter which way you go for. Only change is: If you are configuring HLM from cloud vCenter (i.e. VMC VC), API end-point would be VMC VC IP/FQDN and if you are configuring HLM using vCenter cloud gateway, API end-point would be vCenter cloud gateway.

How to do HLM linking from H5C UI

You could see, in order to link, we need to pass PSC details and cloud administrator group(s). This is exactly we will do using REST API.

HLM APIs overview

Below are the REST APIs available around HLM. We are more interested in POST /hvc/links call as this is the key API for configuring HLM no matter its from VMC VC or vCenter cloud gateway.

Invoking from UI REST client i.e. APIExplorer

By now you might have already used apiexplorer (swagger based) vCenter REST client. To access it, just browse “https://[vCenter IP]/apiexplorer”. If you see above screen-shot, there are multiple APIs on HLM operations. The one we are interested in is “/hvc/links” POST method, which is responsible for HLM linking.

As part of above request body, we need to pass exactly the same details as we passed while configuring from UI. Let us take a look the “request_body” spec I passed.

{
“spec”: {
“port”: “443”,
“domain_name”: “vsphere.local”,
“username”: “Administrator@vsphere.local”,
“ssl_thumbprint”: “F9:1C:2B:E7:C5:A0:CC:02:D3:37:33:04:B0:2D:2F:6C:77:50:EB:9C”,
“admin_groups”: [
“yourcloudadmingroup@yourdomain.local”
],
“password”: “VMW!23,
“psc_hostname”: “10.161.2.5”
}
}

Let us go over each parameter passed.

port: 443 is default  Onprem PSC TCP port (can be custom port also)

domain_name: Onprem PSC default SSO domain

username, password, psc_hostname: Onprem PSC credentials

ssl_thumbprint :
If you need to pass, this is Onprem PSC SSL thumbprint, you can get it using one of the ways posted here . I am going to write a post on how to get vCenter/PSC thumbprint using API itself, please stay tuned.

admin_groups: here you specify cloud administrator group(s).  Before configuring HLM linking (apart from HLM standard requirements that Emad has posted here) , identity source must be configured on both Onprem and VMC first and cloud admin groups must be given global permissions on both VCs.

HLM linking using python

By this time, I am sure you know everything about the API, now lets head on to python way of doing these things.

This script is available on my github repo HERE

[python]
# Author: Vikas Shitole
# Website: www.vThinkBeyondVM.com
# Product: VMware Cloud on AWS (VMC)
# Description: Python script to configure Hybrid Linked Mode (HLM) between Onprem and VMC VC
# How to setup vCenter REST API environment?: https://vthinkbeyondvm.com/getting-started-with-vcenter-server-rest-apis-using-python/</pre>
<pre>import requests
import json
import ssl
import atexit
import sys
import argparse
import getpass

from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

s=requests.Session()
s.verify=False

def get_args():
    """ Get arguments from CLI """
    parser = argparse.ArgumentParser(
        description='Arguments for HLM linking')

    parser.add_argument('-s', '--host',
                        required=True,
                        action='store',
                        help='VMC VC IP or FQDN')

    parser.add_argument('-u', '--user',
                        required=True,
                        action='store',
                        help='VMC VC username')

    parser.add_argument('-p', '--password',
                        required=False,
                        action='store',
                        help='VMC VC password:')

    parser.add_argument('-o', '--port',
                        type=int,
                        default=443,
                        action='store',
                        help='PSC port')

    parser.add_argument('-d', '--domainname',
                        type=str,
			default='vsphere.local',
                        action='store',
                        help='Onprem PSC domain name')

    parser.add_argument('-pu', '--pscuser',
                        required=False,
			default='Administrator@vsphere.local',
                        action='store',
                        help='Onprem PSC username')

    parser.add_argument('-pp', '--pscpass',
                        required=False,
                        action='store',
                        help='Onprem PSC password')

    parser.add_argument('-ph', '--pschost',
                        required=True,
                        action='store',
                        help='Onprem PSC host IP or FQDN')

    parser.add_argument('-a', '--admingroup',
                        required=False,
                        action='store',
                        default='yourcloudadmin@yourdomain.local',
                        help='Cloud admins group')	

    parser.add_argument('-pt', '--pscthumb',
                        required=True,
                        action='store',
                        help='Onprem PSC thumbprint')

    args = parser.parse_args()

    if not args.password:
        args.password = getpass.getpass(
            prompt='Enter VMC VC password:')

    if not args.pscpass:
        args.pscpass = getpass.getpass(
            prompt='Enter PSC password:')

    return args

args = get_args()
headers = {'content-type':'application/json'}
session_response= s.post('https://'+args.host+'/rest/com/vmware/cis/session',auth=(args.user,args.password))

if session_response.ok:
	print ("Session creation is successful")
else:
	print ("Session creation is failed, please check")
	quit()

payload = {
  "spec": {
    "port": args.port,
    "domain_name": args.domainname,
    "username": args.pscuser,
    "ssl_thumbprint": args.pscthumb,
    "admin_groups": [
      args.admingroup
    ],
    "password": args.pscpass,
    "psc_hostname": args.pschost
  }
}

json_payload = json.loads(json.dumps(payload))
json_response = s.post('https://'+args.host+'/rest/hvc/links',headers=headers,json=json_payload)
if json_response.ok:
	print ("HLM link is established")
else:
	print ("HLM link is NOT established, please check")
print (json_response)
print (json_response.text)

[/python]

Below is how you would run the script, take a look at the what parameters need to be passed. Each parameter is explained in above script as well.

I hope you enjoyed reading this post. Here is my new post on configuring HLM through vCenter cloud gateway using API.

Preparation tips for VMware Cloud on AWS Management Exam 2019

Couple of days back I passed “VMware Cloud on AWS Management Exam 2019 (5V0-31.19 )” and I thought, it is worth to share my preparation experience with you. Once we pass the exam, we get below skill badge from VMware. As per VMware, skill badges indicate developing competencies and a broad understanding of an individual’s capabilities and accomplishments.

Why I chose to write this exam?

Exploring more on VMware cloud on AWS has been on my radar since quite some time now. When I came to know about this VMware cloud on AWS management exam, I thought to use this opportunity to take my skill around VMC to the next level. Usually I like exams not to just get the badge or to be certified but I use them as motivation in my preparation/learning journey. As per me, what counts more is what we do during the moment we decide to write the exam and the moment we start attempting the exam. Preparation journey should be the focus. Exam and its objective/syllabus help us streamline or direct our learning properly.

Side note: There is vBlog voting for 2018 is open, if my blog or any other blog helped you, please go ahead and vote. Your vote would be motivation to generate even more quality content.

How to Prepare?

Below are the resources I used.

  1. Though there is no strict course/training requirement for this exam but VMware recommends a course i.e. VMware cloud on AWS: Deploy and Manage . I was lucky to undergo this course. It is fine if you could not complete this course from exam perspective. However, from learning perspective, any time formal course is really insightful.
  2.  I highly recommend to complete this Hands On Lab. Please do not underestimate this lab. Very helpful for exam as well as learning. I was able to access one of internal VMware cloud on AWS labs as well. It is fine if you do not have your own lab.
  3. I was really impressed on FAQs compiled on official site. Once you have some hands on experience, these FAQs are really worth to go through. It not only covers general FAQs but it also focuses on each VMC component/feature.
  4. Make sure you go through Exam preparation guide
  5. From exam perspective, it is good to just have basic idea on what AWS compute & storage options available. It is not required to undergo any course or training. If you want to learn more on AWS, I found this blog post interesting i.e. AWS in plain English . There are couple of pluralsight courses are useful as well (not required for exam itself).
  6. Yes, it is assumed that you have fundamental knowledge on vSphere, vSAN and NSX.

Exam format, level and scheduling?

If you take a look at Exam preparation guide , it is about VMware cloud on AWS fundamentals. Accordingly exam also was inline with sections listed in the guide. There are 30 questions to be solved within 45 min. All are multiple choice questions.  Once we pass this exam, we get “VMware Cloud on AWS – Software Defined Data Center 2019” badge. Passing score is 300. My score was 411. This exam is un-proctored i.e. you can attempt from your own laptop browser and once scheduled, you must begin the exam in 2 days time (i.e. you can attempt any time during those 2 days). Voucher I had received was valid for 2 attempts.

Additional VMware Cloud on AWS resources that I found useful for your further learning. 
  1. VMware official VMC documentation
  2. Follow William and Emad blogs , they write great VMC blog posts.
  3. VMware cloud official site. Please do not underestimate this site, tons of info available across all the VMware cloud services.

I hope this blog post would useful in your learning journey.

How to be vSphere Automation Rockstar: PowerCLI, SOAP and REST APIs

Last month, I got an opportunity to share my expertise around vSphere automation as part of VMUG bangalore. I was pumped up to present it since it was my first ever VMUG session.  Exciting news is all sessions are recorded and I thought it would be great to share it with you. If you want to get started with vSphere automation or take your understanding to the next level, I am sure you will find this session very useful. I personally felt how cool it would have been if I would have come across such informative but crisp session (just 41 min) when I started my vSphere automation journey.

Agenda : 

Why APIs are needed?

Getting started: PowerCLI

PowerCLI cmdlets and beyond

PowerCLI: key noteworthy points

Basics : vSphere SOAP based SDKs

Getting started: vSphere API reference, MOB & pyVmomi

Basics: vSphere REST based SDKs

Getting started: API explorer, python

Useful resources

Your critical comment/feedback is welcome. Besides my session, we had great technical sessions as follows. I would suggest to take a look at it as well.

  1. Insightful Keynote by Mohit Kataria, Sr. Product Manager, CMBU, VMware.
  2. vSphere and vRA troubleshooting with use cases by Abhilash & Ravi
  3. vSAN use cases and troubleshooting by Cedric Rajendran & Hareesh

I would like to thank VMUG bangaluru organizing team and our VMUG leaders Sujith and Sumanth for giving this opportunity.

VMworld US 2018: My VMware {code} power sessions experience

VMworld 2018 US was my first VMworld at Las Vegas and without a doubt, it was really exciting & insightful experience for me.  In this post, I am going to share my experience as VMware {code} power session speaker & will share youtube , facebook stream recording for the same. In addition, I will also brief on how was the excitement at VMworld as blogger.

1. Experience as power session speaker.

Beauty of these sessions was that all sessions were exclusively about coding across VMware, CICD, DevOps, open-source, hybrid cloud, cloud-native & block-chain etc.  I do not have any doubt that this track will become one of the famous VMworld tracks. Below were my power sessions.

You could see focus of all my sessions was around vSphere Automation (SOAP, REST & CLI ) , the area I am passionate about. Personally it was really thrilling experience since challenge was to make relatively complex topic such as vSphere Automation simplified and cover within stipulated time.  More exciting was that these sessions were being live streamed on facebook.  My objective was to make sure content I am presenting is simplified as much as possible that anyone will be able to understand with little or no knowledge.  After presenting these sessions, I felt that efforts put into preparation phase, multiple mock presentations were really worth. Based on the number of people attended and discussion on queries with customers, I could say that sessions were well received. Below is the list of my sessions with youtube and facebook live stream recording. I would highly recommend you to listen to all of these sessions. I am sure they will power you as well.  Your critical feedback is welcome.

2. VMware {code} power sessions

1] Closer look at vSphere Programming and CLI interfaces. 

Agenda was as follows:

  • Why APIs are needed?
  •  vSphere SOAP based SDKs
  • Getting started: vSphere API reference, MOB & pyVmomi
  • vSphere REST based SDKs
  • Getting started: API explorer
  • vSphere CLI interfaces
  • Getting started: PowerCLI
  • Useful resources

2] Overview on “Deploy & Manage vCenter server HA” using vSphere APIs

Agenda was as follows:

  • What is vCenter HA?
  •  vSphere API basics
  • vCenter HA managed objects
  • Getting started with pyVmomi
  • Sample example: Getting vCenter HA health
  • Useful resources

3] Be a ” vCenter REST API” rockstar using python

Agenda was as follows:

  • Key HTTP methods
  •  vCenter features supported @REST
  • What is api-explorer and how to use it?
  • Getting started with REST APIs using python
  • Sample example: Getting VMs and powering them
  • Useful resources

Good news is, I do have blog post associated with this content here. I would highly recommend you to read it. Watch  it on below facebook stream at 3:47:59.

Note: I would have liked to make these sessions as comprehensive as possible but in an attempt to make it simplified and due to time constraints, I had to cut short. Your feedback is welcome. In addition, I am working on uploading my slide deck , please stay tuned.

3. Excitement as VMworld Blogger

You can not imagine how proud I felt while wearing this VMworld badge as blogger.

It is absolute honor to be one among this VMworld bloggers list and being part of VMworld as blogger. Community team had setup nice blogger lounge for bloggers.

Inside general session theater, special seats with “blogger label” were made available as well. was not that extra super cool?

Most heartening moment

Last time at VMworld 2017 Barcelona , I was roaming around, not many people were knowing me. This time, I could see many people from vCommunity were knowing me, recognizing my face, saying “Hi”.  Beyond that, it was great feeling when VMware users came forward to meet me and thanked for the content I generated so far.

I would like to take this opportunity to thank  VMware community team (Eric , Elsa, Kripa, Julia ) for putting great show @power sessions and bloggers space.