ESX 3.5 HOW TO obtain storage information from vimsh

In case it is not apparent already, vimsh is something you can invoke on an ESX 3.5.x environment, in order to grab some sometimes necessary storage information.

One particular problem that was outstanding for some time was finding a way to read /proc/vmware/scsi/vmhba<x>/* content. Specifically, the SCSI/LUN ID was sought-after by some TSEs and customers, which are unavailable due to the relevant /proc/vmware/scsi/ nodes being omitted on ESX 3.5.x.

Provided is a simple line to grab the output using vimsh:

“vimsh -n -e hostsvc/storage/topology_info &> test.txt”

It will in this order:

–          Run vimsh in non-interactive mode with the “n” switch.

–          Using the “e” switch, will run “hostsvc/storage/topology_info” for you.

–          Will suppress STD_OUT with the “&” sign before the output redirector (benign “file not found” error shows up, may as well ignore).

–          Output the content to the test.txt file.

Obviously the above is run in BASH / the COS.

If you want a more general overview of storage, replace “topology_info” with “info”.

When running vimsh, remember that you can use “Tab” to list the available files/commands and categories. Content of a file/command is displayed by invoking it directly. We effectively execute hostsvc/storage/topology_info to list this information. Hostsvc and storage are directories or categories.

There is a wealth of information contained and accessed by this utility. I don’t believe we want customers to play around with it, but I imagine you may run into cases where they need the SCSI information for their SAN teams. The above should help a bit.

Note that vsish acts differently, and contained values are obtained using “get”.

Good luck, hope it helps some of you out there still confused.

list of vmkernel errors

You can get this from running: vmkerrcode -l

VMK_ReturnStatus table for VMware ESX Server, Build #64607
Name Dec Hex errno equiv Description
——————————————————————————-
VMK_OK 0 0 OK Success
VMK_FAILURE 195887105 0xbad0001 EINVAL Failure
VMK_WOULD_BLOCK 195887106 0xbad0002 EAGAIN Would block
VMK_NOT_FOUND 195887107 0xbad0003 ENOENT Not found
VMK_BUSY 195887108 0xbad0004 EBUSY Busy
VMK_EXISTS 195887109 0xbad0005 EEXIST Already exists
VMK_LIMIT_EXCEEDED 195887110 0xbad0006 EFBIG Limit exceeded
VMK_BAD_PARAM 195887111 0xbad0007 EINVAL Bad parameter
VMK_METADATA_READ_ERROR 195887112 0xbad0008 EIO Metadata read error
VMK_METADATA_WRITE_ERROR 195887113 0xbad0009 EIO Metadata write error
VMK_IO_ERROR 195887114 0xbad000a EIO I/O error
VMK_READ_ERROR 195887115 0xbad000b EIO Read error
VMK_WRITE_ERROR 195887116 0xbad000c EIO Write error
VMK_INVALID_NAME 195887117 0xbad000d ENAMETOOLONG Invalid name
VMK_INVALID_HANDLE 195887118 0xbad000e EBADF Invalid handle
VMK_INVALID_ADAPTER 195887119 0xbad000f ENODEV No such SCSI adapter
VMK_INVALID_TARGET 195887120 0xbad0010 ENODEV No such target on adapter
VMK_INVALID_PARTITION 195887121 0xbad0011 ENXIO No such partition on target
VMK_INVALID_FS 195887122 0xbad0012 ENXIO No filesystem on the device
VMK_INVALID_MEMMAP 195887123 0xbad0013 EFAULT Memory map mismatch
VMK_NO_MEMORY 195887124 0xbad0014 ENOMEM Out of memory
VMK_NO_MEMORY_RETRY 195887125 0xbad0015 ENOMEM Out of memory (ok to retry)
VMK_NO_RESOURCES 195887126 0xbad0016 ENOMEM Out of resources
VMK_NO_FREE_HANDLES 195887127 0xbad0017 EMFILE No free handles
VMK_NUM_HANDLES_EXCEEDED 195887128 0xbad0018 ENFILE Exceeded maximum number of allowed handles
VMK_DEPRECATED_NO_FREE_PTR_BLOCKS195887129 0xbad0019 ENOSPC No free pointer blocks (deprecated)
VMK_DEPRECATED_NO_FREE_DATA_BLOCKS195887130 0xbad001a ENOSPC No free data blocks (deprecated)
VMK_CORRUPT_REDOLOG 195887131 0xbad001b EBADF Corrupt RedoLog
VMK_STATUS_PENDING 195887132 0xbad001c EAGAIN Status pending
VMK_STATUS_FREE 195887133 0xbad001d EAGAIN Status free
VMK_UNSUPPORTED_CPU 195887134 0xbad001e ENODEV Unsupported CPU
VMK_NOT_SUPPORTED 195887135 0xbad001f ENOSYS Not supported
VMK_TIMEOUT 195887136 0xbad0020 ETIMEDOUT Timeout
VMK_READ_ONLY 195887137 0xbad0021 EROFS Read only
VMK_RESERVATION_CONFLICT 195887138 0xbad0022 EAGAIN SCSI reservation conflict
VMK_FS_LOCKED 195887139 0xbad0023 EADDRINUSE File system locked
VMK_NOT_ENOUGH_SLOTS 195887140 0xbad0024 ENFILE Out of slots
VMK_INVALID_ADDRESS 195887141 0xbad0025 EFAULT Invalid address
VMK_NOT_SHARED 195887142 0xbad0026 ENOMEM Not shared
VMK_SHARED 195887143 0xbad0027 ENOMEM Page is shared
VMK_KSEG_PAIR_FLUSHED 195887144 0xbad0028 ENOMEM Kseg pair flushed
VMK_MAX_ASYNCIO_PENDING 195887145 0xbad0029 ENOMEM Max async I/O requests pending
VMK_VERSION_MISMATCH_MINOR 195887146 0xbad002a ENOSYS Minor version mismatch
VMK_VERSION_MISMATCH_MAJOR 195887147 0xbad002b ENOSYS Major version mismatch
VMK_IS_CONNECTED 195887148 0xbad002c EINVAL Already connected
VMK_IS_DISCONNECTED 195887149 0xbad002d ENOTCONN Already disconnected
VMK_IS_ENABLED 195887150 0xbad002e EINVAL Already enabled
VMK_IS_DISABLED 195887151 0xbad002f EINVAL Already disabled
VMK_NOT_INITIALIZED 195887152 0xbad0030 EINVAL Not initialized
VMK_WAIT_INTERRUPTED 195887153 0xbad0031 EINTR Wait interrupted
VMK_NAME_TOO_LONG 195887154 0xbad0032 ENAMETOOLONG Name too long
VMK_MISSING_FS_PES 195887155 0xbad0033 ENOTDIR VMFS volume missing physical extents
VMK_NICTEAMING_VALID_MASTER 195887156 0xbad0034 EINVAL NIC teaming master valid
VMK_NICTEAMING_SLAVE 195887157 0xbad0035 EEXIST NIC teaming slave
VMK_NICTEAMING_REGULAR_VMNIC 195887158 0xbad0036 EINVAL NIC teaming regular VMNIC
VMK_ABORT_NOT_RUNNING 195887159 0xbad0037 ECANCELED Abort not running
VMK_NOT_READY 195887160 0xbad0038 EIO Not ready
VMK_CHECKSUM_MISMATCH 195887161 0xbad0039 EIO Checksum mismatch
VMK_VLAN_NO_HW_ACCEL 195887162 0xbad003a EINVAL VLan HW Acceleration not supported
VMK_NO_VLAN_SUPPORT 195887163 0xbad003b EOPNOTSUPP VLan is not supported in vmkernel
VMK_NOT_VLAN_HANDLE 195887164 0xbad003c EINVAL Not a VLan handle
VMK_BAD_VLANID 195887165 0xbad003d EBADF Couldn’t retrieve VLan id
VMK_MIG_PROTO_ERROR 195887166 0xbad003e EINVAL Migration protocol error
VMK_NO_CONNECT 195887167 0xbad003f EIO No connection
VMK_SEGMENT_OVERLAP 195887168 0xbad0040 EINVAL Segment overlap
VMK_BAD_MPS 195887169 0xbad0041 EIO Error parsing MPS Table
VMK_BAD_ACPI 195887170 0xbad0042 EIO Error parsing ACPI Table
VMK_RESUME_ERROR 195887171 0xbad0043 EIO Failed to resume VM
VMK_NO_ADDRESS_SPACE 195887172 0xbad0044 ENOMEM Insufficient address space for operation
VMK_BAD_ADDR_RANGE 195887173 0xbad0045 EINVAL Bad address range
VMK_ENETDOWN 195887174 0xbad0046 ENETDOWN Network is down
VMK_ENETUNREACH 195887175 0xbad0047 ENETUNREACH Network unreachable
VMK_ENETRESET 195887176 0xbad0048 ENETRESET Network dropped connection on reset
VMK_ECONNABORTED 195887177 0xbad0049 ECONNABORTED Software caused connection abort
VMK_ECONNRESET 195887178 0xbad004a ECONNRESET Connection reset by peer
VMK_ENOTCONN 195887179 0xbad004b ENOTCONN Socket is not connected
VMK_ESHUTDOWN 195887180 0xbad004c ESHUTDOWN Can’t send after socket shutdown
VMK_ETOOMANYREFS 195887181 0xbad004d ETOOMANYREFS Too many references: can’t splice
VMK_ECONNREFUSED 195887182 0xbad004e ECONNREFUSED Connection refused
VMK_EHOSTDOWN 195887183 0xbad004f EHOSTDOWN Host is down
VMK_EHOSTUNREACH 195887184 0xbad0050 EHOSTUNREACH No route to host
VMK_EADDRINUSE 195887185 0xbad0051 EADDRINUSE Address already in use
VMK_BROKEN_PIPE 195887186 0xbad0052 EPIPE Broken pipe
VMK_NOT_A_DIRECTORY 195887187 0xbad0053 ENOTDIR Not a directory
VMK_IS_A_DIRECTORY 195887188 0xbad0054 EISDIR Is a directory
VMK_NOT_EMPTY 195887189 0xbad0055 ENOTEMPTY Directory not empty
VMK_NOT_IMPLEMENTED 195887190 0xbad0056 ENOSYS Not implemented
VMK_NO_SIGNAL_HANDLER 195887191 0xbad0057 EINVAL No signal handler
VMK_FATAL_SIGNAL_BLOCKED 195887192 0xbad0058 EINVAL Fatal signal blocked
VMK_NO_ACCESS 195887193 0xbad0059 EACCES Permission denied
VMK_NO_PERMISSION 195887194 0xbad005a EPERM Operation not permitted
VMK_UNDEFINED_SYSCALL 195887195 0xbad005b ENOSYS Undefined syscall
VMK_RESULT_TOO_LARGE 195887196 0xbad005c ERANGE Result too large
VMK_VLAN_FILTERED 195887197 0xbad005d ERANGE Pkts dropped because of VLAN (support) mismatch
VMK_BAD_EXCFRAME 195887198 0xbad005e EFAULT Unsafe exception frame
VMK_MODULE_NOT_LOADED 195887199 0xbad005f ENODEV Necessary module isn’t loaded
VMK_NO_SUCH_ZOMBIE 195887200 0xbad0060 ECHILD No dead world by that name
VMK_NO_SUCH_CARTEL 195887201 0xbad0061 ESRCH No cartel by that name
VMK_IS_A_SYMLINK 195887202 0xbad0062 ELOOP Is a symbolic link
VMK_CROSS_DEVICE_LINK 195887203 0xbad0063 EXDEV Cross-device link
VMK_NOT_A_SOCKET 195887204 0xbad0064 ENOTSOCK Not a socket
VMK_ILLEGAL_SEEK 195887205 0xbad0065 ESPIPE Illegal seek
VMK_ADDRFAM_UNSUPP 195887206 0xbad0066 EAFNOSUPPORT Unsupported address family
VMK_ALREADY_CONNECTED 195887207 0xbad0067 EISCONN Already connected
VMK_DEATH_PENDING 195887208 0xbad0068 ENOENT World is marked for death
VMK_NO_CELL_ASSIGNMENT 195887209 0xbad0069 EINVAL No valid scheduler cell assignment
VMK_CPU_MIN_INVALID 195887210 0xbad006a EINVAL Invalid cpu min
VMK_CPU_MINLIMIT_INVALID 195887211 0xbad006b EINVAL Invalid cpu minLimit
VMK_CPU_MAX_INVALID 195887212 0xbad006c EINVAL Invalid cpu max
VMK_CPU_SHARES_INVALID 195887213 0xbad006d EINVAL Invalid cpu shares
VMK_CPU_MIN_OVERFLOW 195887214 0xbad006e EINVAL Cpu min outside valid range
VMK_CPU_MINLIMIT_OVERFLOW 195887215 0xbad006f EINVAL Cpu minLimit outside valid range
VMK_CPU_MAX_OVERFLOW 195887216 0xbad0070 EINVAL Cpu max outside valid range
VMK_CPU_MIN_GT_MINLIMIT 195887217 0xbad0071 EINVAL Cpu min exceeds minLimit
VMK_CPU_MIN_GT_MAX 195887218 0xbad0072 EINVAL Cpu min exceeds max
VMK_CPU_MINLIMIT_LT_RESERVED 195887219 0xbad0073 ENOSPC Cpu minLimit less than cpu already reserved by children
VMK_CPU_MAX_LT_RESERVED 195887220 0xbad0074 ENOSPC Cpu max less than cpu already reserved by children
VMK_CPU_ADMIT_FAILED 195887221 0xbad0075 ENOSPC Admission check failed for cpu resource
VMK_MEM_MIN_INVALID 195887222 0xbad0076 EINVAL Invalid memory min
VMK_MEM_MINLIMIT_INVALID 195887223 0xbad0077 EINVAL Invalid memory minLimit
VMK_MEM_MAX_INVALID 195887224 0xbad0078 EINVAL Invalid memory max
VMK_MEM_MIN_OVERFLOW 195887225 0xbad0079 EINVAL Memory min outside valid range
VMK_MEM_MINLIMIT_OVERFLOW 195887226 0xbad007a EINVAL Memory minLimit outside valid range
VMK_MEM_MAX_OVERFLOW 195887227 0xbad007b EINVAL Memory max outside valid range
VMK_MEM_MIN_GT_MINLIMIT 195887228 0xbad007c EINVAL Memory min exceeds minLimit
VMK_MEM_MIN_GT_MAX 195887229 0xbad007d EINVAL Memory min exceeds max
VMK_MEM_MINLIMIT_LT_RESERVED 195887230 0xbad007e ENOSPC Memory minLimit less than memory already reserved by children
VMK_MEM_MAX_LT_RESERVED 195887231 0xbad007f ENOSPC Memory max less than memory already reserved by children
VMK_MEM_ADMIT_FAILED 195887232 0xbad0080 ENOSPC Admission check failed for memory resource
VMK_NO_SWAP_FILE 195887233 0xbad0081 ENOENT No swap file
VMK_BAD_PARAM_COUNT 195887234 0xbad0082 EINVAL Bad parameter count
VMK_BAD_PARAM_TYPE 195887235 0xbad0083 EINVAL Bad parameter type
VMK_UNMAP_RETRY 195887236 0xbad0084 ENOMEM Dueling unmaps (ok to retry)
VMK_INVALID_IOCTL 195887237 0xbad0085 ENOTTY Inappropriate ioctl for device
VMK_MAPFAULT_RETRY 195887238 0xbad0086 EBUSY Mmap changed under page fault (ok to retry)
VMK_EINPROGRESS 195887239 0xbad0087 EINPROGRESS Operation now in progress
VMK_ADDR_UNMAPPED 195887240 0xbad0088 EFAULT Address temporarily unmapped
VMK_INVALID_BUDDY_TYPE 195887241 0xbad0089 ENOMEM Invalid buddy type
VMK_LPAGE_INFO_NOT_FOUND 195887242 0xbad008a ENOMEM Large page info not found
VMK_LPAGE_INFO_INVALID 195887243 0xbad008b EINVAL Invalid large page info
VMK_SNAPSHOT_DEV 195887244 0xbad008c EIO SCSI LUN is in snapshot state
VMK_IN_TRANSITION 195887245 0xbad008d EIO SCSI LUN is in transition
VMK_TXN_FULL 195887246 0xbad008e ENOSPC Transaction ran out of lock space or log space
VMK_LOCK_NOT_FREE 195887247 0xbad008f EBUSY Lock was not free
VMK_NUM_FILES_EXCEEDED 195887248 0xbad0090 ENOSPC Exceed maximum number of files on the filesystem
VMK_MIGRATE_VMX_FAILURE 195887249 0xbad0091 EINVAL Migration determined a failure by the VMX
VMK_VSI_LIST_OVERFLOW 195887250 0xbad0092 EFBIG VSI GetList handler overflow
VMK_INVALID_WORLD 195887251 0xbad0093 EINVAL Invalid world
VMK_INVALID_VMM 195887252 0xbad0094 EINVAL Invalid vmm
VMK_INVALID_TXN 195887253 0xbad0095 EINVAL Invalid transaction
VMK_FS_RETRY_OPERATION 195887254 0xbad0096 EAGAIN Transient file system condition, suggest retry
VMK_VCPU_LIMIT_EXCEEDED 195887255 0xbad0097 EINVAL Number of running VCPUs limit exceeded
VMK_INVALID_METADATA 195887256 0xbad0098 EINVAL Invalid metadata
VMK_INVALID_PAGE_NUMBER 195887257 0xbad0099 EINVAL Invalid page number
VMK_NOT_EXEC 195887258 0xbad009a ENOEXEC Not in executable format
VMK_NFS_CONNECT_FAILURE 195887259 0xbad009b EHOSTDOWN Unable to connect to NFS server
VMK_NFS_MOUNT_NOT_SUPPORTED 195887260 0xbad009c EINVAL The NFS server does not support MOUNT version 3 over TCP
VMK_NFS_NFS_NOT_SUPPORTED 195887261 0xbad009d EINVAL The NFS server does not support NFS version 3 over TCP
VMK_NFS_MOUNT_DENIED 195887262 0xbad009e EPERM The mount request was denied by the NFS server. Check that the export exists and that the client is permitted to mount it
VMK_NFS_MOUNT_NOT_DIR 195887263 0xbad009f ENOTDIR The specified mount path was not a directory
VMK_NFS_BAD_FSINFO 195887264 0xbad00a0 EACCES Unable to query remote mount point’s attributes
VMK_NFS_VOLUME_LIMIT_EXCEEDED 195887265 0xbad00a1 EINVAL NFS has reached the maximum number of supported volumes
VMK_NO_MEMORY_NICE 195887266 0xbad00a2 ENOMEM Out of nice memory
VMK_MIGRATE_PREEMPTIVE_FAIL 195887267 0xbad00a3 ENOMEM VMotion failed to start due to lack of cpu or memory resources
VMK_CACHE_MISS 195887268 0xbad00a4 EFAULT Cache miss
VMK_STRESS_INDUCED_ERROR 195887269 0xbad00a5 EIO Error induced when stress options are enabled
VMK_TOO_MANY_LOCK_HOLDERS 195887270 0xbad00a6 EUSERS Maximum number of concurrent hosts are already accessing this resource
VMK_NO_JOURNAL 195887271 0xbad00a7 EIO Host doesn’t have a journal
VMK_RANK_VIOLATION 195887272 0xbad00a8 EDEADLK Lock rank violation detected
VMK_MODULE_FAILED 195887273 0xbad00a9 ENODEV Module failed
VMK_NO_MASTER_PTY 195887274 0xbad00aa ENXIO Unable to open slave if no master pty
VMK_NOT_IOABLE 195887275 0xbad00ab EFAULT Not IOAble
VMK_NO_FREE_INODES 195887276 0xbad00ac ENOSPC No free inodes
VMK_NO_MEMORY_FOR_FILEDATA 195887277 0xbad00ad ENOSPC No free memory for file data
VMK_NO_TAR_SPACE 195887278 0xbad00ae ENOSPC No free space to expand file or meta data
VMK_NO_FIFO_READER 195887279 0xbad00af ENXIO Unable to open writer if no fifo reader
VMK_NO_SUCH_DEVICE 195887280 0xbad00b0 EINVAL No underlying device for major,minor
VMK_MEM_MIN_GT_MEMSIZE 195887281 0xbad00b1 EINVAL Memory min exceeds memSize
VMK_NO_SUCH_VT 195887282 0xbad00b2 ENXIO No virtual terminal for number
VMK_TOO_MANY_ELEMENTS 195887283 0xbad00b3 E2BIG Too many elements for list
VMK_SHAREDAREA_MISMATCH 195887284 0xbad00b4 ENOSYS VMM<->VMK shared are mismatch
VMK_EXEC_FAILURE 195887285 0xbad00b5 ESRCH Failure during exec while original state already lost
VMK_VMNIXMOD_NOT_LOADED 195887286 0xbad00b6 ENOSYS vmnixmod kernel module not loaded
VMK_INVALID_MODULE 195887287 0xbad00b7 EINVAL Invalid module
VMK_UNALIGNED_ADDRESS 195887288 0xbad00b8 EINVAL Address is not aligned on page boundary
VMK_NOT_MAPPED 195887289 0xbad00b9 ENOMEM Address is not mapped in address space
VMK_NO_MESSAGE_SPACE 195887290 0xbad00ba ENOMEM No space to record a message
VMK_PDI_STACK_OVERFLOW 195887291 0xbad00bb EFBIG No space left on PDI stack
VMK_EXCEPTION_HANDLER_INVALID 195887292 0xbad00bc EINVAL Invalid exception handler
VMK_EXCEPTION_NOT_HANDLED 195887293 0xbad00bd EINVAL Exception not handled by exception handler
VMK_INVALID_MULTIWRITER_OBJECT 195887294 0xbad00be EDEADLK Can’t open sparse/TBZ files in multiwriter mode
VMK_STORAGE_RETRY_OPERATION 195887295 0xbad00bf EAGAIN Transient storage condition, suggest retry
VMK_HBA_ERROR 195887296 0xbad00c0 EIO Storage initiator error
VMK_TIMER_INIT_FAILED 195887297 0xbad00c1 EINVAL Timer initialization failed
VMK_MODULE_NOT_FOUND 195887298 0xbad00c2 ENOENT Module not found
VMK_NOT_SOCKET_OWNER 195887299 0xbad00c3 EINVAL Socket not owned by cartel
VMK_VSI_HANDLER_NOT_FOUND 195887300 0xbad00c4 ENOENT No VSI handler found for the requested node
VMK_INVALID_MMAPPROTFLAGS 195887301 0xbad00c5 EINVAL Invalid mmap protection flags
VMK_INVALID_MAPCONTIG_SIZE 195887302 0xbad00c6 EINVAL Invalid chunk size for contiguous mmap
VMK_INVALID_MAPCONTIG_MAX 195887303 0xbad00c7 EINVAL Invalid MPN max for contiguous mmap
VMK_INVALID_MAPCONTIG_FLAG 195887304 0xbad00c8 EINVAL Invalid mmap flag on contiguous mmap
VMK_NOT_LAZY_MMINFO 195887305 0xbad00c9 EINVAL Unexpected fault on pre-faulted memory region
VMK_MMINFO_WONT_SPLIT 195887306 0xbad00ca EINVAL Memory region cannot be split (remap/unmap)
VMK_NO_CACHE_INFO 195887307 0xbad00cb ENOENT Cache Information not available
VMK_CANNOT_REMAP_PINNED_MEMORY 195887308 0xbad00cc EINVAL Cannot remap pinned memory
VMK_NO_SUCH_CARTELGROUP 195887309 0xbad00cd ESRCH No cartel group by that name
VMK_SPLOCKSTATS_DISABLED 195887310 0xbad00ce EINVAL SPLock stats collection disabled
VMK_BAD_TAR_IMAGE 195887311 0xbad00cf EINVAL Boot image is corrupted
VMK_BRANCHED_ALREADY 195887312 0xbad00d0 EPERM Branched file cannot be modified
VMK_NAME_RESERVED_FOR_BRANCH 195887313 0xbad00d1 EPERM Name is reserved for branched file
VMK_CANNOT_BRANCH_UNLINKED 195887314 0xbad00d2 EPERM Unlinked file cannot be branched
VMK_MAX_RETRIES_EXCEEDED 195887315 0xbad00d3 EAGAIN Maximum kernel-level retries exceeded
VMK_OPTLOCK_STOLEN 195887316 0xbad00d4 EAGAIN Optimistic lock acquired by another host
VMK_NOT_MMAPABLE 195887317 0xbad00d5 ENODEV Object cannot be mmapped
VMK_INVALID_CPU_AFFINITY 195887318 0xbad00d6 EINVAL Invalid cpu affinity
VMK_DEVICE_NOT_PARTOF_LV 195887319 0xbad00d7 ENXIO Device does not contain a logical volume
VMK_NO_SPACE 195887320 0xbad00d8 ENOSPC No space left on device
VMK_VSI_INVALID_NODE_ID 195887321 0xbad00d9 EINVAL Invalid vsi node ID
VMK_TOO_MANY_USERS 195887322 0xbad00da EUSERS Too many users accessing this resource
VMK_EALREADY 195887323 0xbad00db EALREADY Operation already in progress
VMK_BUF_TOO_SMALL 195887324 0xbad00dc EINVAL Buffer too small to complete the operation
VMK_SNAPSHOT_DEV_DISALLOWED 195887325 0xbad00dd EACCES Snapshot device disallowed
VMK_LVM_DEVICE_UNREACHABLE 195887326 0xbad00de EIO LVM device unreachable
VMK_CPU_INVALID_RESOURCE_UNITS 195887327 0xbad00df EINVAL Invalid cpu resource units
VMK_MEM_INVALID_RESOURCE_UNITS 195887328 0xbad00e0 EINVAL Invalid memory resource units
VMK_ABORTED 195887329 0xbad00e1 ECANCELED IO was aborted
VMK_MEM_MIN_LT_RESERVED 195887330 0xbad00e2 ENOSPC Memory min less than memory already reserved by children
VMK_MEM_MIN_LT_CONSUMED 195887331 0xbad00e3 ENOSPC Memory min less than memory required to support current consumption
VMK_MEM_MAX_LT_CONSUMED 195887332 0xbad00e4 ENOSPC Memory max less than memory required to support current consumption
VMK_TIMEOUT_RETRY 195887333 0xbad00e5 ETIMEDOUT Timeout (ok to retry)
VMK_RESERVATION_LOST 195887334 0xbad00e6 EBUSY Reservation Lost
VMK_FS_STALE_METADATA 195887335 0xbad00e7 ENOENT Cached metadata is stale
VMK_NO_FCNTL_LOCK 195887336 0xbad00e8 ENOLCK No fcntl lock slot left
VMK_NO_FCNTL_LOCK_HOLDER 195887337 0xbad00e9 ENOLCK No fcntl lock holder slot left
VMK_NO_LICENSE 195887338 0xbad00ea EACCES Not licensed to access VMFS volumes
VMK_LVM_RETRY_OPERATION 195887339 0xbad00eb EAGAIN Transient LVM device condition, suggest retry
VMK_SNAPSHOT_LV_INCOMPLETE 195887340 0xbad00ec EAGAIN Snapshot LV incomplete
VMK_MEDIUM_NOT_FOUND 195887341 0xbad00ed EIO Medium not found
VMK_MAX_PATHS_CLAIMED 195887342 0xbad00ee ENOMEM Maximum allowed SCSI paths have already been claimed
VMK_NOT_MOUNTABLE 195887343 0xbad00ef ENODEV Filesystem is not mountable
VMK_MEMSIZE_GT_MEMSIZELIMIT 195887344 0xbad00f0 EINVAL Memory size exceeds memSizeLimit
VMK_GENERIC_LINUX_ERROR 732758016 0x2bad0000 EIO Generic service console error

Using virtual serial ports via named pipes in ESX 3.5

Create a named pipe as you typically would as the server on your first VM.

Image

The corresponding entries in the vmx file:

serial0.present = “true”
serial0.yieldOnMsrRead = “true”
serial0.fileType = “pipe”
serial0.fileName = “/vmfs/volumes/472c028b-dd6c1d22-a8f4-001aa0c0b349/Zangief-Fileserver/Zangief-pipe”
serial0.pipe.endPoint = “server”
serial0.tryNoRxLoss = “true”

Create the same named pipe on your second VM, using the same pipe, but connected as a client, opposed to the server.

Image

The corresponding vmx file entries:
serial0.present = “true”
serial0.yieldOnMsrRead = “true”
serial0.fileType = “pipe”
serial0.fileName = “/vmfs/volumes/472c028b-dd6c1d22-a8f4-001aa0c0b349/Zangief-Fileserver/Zangief-pipe”
serial0.pipe.endPoint = “client”
serial0.tryNoRxLoss = “true”

After you power up the VM, you’ll find it strange that the pipe is not visible in the service console.

ls -l /vmfs/volumes/472c028b-dd6c1d22-a8f4-001aa0c0b349/Zangief-Fileserver/Zangief-pipe
ls: /vmfs/volumes/472c028b-dd6c1d22-a8f4-001aa0c0b349/Zangief-Fileserver/Zangief-pipe: No such file or directory

If you connect to it on the second VM however, you’ll see that it works.

Image

DHCP server with DDNS

authoritative;
include “/etc/bind/rndc.key”;
server-identifier chunli.shocknetwork.com.;
ddns-domainname “shocknetwork.com.”;
ddns-rev-domainname “in-addr.arpa.”;
ddns-update-style interim;
ddns-updates on;
ignore client-updates;
zone shocknetwork.com. {
primary 127.0.0.1;
key rndc-key;
}
default-lease-time 21600; # 6 hours
max-lease-time 43200; # 12 hours
option domain-name “shocknetwork.com”;
option domain-name-servers chunli.shocknetwork.com, resolver1.opendns.com;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.200;
option domain-name-servers chunli.shocknetwork.com, resolver1.opendns.com;
option domain-name “shocknetwork.com”;
option routers 192.168.0.1;
option broadcast-address 192.168.0.3;
default-lease-time 600;
max-lease-time 7200;
zone 0.168.192.in-addr.arpa. {
primary 192.168.0.3;
key rndc-key;
}
zone localdomain. {
primary 192.168.0.3;
key rndc-key;
}
}
/etc/named.conf –> I’m using Ubuntu 6, so it’s actually /etc/bind/named.conf and named.options, etc, but for the sake of simplicity, I’ll put them all together.
options {
directory “/var/cache/bind”;
auth-nxdomain no; # conform to RFC1035
};
zone “.” {
type hint;
file “/etc/bind/db.root”;
};
zone “localhost” {
type master;
file “/etc/bind/db.local”;
};
zone “127.in-addr.arpa” {
type master;
file “/etc/bind/db.127”;
};
zone “0.in-addr.arpa” {
type master;
file “/etc/bind/db.0”;
};
zone “255.in-addr.arpa” {
type master;
file “/etc/bind/db.255”;
};
controls {
inet 127.0.0.1 allow {localhost; } keys { “rndc-key”; };
};
// Add local zone definitions here.
zone “shocknetwork.com” {
type master;
file “/etc/bind/shocknetwork.com.zone”;
allow-update { key “rndc-key”; };
notify yes;
};
zone “0.168.192.in-addr.arpa” {
type master;
file “/etc/bind/0.168.192.in-addr.arpa.zone”;
allow-update { key “rndc-key”; };
notify yes;
};
include “/etc/bind/rndc.key”; Some troubleshooting tips: 1) turn on logging for DNS:
logging {
category “default” { “debug”; };
file “/tmp/nameddbg” versions 2 size 50m;
print-time yes;
print-category yes;
}; That’s about it – it should give you all you need.]]>

Linux P2V

Here’s a cool link on doing Linux P2Vs.
Taken from: http://conshell.net/wiki/index.php/Linux_P2V

Introduction
P2V Linux migrations are a combination of science, art and luck.

P2V stands for Physical to Virtual. In other words, it is the process or procedure of moving a running system (operating system and everything installed) from a physical machine to a virtual machine.

This page describes some of the usual steps necessary to convert a Linux system into a virtual machine running under VMware ESX Server. The same steps should mostly apply to VMware Server, Workstation or even QEMU.

The focus of this P2V explanation is on Red Hat and CentOS guests as they are not only supported, but benefit from kudzu and rescue disk capability built-in. Other distributions can of course be converted but the exact steps will vary.

So, let’s get started.

What to use (or not)
The following software products claim to do P2V, but in fact do not support Linux, so don’t bother.

Virtual Server Migration Toolkit
EZP2V
These products do support Linux in some way…

VMware Converter
VMware converter will work, however any options such as resizing the disks and post migration configuration are greyed-out. This is due to the fact that it just does a raw block-by-block copy of the source disk. It is most useful if your target for migration is ESX 3.x

–update – VMware Converter 4 will do a live P2V for Linux.

Platespin PowerConvert?
PowerConvert works (somewhat) with Linux but it does not support LVM and in my experience is an unreliable product with lackluster support.

liveview looks promising, however it only runs on Windows (due to dependency on VMDK disk mounter) and works with vmware-server, not ESX server. It has “limited” Linux support.
These products or methods offer full support for Linux…

UltimateP2V appears to be worthy of consideration.
Good ol’ dd + netcat, followed by rescue disk of some kind (to fix the modules and make a new initrd).
Preparation
You will want to have the necessary tools in place as well as some calculations. Consider the follow aspects of your system.

How much physical RAM? Is it over or under-utilized?
How much Swap space and where?
Disk type – IDE or SATA and the disk device will be /dev/hda, SCSI will be /dev/sda. You may also have multiple disks (hdb, sdb, etc).
Disk size – use a command such as sudo sfdisk -s. Blocks are in 1KB units, do the math to figure out the equivalents in MB by dividing by 1024 and in GB by dividing by 1024 again.
Example:
jetson:~> sudo sfdisk -s
/dev/hda: 39070080
total: 39070080 blocks
(39070080/1024) = 38154.375 MB
(38154.375/1024) = 37.260 GB
Partition layout -know exactly the partitions, sizes and FS types. This can be gleaned from the df output and the content of /etc/fstab.
Rescue disk – this may be necessary for the recovery of the system once the disk data has been converted over. Conversion puts the system into a “new” environment of emulated devices, and some cases kudzu will not quite get you there or won’t even be available (kudzu is a Red Hat software, not normally found on other Linux distributions).
Knowledge of destination environment. For instance, see http://www.vmware.com/pdf/GuestOS_guide.pdf for vi3.
ISOs – you will want to have the following ISOs for easy access and to map to the CDROM device in the guest.
Install disc #1 for the Red Hat or CentOS version of the source system
Knoppix (recommended) or System Rescue CD
Preparing the source system
Take the time to consider and perform the following tasks while the source system is still running in its native state.

Disable any services you don’t think will be necessary after the conversion, such as system-management agents (think Dell OMSA or IBM Director) and ntpd.
Purge out old logfiles, scratch files in /tmp and unnecessary software.
Cleanup old/extraneous kernels. You will likely want to end up with just 2 kernels, the latest Non-SMP kernel and a previous one.
Building a new initrd with the mptscsih (RHEL4/CentOS4) or BusLogic (RHEL3/CentOS3, RHEL2/CentOS2) SCSI driver loaded, this may save you from having to boot into linux rescue mode after the conversion.
For RHEL4/CentOS4, add –with=mptscsih For RHEL3/CentOS3 and earlier, use –with=BusLogic

mkinitrd -v -f –with=BusLogic /boot/initrd-`uname -r`.img `uname -r`
Zero-out each of the disk partitions… this can speed up the data transfer later on. e.g.
dd if=/dev/zero of=/usr/bigfile; rm -f /usr/bigfile
Boot your system with Knoppix or System Rescue CD. The state we want is an at-rest hard drive(s) and network connectivity. NOTHING should be running/writing to the hard drive(s).

Optional step: run md5sum /dev/sda and record the resulting hash. Usually the last 6 characters will suffice. This can take awhile but gives you a fingerprint of the hard drive data that you can use later to verify the integrity of the data after transferring to the target system. ‘

Preparing the target system (VM)
Using the MUI or vmware-server-console, create a VM with the following parameters:

Operating System: Linux. You can be more specific on vmware-server or ESX, such as Red Hat Enterprise Linux 4.
Disk: slightly larger than source-system (see below). Create same number of disks as exist on the source system.
Network (NIC): Use vlance if given the choice, can be upgrade to vmxnet later when vmware-tools is installed.
CDROM: assign to either Knoppix ISO or System Rescue CD ISO
Boot the target system (I enter knoppix 2 at the boot prompt) and verify the disk(s) are recognized using sfdisk -s. Also verify the network is up using ifconfig eth0. You should have an IP address assigned to eth0 via DHCP or static. Now try pinging the source system e.g. ping 10.4.1.2

Network Acquisition (Disk Cloning)
This is where we transfer the bits from drive A on the source to drive B on the target. The process is functionally very similar to a network acquisition often used in the field of computer forensics.

For our part, a simple example will show how to clone the bits from a single drive: /dev/sda

You’ll need to know the IP address of your target-system, which can be learned from ifconfig eth0.

These commands can be used to clone the blocks to the target-system disk. I assume you have netcat (nc) installed on the source system.

First, run this on the target system

nc -l -p 9001 | dd of=/dev/sda
Then run this on the source system

dd if=/dev/sda | nc 9001
In the real-world, repeat the above process as necessary for the remaining disks.

This is the slowest part of the process. Unfortunately, dd does not show a progress meter. I have seen a 36GB drive take 40 minutes to transfer over on a gigabit network, where the actual throughput was ~14.3MB/s. Another P2V took just over an hour for the same size drive, albeit on a different gigabit network.

The network transfer speed is an important consideration when planning your scheduled outage. You may want to run some tests before your P2V, with a smaller set of data (1GB?) to get an estimate of your throughput, then run the numbers to figure out how long it will take to do the entire drive(s). This can be done while the system is still online. Also, consider the tip above about zero-filling your disk partitions beforehand.

Once your drive(s) have been bit-copied over the network to the target, shutdown your target system and remove the virtual CDROM or ISO mapping.

Optional step: run md5sum /dev/sda and verify the result matches what you saw earlier.

Extras
This is a perfect time to make some adjustments if you want to be clever about your disk & paritition sizes, the following may come in handy. Verify the partitions

fdisk -l /dev/sda
Check a filesystem.

e2fsck -f /dev/sda1
Align ext[23]–>

resize2fs -p /dev/sda1

First-boot
Assuming you got this far, the next step is to immediately shutdown the system again. You’ll want to re-assign the NIC to vmxnet and assign the vmware-tools ISO to the CDROM (path: /usr/lib/vmware/isoimages/linux.iso). Boot up into single-user mode (at grub prompt hit e, select kernel line, e, append “single” to the line, then hit b). Install the vmware-tools (detailed elsewhere) which should get you the vmxnet driver module. Adjust network settings now! Cleanup and reboot. You should be 98% there. Congratulations!

NOTE: I had to rename /etc/rc3.d/S19vmware-tools to /etc/rc3.d/S09vmware-tools to “fix” my network bootup sequence.

On the second reboot, the kudzu command will run and (may well) deal with the remaining hardware changes.

When kudzu runs, it recognizes that certain devices (Broadcom NICs) are no longer there while others (LSI Logic card, pcnet32 NIC) had been added. Usually it is easiest to just accept what kudzu tells us & fine tune later.

See When things go wrong below if you don’t get back to a login: prompt.

When things go wrong
If kudzu does not get you back to a login: prompt, the next step is to boot with the rescue disk. This entails mapping the install cd#1 ISO file to your CDROM device using the MUI or vmware-server-console. Make sure the VM BIOS is also set to use your CDROM in the boot order before the hard drive(s).

Once booted, type linux rescue at the boot prompt and shortly thereafter you will be able to type chroot /mnt/sysimage to get at your disk partitions, which should automatically be mounted there.

The first thing to look at is /etc/modules.conf (RHEL3/CentOS3) or /etc/modprobe.conf (RHEL4/CentOS4). Make sure the appropriate SCSI driver is listed, either BusLogic or mptscsih (based on what you configured this VM to use and the recommendations above).

alias scsi_hostadapter mptscsih
#or
alias scsi_hostadapter BusLogic
Also, take note of the eth0 setting, which should be either pcnet32 for the vlance device, or vmxnet for the vmxnet device. After you install the vmware-tools with the vmxnet device assigned it should be configured automatically.

alias eth0 pcnet32
#or
alias eth0 vmxnet
If you went the route of cloning individual partitions instead of the entire disk(s), it may be necessary to clone the MBR. This will be evident if you try to boot from the drive and get the message “No operating system found”. The process is described here.

Tying up loose ends
Consider the new state of the system, do you really need to run NTP anymore? (Hint: read VMware’s timekeeping whitepaper, set tools.timeSync=”TRUE” in the .vmx file and add clock=pit to the grub kernel line).

See Also
ESX Server 3 Systems Compatibility Guide (PDF)
ESX Server 2.x Systems Compatibility Guide (PDF)
Hard Disk Cloning
Wonders of ‘dd’ and ‘netcat’: Cloning OS harddrives
The Sleuth Kit Informer
dd_rescue – looks like a GREAT alternative to dd for P2Ving systems with failing hard drives. Available in the CentOS
dcfldd – another dd alternative that can update the user of its progress in terms of the amount of data transferred and how much longer operation will take.

iSCSI naming

Both targets and initiators require names for the purpose of
identification, so that iSCSI storage resources can be managed
regardless of location (address). Note that this means iSCSI names
are independent of location.

Furthermore, iSCSI names are associated with iSCSI nodes instead of
with network adapter cards to ensure the free movement of network
HBAs between hosts without loss of SCSI state information
(reservations, mode page settings etc) and authorization
configuration. An iSCSI node also has one or more addresses.
An iSCSI address specifies a single path to an iSCSI node and consists
of the iSCSI name, plus a transport (TCP) address which uses the following format: [: ] If the is not specified, the
default port 3260, assigned by IANA, will be assumed. For iSCSI
initiators, the is omitted.

The concepts of names and addresses have been carefully separated in
iSCSI:

– An iSCSI Name is a location-independent, permanent identifier for
an iSCSI node. An iSCSI node has one iSCSI name, which stays
constant for the life of the node.

– An iSCSI Address specifies not only the iSCSI name of an iSCSI
node, but also a location of that node. The address consists of a
host name or IP address, a TCP port number (for the target), and
the iSCSI Name of the node. An iSCSI node can have any number of
addresses, which can change at any time.

To assist in providing a more human-readable user interface for
devices that contain iSCSI targets and initiators, a target or
initiator may also provide an alias. The alias strings are communicated
between the initiator and target at login, and can be displayed by a user interface on either end, helping the user tell at a glance whether the
initiators and/or targets at the other end appear to be correct.
The alias is a variable length string, between 0 and 255 characters.

Constructing iSCSI names using the iqn. format.

– The string “iqn.”

– A date code specifying the year and month in which the
organization registered the domain or sub-domain name used as the
naming authority string.

– The organizational naming authority string, which consists of a
valid, reversed domain or subdomain name.

– Optionally, a ‘:’, followed by a string of the assigning
organization’s choosing, which must make each assigned iSCSI name
unique.

The following is an example of an iSCSI qualified name from an
equipment vendor:

Organizational Subgroup Naming Authority
Naming and/or string Defined by
Type Date Auth Org. or Local Naming Authority
+–++—–+ +———+ +——————————–+
| || | | | | |

iqn.2001-04.com.example:diskarrays-sn-a8675309

The following is an example of an iSCSI name string from a storage
service provider:

Organization String
Naming Defined by Org.
Type Date Authority Naming Authority
+-+ +—–+ +————-+ +———————-+
| | | | | | | |
iqn.1995-11.com.example.ssp:customers.4567.disks.107

Note that when reversing these domain names, the first component
(after the “iqn.”) will always be a top-level domain name, which
includes “com”, “edu”, “gov”, “org”, “net”, “mil”, or one of the
two-letter country codes. The use of anything else as the first
component of these names is not allowed.

Constructing iSCSI names using the eui. format

The iSCSI eui. naming format allows a naming authority to use IEEE
EUI-64 identifiers in constructing iSCSI names. The details of
constructing EUI-64 identifiers are specified by the IEEE
Registration Authority (see [EUI64]).

Example iSCSI name:

Type EUI-64 identifier (ASCII-encoded hexadecimal)
+–++————–+
| || |
eui.02004567A425678D

iSCSI Discovery

The goal of iSCSI discovery is to allow an initiator to find the
targets to which it has access, and at least one address at which
each target may be accessed. This should generally be done using as
little configuration as possible. The iSCSI discovery mechanisms
listed here only deal with target discovery and one still needs
to use the SCSI protocol for LUN discovery. In order for an iSCSI
initiator to establish an iSCSI session with an iSCSI target, the
initiator needs the IP address, TCP port number and iSCSI target name information.

iSCSI supports the following discovery mechanisms:

a. Static Configuration: This mechanism assumes that the IP address,
TCP port and the iSCSI target name information are already
available to the initiator. The initiators need to perform no
discovery in this approach. The initiator uses the IP address and
the TCP port information to establish a TCP connection, and it
uses the iSCSI target name information to establish an iSCSI
session. This discovery option is convenient for small iSCSI
setups.

b. SendTargets: This mechanism assumes that the target’s IP address
and TCP port information are already available to the initiator.
The initiator then uses this information to establish a discovery
session to the Network Entity (IP address). The initiator then subsequently issues the SendTargets text command to query
information about the iSCSI targets available at the particular
Network Entity (IP address).

c. Zero-Configuration: This mechanism assumes that the initiator does
not have any information about the target. In this option, the
initiator can either multicast discovery messages directly to the
targets or it can send discovery messages to storage name servers.
Currently, the main discovery frameworks available are
SLP and iSNS. (Not supported in the first release of ESX 3.)]]>

VCB integration

Introduction

This document explains how to use the VCB scripts installed on the proxy as part of the VCB installation to integrate with a backup application.

How VCB Works

VMware Consolidated Backup is a technology that allows users to backup a full image or certain files of a virtual machine while it is running, affording you business continuity and zero downtime. (Currently, file level backups are only available on Windows filesystems.) In order to do this, we leverage VMware’s snapshot technology. In essence, on the backend, the snapshot technology redirects disk I/O from the original vmdk to a delta file so that it frees the lock on the original vmdk and all new writes to disk go onto a new delta file. With the original vmdk free, you can use it read-only and backup your data. (You can only access it read only because since the VM is running, there will be reads from time to time from the original vmdk if necessary from the running VM itself. Your backup will not be the sole user of the vmdk file.)

The instructions for creating the integration are very simple in most cases and only get complex if the default settings won’t work for a given application. Generally, the default settings will work if backup software supports to following features:
1) Relocatable root for backups
2) Ability to associate data with arbitrary hostnames
3) Support for DNS hostnames

If these conditions are not met, there may be a need to customize the VCB scripts.

A VCB backup sequence consists of 7 parts:
1) Optionally quiesce the VM
2) Snapshot the VM
3) Unquiesce the VM (if quiesced)
4) Mount the VMDK
5) Run the backup
6) Unmount the VMDK
7) Remove the snapshot

Backup Vendor Integration Options

The backup vendor has a couple possible integration points: quiesce scripts and/or backup integration. A specific vendor could do either or both. However, without the backup integration, the customer will need some other backup solution.

For quiesce scripts, the backup vendor could provide the scripts needed in steps 1 and 3 to quiesce and unquiesce the applications. This is accomplished by providing scripts to the users and then installing them inside the VM in the as the pre-freeze and post-thaw scripts described on pages 40-41 of the Virtual Machine Backup Guide or here:
http://pubs.vmware.com/vi301/backup/wwh … .4.22.html
Quiescing is important for the integrity of your data. If you don’t quiesce your applications, when you restore from backup, you will end up with the application in your VM as if it had powered down hard. VMware does a quiescing of the filesystem, so that a restore backup doesn’t require a chkdsk or fsck, but it doesn’t do quiescing for applications. Quiescing the applications allow you the opportunity to safely shutdown the applications or commit any logs to databases or do whatever your applications need to do. This way, you can avoid having to replay logs or recover from database logs when you restore. If you do shutdown the application, please note that you can unquiesce the VM immediately after the snapshot is created, so if you do need a window for this, the time should be fairly small. Most applications can be quiesced without being shutdown.

Backup integration is accomplished through the VCB proxy. The backup vendor’s client software is generally recommended to reside on the VCB proxy. This is typically the same or very similar to the client software that would reside on a non-VCB host being backed-up. There are a few hooks into the VCB framework to allow the backup software to mount and unmount the vmdk.

How to Integrate

In order to work with VCB, all a backup client has to do is run a VCB command to snapshot and mount the VM (literally a single command) run its own backup command on the VM disk image or file mount, and then unmount the VM (again a single command). There are some cases where changes to the standard backup client software might be needed, for instance if the backup system can not handle a relocated disk image or file mount by default.

While there are a number of ways to implement the VCB backup process, essentially you just want to create a wrapper around the backup executable to run the extra two commands. You can see examples of the wrappers in the Sample Integrations provided on the VMware website (http://www.vmware.com/download/vi/drivers_tools.html, go down to Consolidated Backup Integration Modules). For instance in the Legato Sample Integration, the wrapper script is called vcb-backup.wsf (which actually runs the main function in vcb-backup.js, where most of the code is). The vcb-backup.js script runs basically the same setup described below, then calls the Networker-specific save command as part of the RunSaveCmd() function, then performs the same cleanup as described below.

You can take a look at the other Sample Integrations to see some different ways of implementing this, though it may be easier to understand and implement something closer to the generic templates.

The generic template script accomplishes all the same steps of the backup integration, but provides a simple and easy to integrate way of creating the wrapper script. Using the generic templates, here’s what you actually need to do to write a VCB integration:

1) Create a directory named after your product under ‘C:\Program Files\VMware Consolidated Backup Framework
2) Copy the content of the generic directory into that directory
3) Make any modifications you need and create your VCB wrapper command in the directory.

Essentially, all you need in the wrapper script is a call to pre-command.wsf, a call to your vendor-specific save command, and a call to post-command.wsf.

In most cases that should be everything you need. If for some reason you need to do something more complex than what the templates let you do, here’s an explanation of how the templates work:

The template files are installed in ‘C:\Program Files\VMware Consolidated Backup Framework’ as part of the standard VCB install. The templates and APIs come from the ‘generic’ directory.
• The generic/glue.js contains API functions for calling the VCB framework (described in more detail below).
• The generic/utils.js scriptfile serves as a library of useful routines.
• The generic/pre-command.wsf file is a template for snapshotting and mounting a VM on the proxy.
• The generic/post-command.wsf scriptfile is a template for cleaning up after a backup.
• The config/config.js file is a user configuration file. The backup vendor should leave the file alone, though they may need to modify it for testing. The file sets some local variables like usernames and passwords that are needed for VCB to run.

The pre-command.wsf script expects 2 arguments, the ID number of the VM to backup (required) and the type of backup (optional and described below). A brief explanation of what the pre-command.wsf command does follows:

1) Loads up an environment from the standard configuration file ($VCBDIR/config/config.js)
1) Loads the API functions from utils.js and glue.js. It uses local copies in the specific integration directory, but you can also load the copies from the generic directory.
2) Makes a call to Util_InitializeConfigVars (part of util.js) to load up the default configuration variables and throw errors if any are not set correctly. Essentially this is verifying that the config.js file (which you already loaded) is correctly formatted and populated. In addition, it sets the Util_vcbPath to the path to the VCB install directory and sets the default mode (which is SAN).
3) Creates a VMInfo object defining the VM to be backed-up. This uses the VMid and the backup type from the command arguments. There is a third argument representing the path within the VM mount directory to be backed-up. This is not used by the template because we are assuming whole VM backups. The legal backup types are vcbBackupTypeUnknown (same as “unknown” on the command line), vcbBackupTypeFile (same as “file” on the command line), and vcbBackupTypeFullVM (same as “fullvm” on the command line).
4) Makes a snapshot of the VM specified and then mounts it using prepare for backup function from glue.js. It’s documented in the script and takes 3 arguments: the VMinfo object representing the VM being backedup, a Boolean representing whether you want VCB to take the snapshot for you, and a Boolean representing whether VCB should discard the snapshot when it is done. The Booleans are generally just some standard global variables documented in the code. It is best to use those. The actual implementation of this uses the vcbmounter command line. In rare cases, you may need to create a new js function to call it if you are trying to do something really unusual. The command syntax is: vcbmounter.exe -h -u -p -a {ipaddr: or name:} -r -t {fullvm,file} -m {mode}

Following the pre-command.wsf file, you would generally call your backup products save command from within the same wrapper file that called pre-command.wsf.

Following that, the post-command.wsf would be called. In the unlikely event you need to change its behavior; but it does the following:

1) Loads up an environment from the standard configuration file
($VCBDIR/config/config.js)
2) Loads the API functions from utils.js and glue.js. It uses local copies in the specific integration directory, but you can also load the copies from the generic directory.
3) Makes a call to Util_InitializeConfigVars (part of util.js) to load up the default configuration variables and throw errors if any are not set correctly. Essentially this is verifying that the config.js file (which you already loaded) is correctly formatted and populated. In addition, it sets the Util_vcbPath to the path to the VCB install directory and sets the default mode (which is SAN).
4) Makes a call to CleanUpAfterBackup (part of glue.js) with the location of the mount point of the VM as the only argument. CleanUpAfterBackup is an API to the command line ‘vcbmounter.exe -U’. If you need to do something crazy, you can access the command line directly using the syntax: vcbmounter.exe -h -u -p -U

Troubleshooting notes:

Hardware requirements: The VCB proxy will need network access to both, the VirtualCenter and ESX servers. It will also need to be presented the same LUNs (LUN numbers need to match) on the storage side that are presented to the ESX hosts (that you’re expecting to backup).

If the vcbMounter command doesn’t work, here are some steps you can go about troubleshooting. You can get additional debug information from the vcbMounter command by appending “-L 6” to end of the command.

If you’re having authentication issues, you can run:
vcbUtil -h -u -p -c ping

If it’s not finding the VM via the name or ip address, you can run:
vcbVmName -h -u -p -s any
This will list all VMs found on that VirtualCenter host. If you don’t have VMware Tools installed inside the guest OS, you will not be able to use ipaddr or name. With this output, you have the opportunity to use moref or uuid.

Looking at the log files will be helpful as well.

Some Log file locations on the VCB proxy server:
vmount service logs – C:\WINDOWS\Temp\vmware-vmount[*]–>vstor log files – C:\WINDOWS\Temp\vmware-vlun[*].log

You can find pre/post script log files under
C:\WINDOWS\Temp\ pre_.log
C:\WINDOWS\Temp\ post_.log
C:\WINDOWS\Temp\ browsestart_.log
C:\WINDOWS\Temp\ browseend_.log

3rd party backup Logs – C:\Documents and Settings\Administrator\Local Settings\Temp

Log files for VirtualCenter:
C:\WINDOWS\Temp\vpx\vpxd-*.log]]>