Tuesday, January 31, 2012

Tuesday, January 24, 2012

Host profiles - how to remove irrelavant config check

Host profiles create sample config of the ESXi server, and you can apply that
to all nodes in that cluster.

http://pubs.vmware.com/vsphere-50/topic/com.vmware.ICbase/PDF/vsphere-esxi-vcenter-server-50-host-profiles-guide.pdf


http://www.vmware.com/files/pdf/techpaper/VMW-Host-Profiles-Tech-Overview.pdf

Here I can right click on iqn on SWiscsi to remove the non-relevant checks.



I remove it from the bottom. Then I apply this profile to the cluster.

For eg.
Option Syslog.global.logDir doesn't match the specified criteria

Original config was:



Changed to the following to prevent error:




______________________________________________________________________________________
PS C:\Users\Nutanix01> Get-VMhostprofile

Name Description ReferenceHostId
---- ----------- ---------------
esx5_host_profile Base ESX5 Host Profile HostSystem-host-9
esxi3 HostSystem-host-107

PS C:\Users\Nutanix01> Get-VMhostprofile esxi3 |fl

ServerId : /VIServer=root@ip/
Server : ip
Description :
ReferenceHostId : HostSystem-host-107
ReferenceHost : ip
Name : esxi3
ExtensionData : VMware.Vim.HostProfile
Id : HostProfile-hostprofile-2001
Uid : /VIServer=root@ip:443/VMHostProfile=HostProfile-hostprofile-2001/


Test-VMHostProfileCompliance -Profile esxi3

PS C:\Users\Nutanix01> Test-VMHostProfileCompliance -Profile esxi3

VMHostId VMHostProf IncomplianceElementList
ileId
-------- ---------- -----------------------
HostSys... HostPro... {:Host is unavailable for checking compliance.}
HostSys... HostPro... {network.hostPortGroup["key-vim-profile-host-HostPortgrou...
HostSys... HostPro... {storage.psa_psaProfile_PluggableStorageArchitectureProfi...
HostSys... HostPro... {storage.psa_psaProfile_PluggableStorageArchitectureProfi...


Sample to create a hostprofile

PS C:\Users\Nutanix01> Get-VMHost Name |New-VMHostProfile -Name "Server4"

Name Description ReferenceHostId
---- ----------- ---------------
Server4 HostSystem-host-65


PS C:\Users\Nutanix01> Get-VMHostProfile -ReferenceHost ip

Name Description ReferenceHostId
---- ----------- ---------------
Server4 HostSystem-host-65

PS C:\Users\Nutanix01> Get-VMHost ip |Apply-VMHostProfile -AssociateOnly -Profile Server4



new-vm -Name WinAtlas2 -VMhost 172.ip -Template Atlas_Windows_Template -Datastore Atlas-NTNX-datastore

Friday, January 20, 2012

Poweroff Certain VMs

get-VM -Location *Proteus* | where { $_.name -ne "Proteus-C1" -And $_.name -ne "Proteus-C2" -And $_.name -ne "Proteus-C3" -And $_.name -ne "Proteus-C4" } | Stop-VM -Confirm:$false

Stop-VM (get-VM AlWinDows* |where {$_.'PowerState' -eq "PoweredOn"}) -RunAsync -Confirm:$false

$global:testIterations = 75
for($i=1; $i -le $global:testIterations; $i++){
Stop-VM (get-VM *Win* -Location Atlas-Cluster |where {$_.'PowerState' -eq "PoweredOn"}) -RunAsync -Confirm:$false
Start-Sleep -Seconds 100
Start-VM (get-VM *Win* -Location Atlas-Cluster |where {$_.'PowerState' -ne "PoweredOn"}) -RunAsync -Confirm:$false
}


get VMHost  10.2.8.51| get-VM Windows7-*| where {$_.'PowerState' -eq "PoweredOn"} | Stop-VM

Thursday, January 19, 2012

Collection of ESXi commands to manage VMs

1. esxcli vms vm list ( esxcli vm process list) - lists VM and the world id, you can kill, send NMI mask using vm-support command.(esxcli vm process kill ,
2. vm-support -V, vm-support -x ,vm-support -X - captures screenshot,etc.,
vmdumper
vmdumper: [options]

3.vim-cmd /vmsvc/getallvms
4.vim-cmd /vmsvc/unregister
5. vim-cmd /solo/register /path/to/file.vmx
6. vim-cmd /vmsvc/power.getstate
7.vim-cmd /vmsvc/power.off
8.vim-cmd /vmsvc/power.on
9. vim-cmd vmsvc/device.getdevices $id|egrep -i "vmdk|compat"
10. vim-cmd vmsvc/get.config
11. vim-cmd vmsvc/get.datastores 35
12.vim-cmd vmsvc/device.diskaddexisting
13. vim-cmd hostsvc/datastore/summary datastore2
14. vim-cmd hostsvc/refresh_services
15. vim-cmd vmsvc/message
16. vim-cmd vmsvc/tools.install

To find the ip addresses allocated

for vm in `vim-cmd vmsvc/getallvms | awk '{print $1}'|grep -v -i vmid`; do vim-cmd vmsvc/get.summary $vm |grep -i ipAdd;done

I used to find a duplicate ip....

Monday, January 16, 2012

Vcenter Appliance Troubleshooting

VMware vCenter Server Appliance 5.0 GA with embedded DB2 database fails

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2006812

Interacting with db2:
http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=2004506&sliceId=1&docTypeID=DT_KB_1_1&dialogID=278854278&stateId=1%200%20278856044
The vCenter Server service fails to start after the service was stopped or restarted when using DB2 database

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1021581

vcenter-2:/ # su - db2inst1
db2inst1@vcenter-2:~> db2start
SQL1026N The database manager is already active.
db2inst1@vcenter-2:~> db2ls

Install Path Level Fix Pack Special Install Number I nstall Date Installer UID
-------------------------------------------------------------------------------- -------------------------------------
/opt/db2/v9.7.2 9.7.0.2 2 Tu e Aug 23 17:54:41 2011 UTC 0
db2inst1@vcenter-2:~> db2ilist
db2inst1db2 => connect to VCDB
db2 => set schema vc



db2inst1@vcenter-2:~> db2 get database config for vcdb | grep LOG
Catalog cache size (4KB) (CATALOGCACHE_SZ) = 300
Log buffer size (4KB) (LOGBUFSZ) = 256
Log file size (4KB) (LOGFILSIZ) = 8192
Number of primary log files (LOGPRIMARY) = 16
Number of secondary log files (LOGSECOND) = 112
Changed path to log files (NEWLOGPATH) =
Path to log files = /storage/db/db2/home/ db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR/
Overflow log path (OVERFLOWLOGPATH) =
Mirror log path (MIRRORLOGPATH) =
Block log on disk full (BLK_LOG_DSK_FUL) = NO
Block non logged operations (BLOCKNONLOGGED) = NO
Percent max primary log space by transaction (MAX_LOG) = 0
Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0
Log retain for recovery enabled (LOGRETAIN) = OFF
First log archive method (LOGARCHMETH1) = OFF
Options for logarchmeth1 (LOGARCHOPT1) =
Second log archive method (LOGARCHMETH2) = OFF
Options for logarchmeth2 (LOGARCHOPT2) =
Log pages during index build (LOGINDEXBUILD) = OFF


db2 => list tables for all to list all tables
=====================================================================================
Error:(vpxa.log)
2012-01-16T15:14:43.269-08:00 [7FFFF3B09700 error 'Default'] [Vdb::LockRepositoryHelper] SQLExecDirect failed: 57011:-438:ODBC error: (57011) - [IBM][CLI Driver][DB2/LINUXX8664] SQL0438N Application raised error or warning with diagnostic text: "Error deleting from VPX_SESSIONL". SQLSTATE=57011
-->
2012-01-16T15:14:43.271-08:00 [7FFFF3B09700 error 'Default'] Unable to get exclusive access to vCenter repository. Please check if another vCenter instance is running against the same database schema.
2012-01-16T15:14:43.275-08:00 [7FFFF3B09700 error 'Default'] Unhandled exception

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1021581

We followed the steps, it seems working now. But we need to monitor..


vcenter-2:/ # su - db2inst1
db2inst1@vcenter-2:~> db2start
SQL1026N The database manager is already active.
db2inst1@vcenter-2:~> db2ls

Install Path Level Fix Pack Special Install Number I nstall Date Installer UID
-------------------------------------------------------------------------------- -------------------------------------
/opt/db2/v9.7.2 9.7.0.2 2 Tu e Aug 23 17:54:41 2011 UTC 0
db2inst1@vcenter-2:~> db2ilist
db2inst1db2 => connect to VCDB
db2 => set schema vc
db2inst1@vcenter-2:~> db2 get database config for vcdb | grep LOG

Catalog cache size (4KB) (CATALOGCACHE_SZ) = 300
Log buffer size (4KB) (LOGBUFSZ) = 256
Log file size (4KB) (LOGFILSIZ) = 8192
Number of primary log files (LOGPRIMARY) = 16
Number of secondary log files (LOGSECOND) = 112
Changed path to log files (NEWLOGPATH) =

Path to log files = /storage/db/db2/home/ db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR/
Overflow log path (OVERFLOWLOGPATH) =
Mirror log path (MIRRORLOGPATH) =
Block log on disk full (BLK_LOG_DSK_FUL) = NO
Block non logged operations (BLOCKNONLOGGED) = NO
Percent max primary log space by transaction (MAX_LOG) = 0
Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0
Log retain for recovery enabled (LOGRETAIN) = OFF
First log archive method (LOGARCHMETH1) = OFF
Options for logarchmeth1 (LOGARCHOPT1) =
Second log archive method (LOGARCHMETH2) = OFF
Options for logarchmeth2 (LOGARCHOPT2) =
Log pages during index build (LOGINDEXBUILD) = OFF


db2 => select * from VPX_SESSIONLOCK

APPL_ID
--------------------------------------------------------------------------------------------------------------------------------
127.0.0.1.52263.120117000832


db2 => delete from VPX_SESSIONLOCK
SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a
query is an empty table. SQLSTATE=02000

Verifying the group
db2inst1@vcenter-5:~> cat /etc/group |grep -i db
DBSYSMON:!:111:vc

db2inst1@vcenter-5:~> cat /etc/passwd|grep vc
vc:x:1004:100::/opt/db2/home//vc:/bin/false

Restarting the service.

vcenter-5:~ # service vmware-vpxd status

vmware-vpxd is stopped
tomcat is running

vcenter-5:~ # service vmware-vpxd start

Waiting for embedded DB2 database to startup: .success
Cleaning session lock table: success
Verifying EULA acceptance: success

Shutting down ldap-server..done
Starting ldap-server

Which controller VM is hosting the shared lun ?

for ips in $SVM_IPS; do echo "SVM:$ips"; echo "----------------"; curl http://$ips:2009 2>/dev/null | html2text -width 500 -ascii| sed -n "/Hosted VDisks/,/Extent Store/p" |egrep -v "Hosted VDisks|Extent Store|dedup usage|VDisk Id|Fragments"| awk '{print $2}'; echo; done


SVM:172.16.13.21
----------------
amazon-build-home
VS5TEST-SHARED-DS-01
PDS-TEST
shared_data7
SPTest.snapshot
NFS-laura
NFS-laura2
ubu-stress-fc-proteus4-3-vdisk-4f03e93f-0
laura-ubuntu-clone
ubu-stress-fc-proteus4-0-vdisk-4f03e93f-1
ubu-stress-fc-proteus4-1-vdisk-4f03e93f-1
ubu-nfs-disk1
nfs-laura
ubu-stress-fc-proteus4-2-vdisk-4f03e93f-1
ubu-stress-fc-proteus4-4-vdisk-4f03e93f-1
vdisk-jenkins-home
vdisk-jenkins-var
NFS-rdm-root
NFS-rdm-disk-3
NFS-rdm-disk-4
shared_datastore0
NFS-rdm-disk-2


SVM:172.16.13.22
----------------
VS5TEST-SHARED-DS-02
VS5TEST-SHARED-DS-03
laura-ubuntu
ubu-nfs-proteus1-0-vdisk-4ef58401-0
shared_datastore1


SVM:172.16.13.23
----------------
jenkins-home2
jenkins-dogfood
jenkins-var2
28
ubu-stress-test-0-vdisk-4eea1dcd-0


SVM:172.16.13.24
----------------
ubu-stress-fc-proteus4-2-vdisk-4f03e93f-0
VS5TEST-SHARED-DS-04
ubu-stress-fc-proteus4-3-vdisk-4f03e93f-1
shared_datastore2