Skip to content

Instantly share code, notes, and snippets.

View sneal's full-sized avatar

Shawn Neal sneal

View GitHub Profile
This topic describes how to migrate your VMware Tanzu Operations Manager (Ops Manager) installation to a new vSphere datastore.
Prerequisites
Both the new and existing vSphere datastores must reside in the same data center.
To avoid service disruption, VMware recommends that you configure your overall Ops Manager deployment for high availability (HA). In addition, check for configurations necessary to achieve HA in each of your installed product tiles.
If your environment has any single points of failure, service might be disrupted as a result of the migration.
Before You Begin

This PowerCLI snippet can be used to find all the BOSH VMs connected to a specific datastore and then disconnect the CD-ROM to avoid vMotion or SDRS errors.

  1. Open a PowerCLI session and login to the appropriate vCenter using the Connect-VIServer command.
  2. Copy the below eject-iso.ps1 snippet locally
  3. Change the datastore name, from dsname to whatever your datastore name is.
  4. Execute the script

The final output table will contain all the VMs processed and list out the updated ISOPaths which should be empty at this point.

NOTE The script only modifies BOSH VMs, i.e. those with mounted env.iso files, however the output will display all VMs on the specified datastore and any other non-BOSH ISOs mounted.

@sneal
sneal / README.md
Created July 12, 2023 20:31
BOSH datastore cluster - datastore evacuation

This topic describes how to change your VMware Tanzu Operations Manager (Ops Manager) installation's underlying vSphere datastore clusters.

Before You Begin

The following sections describe the steps you can do prior to the migration.

Step 1: Back Up Your Environment

Ensure that your Ops Manager environment is fully backed up.

For more information about how to back up Ops Manager, see Backing Up Deployments.

@sneal
sneal / orderfiles.py
Created June 5, 2023 04:42
Script to rename all GoPro generated media in a directory to an ordinal number series (i.e. human understandable)
import sys, os
from pathlib import Path
from operator import itemgetter
p = ''.join(sys.argv[1:])
if len(p) == 0:
print('you must give a fully qualified directory path to process')
exit()
files = list(Path(p).glob('*.MP4'))
@sneal
sneal / README.md
Created May 11, 2023 20:51
vsphereVolume manual reattach

Using Pre-Existing Persistent Disks as PersistentVolumes

This explains how to create a PersistentVolume using existing (vsphereVolume) persistent disks populated with data, and how to use the PersistentVolume in a Pod.

Create Nginx Pod With PV

Create a storage class in the nginx namespace, here we're using the obsolete in-tree VCP provisioner:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: vcp-storage
@sneal
sneal / evc.patch
Last active May 13, 2023 14:53
Intel Sandy-Bridge EVC patch for BOSH
diff --git vsphere_cpi/lib/cloud/vsphere/resources/vm.rb vsphere_cpi/lib/cloud/vsphere/resources/vm.rb
index 69cb1a56..8e944a75 100644
--- vsphere_cpi/lib/cloud/vsphere/resources/vm.rb
+++ vsphere_cpi/lib/cloud/vsphere/resources/vm.rb
@@ -232,6 +232,10 @@ module VSphereCloud
@client.upgrade_vm_virtual_hardware(@mob)
end
+ def set_evc_mode
+ @client.apply_evc_mode(@mob)
@sneal
sneal / main.go
Created August 11, 2022 21:48
Set vSphere EVC mode on a VM using govmomi
package main
import (
"context"
"fmt"
"github.com/vmware/govmomi"
"github.com/vmware/govmomi/find"
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/property"
"github.com/vmware/govmomi/session"
@sneal
sneal / readme.md
Created June 10, 2022 22:35
Match HWC PID to App

Map App IDs to App Instances IDs for Windows cell

Find all the app instances running on the Windows Diego cell your interested in. You'll need to SSH into a regular Linux Diego cell to be able to run the cfdot command. Change the below to match the IP address of the Windows Diego cell you're inspecting.

cfdot actual-lrps | grep "192.168.2.20" | jq
@sneal
sneal / Set-VMOvfProperty.ps1
Created May 23, 2022 22:45
Add or edit a running vApp property, like a BOSH disk hint
Function Set-VMOvfProperty {
<#
.NOTES
===========================================================================
Created by: William Lam, Shawn Neal
Organization: VMware
Blog: www.williamlam.com, [email protected]
Twitter: @lamw, @snealnet
===========================================================================
.DESCRIPTION
@sneal
sneal / fix-ruby.sh
Last active February 10, 2022 15:25
vSphere CPI - Fix Ruby Compilation on Mac
#!/usr/bin/env bash
brew install [email protected]
mkdir -p /usr/local/opt/openssl/lib/
ln -s /usr/local/opt/[email protected]/lib/libcrypto.1.1.dylib /usr/local/opt/openssl/lib/
ln -s /usr/local/opt/[email protected]/lib/libssl.1.1.dylib /usr/local/opt/openssl/lib/
pushd /usr/local/opt/openssl/lib/
ln -s libssl.1.1.dylib libssl.dylib
ln -s libcrypto.1.1.dylib libcrypto.dylib
popd