Tuesday, October 10, 2017

How to Use cmmds-tool

Step 1: Access any vm in your vSAN datastore


Step 2: Look at the options of cmmds-tool


Step 3: Query the object id to find out its policy


Step 4: Get additional information by using other options


Tuesday, September 26, 2017

How to use objtool to manipulate a vSAN object

One of the coolest (and most dangerous) commands in vSAN is objtool. Since this datastore is not vmfs but vsanfs (and object based), the objtool command is the utility that performs different tasks such as creating, resizing and deleting objects.

What follows is a series of examples on how to use such command:

# find / -name objtool
/usr/lib/vmware/osfs/bin/objtool

# cd /usr/lib/vmware/osfs/bin

Want to learn how to use the command?

# ./objtool --help
usage: ./objtool <cmd> <options>
Commands:
create    Create an object.
  -s/--size n              size in bytes (or KB, MB, GB or TB)
  -n/--name <string>       Optional user-friendly name.
  -m/--haMetaData <string> Optional HA metadata.
  -p/--policy <string>     Optional VSAN policy.
  -g/--groupUuid <string>  Optional groupUuid of the object.
  -a/--allocType <value>   Allocation Type.
                           0 - Thick (default)
                           1 - Eager Zeroed Thick
                           2 - Zeroed Thick
                           3 - Thin
  --capabilities <value>   Capability flags.
                           0 - None (default)
                           1 - Strict GWE (VsanSparse)
  -t/--objClass <value>    Object Class.
                           0 - vdisk (default)
                           1 - snapshot
                           2 - vmnamespace
                           3 - vmswap
                           4 - vmem
                           5 - sidecar
                           6 - hbrpersist
                           7 - coredump

delete     Delete an object.
  -u/--uuid          UUID of the object
  -f/--forceDelete   Optional force delete mode

open       Create a node for an object in DevFS.
  -u/--uuid          UUID of the object

setAttr    Set attributes of an object
  -u/--uuid                UUID of the object
  -n/--name <string>       Optional user-friendly name.
  -m/--haMetaData <string> Optional HA metadata.
  -d/--descPath <string>   Optional descriptor path.
  --capabilities <value>   Capability flags.
                           0 - None (default)
                           1 - Strict GWE (VsanSparse)

getAttr    Get attributes of an object
  -u/--uuid                UUID of the object
  -c/--isComponent         Specified uuid is a component uuid
  -x/--diskUuid            Disk uuid of the component
  --bypassDom              Bypass DOM and read from LSOM
  --format                 Pretty print the output
                           (Currently, only JSON)
resize     Resize an object
  -u/--uuid          UUID of the object
  -s/--size n        size in bytes (or KB, MB, GB or TB)
  -l/--lockFilePath <path> Lock file path for the object

truncate   Truncate an object
  -u/--uuid          UUID of the object
  -s/--size n        size in bytes (or KB, MB, GB or TB)

setPolicy  Set policy of an object
  -u/--uuid             UUID of the object.
  -p/--policy <string>  VSAN policy.

setMirror  Set the read mirror for an object
  -u/--uuid          UUID of the object
  -r/--readMirror n  mirror to use (-1 to unset)

reset  Reset object.
  -u/--uuid   UUID of the object

Global Options
  -v/--verbose       Verbosity level.
  -q/--quiet         No need to print success messages
  -h/--help          Print this message.

# cat /vmfs/volumes/vsanDatastore/testvm/testvm.vmdk
# Disk DescriptorFile
version=4
encoding="UTF-8"
CID=d68d61b2
parentCID=ffffffff
isNativeSnapshot="no"
createType="vmfs"

# Extent description
RW 2097152 VMFS "vsan://2cc4ca59-f4d8-43c3-9a0b-005056013df7" <-- notice this object id

# The Disk Data Base
#DDB

ddb.adapterType = "lsilogic"
ddb.deletable = "true"
ddb.geometry.cylinders = "512"
ddb.geometry.heads = "128"
ddb.geometry.sectors = "32"
ddb.longContentID = "14bf5c5d81a00d863d0b300fd68d61b2"
ddb.thinProvisioned = "1"
ddb.uuid = "60 00 C2 9b 2d 72 3f 5c-1c 8a 12 5f ca f9 2d 38"
ddb.virtualHWVersion = "13"

Want to delete an object? Better have a backup...

# ./objtool delete -u 2cc4ca59-f4d8-43c3-9a0b-005056013df7 -f

Will this delete the object? You bet... Better have a good backup.


Notice that after the components for the virtual disk object are no longer present.

What about renaming an object? Objtool to the rescue...

# ls -lh
total 5120
drwxr-xr-t    1 root     root        2.1K Sep 26 21:18 26c4ca59-1028-c0c6-e31d-005056013df7
drwxr-xr-t    1 root     root        1.9K Sep 12 15:38 3fc7ad59-ef19-ba92-6088-005056013e28
drwxr-xr-t    1 root     root        1.4K Sep 26 17:56 6986ca59-70d0-0591-c8ff-005056013df7
drwxr-xr-t    1 root     root        3.0K Sep 26 21:18 bfc6ad59-b712-25d2-8939-005056013e24
drwxr-xr-t    1 root     root        1.9K Sep 15 17:40 cac7ad59-f2ac-2d3c-e054-005056013e28
lrwxr-xr-x    1 root     root          36 Sep 26 21:27 javier01 -> 6986ca59-70d0-0591-c8ff-005056013df7
lrwxr-xr-x    1 root     root          36 Sep 26 21:27 testvm -> 26c4ca59-1028-c0c6-e31d-005056013df7           <--notice this line and the name
lrwxr-xr-x    1 root     root          36 Sep 26 21:27 ub1404lts1 -> bfc6ad59-b712-25d2-8939-005056013e24
lrwxr-xr-x    1 root     root          36 Sep 26 21:27 ub1404lts2 -> 3fc7ad59-ef19-ba92-6088-005056013e28
lrwxr-xr-x    1 root     root          36 Sep 26 21:27 ub1404lts5 -> cac7ad59-f2ac-2d3c-e054-005056013e28

# /usr/lib/vmware/osfs/bin/objtool setAttr -u 26c4ca59-1028-c0c6-e31d-005056013df7 -n newtestvm
Object set attribute succeeded

# /etc/init.d/osfsd restart
watchdog-osfsd: Terminating watchdog process with PID 312029
Waiting for process to terminate...
osfsd stopped
osfsd started

# ls -lh
total 5120
drwxr-xr-t    1 root     root        2.1K Sep 26 21:18 26c4ca59-1028-c0c6-e31d-005056013df7
drwxr-xr-t    1 root     root        1.9K Sep 12 15:38 3fc7ad59-ef19-ba92-6088-005056013e28
drwxr-xr-t    1 root     root        1.4K Sep 26 17:56 6986ca59-70d0-0591-c8ff-005056013df7
drwxr-xr-t    1 root     root        3.0K Sep 26 21:18 bfc6ad59-b712-25d2-8939-005056013e24
drwxr-xr-t    1 root     root        1.9K Sep 15 17:40 cac7ad59-f2ac-2d3c-e054-005056013e28
lrwxr-xr-x    1 root     root          36 Sep 26 21:30 javier01 -> 6986ca59-70d0-0591-c8ff-005056013df7
lrwxr-xr-x    1 root     root          36 Sep 26 21:30 newtestvm -> 26c4ca59-1028-c0c6-e31d-005056013df7   <-- notice the new name
lrwxr-xr-x    1 root     root          36 Sep 26 21:30 ub1404lts1 -> bfc6ad59-b712-25d2-8939-005056013e24
lrwxr-xr-x    1 root     root          36 Sep 26 21:30 ub1404lts2 -> 3fc7ad59-ef19-ba92-6088-005056013e28
lrwxr-xr-x    1 root     root          36 Sep 26 21:30 ub1404lts5 -> cac7ad59-f2ac-2d3c-e054-005056013e28

Want information about an object?

# /usr/lib/vmware/osfs/bin/objtool getAttr -u 26c4ca59-1028-c0c6-e31d-005056013df7
Object Attributes --

UUID:26c4ca59-1028-c0c6-e31d-005056013df7

Object type:vsan

Object size:273804165120

User friendly name:newtestvm

HA metadata:(null)

Allocation type:Thick

Policy:((\"stripeWidth\" i1) (\"cacheReservation\" i0) (\"proportionalCapacity\" i0) (\"hostFailuresToTolerate\" i1) (\"forceProvisioning\" i0) (\"spbmProfileId\" \"aa6d5a82-1c88-45da-85d3-3d74b91a5bad\") (\"spbmProfileGenerationNumber\" l+0) (\"spbmProfileName\" \"vSAN Default Storage Policy\"))

Object class: vmnamespace

Object capabilities: NONE

Object path: /vmfs/volumes/vsan:521305e4430dd845-d59b1943736fdc88/

And how do I create an object?

# /usr/lib/vmware/osfs/bin/objtool create -s 1KB -a 3 -n javierobject

Creating object of size 1024 bytes
Setting object class to 0
UUID:3184dd59-c0ea-6ab8-b241-005056013df7how do I create my own object?

Note:  The previous command creates an object using the default policy.  This could be verified also with the rvc.


Note: Add the -t 3 option to the previous command to create a vmswap object. This can also be verified with the rvc.

How to create and remove directories in a vSAN datastore with osfs-mkdir and osfs-rmdir

Creating and removing directories in a vSAN datastore is not as simple as using mkdir and rmdir or rm -rf because the vSAN datastore is object based. In order to do that, special vSAN related commands exist to perform such tasks.

Notice what happens if you try to use the mkdir command:

# cd /vmfs/volumes/vsanDatastore
# mkdir testdir
mkdir: can't create directory 'testdir': Function not implemented

The commands that follow perform the same tasks as the icon with the green plus sign on the web client. These commands should be used if the vCenter server is not available.


How to do it:

Step 1: Access the folder that contains the utilities

# cd /usr/lib/vmware/osfs/bin

Step 2: List the contents of that directory

# ls
objtool     osfs-ls     osfs-mkdir  osfs-rmdir  osfsd

Step 3: Verify that a directory called testdir does not exist

# ls -lh /vmfs/volumes/vsanDatastore/testdir
ls: /vmfs/volumes/vsanDatastore/testdir: No such file or directory

Step 4: Create such directory

# ./osfs-mkdir /vmfs/volumes/vsanDatastore/testdir
92c0ca59-0c9a-84f0-d2f0-005056013e28

Step 5: Verify that it exists

# ls -lh /vmfs/volumes/vsanDatastore/testdir
lrwxr-xr-x    1 root     root          36 Sep 26 21:03 /vmfs/volumes/vsanDatastore/testdir -> 92c0ca59-0c9a-84f0-d2f0-005056013e28

Step 6: Delete the directory

# ./osfs-rmdir /vmfs/volumes/vsanDatastore/testdir
Deleting directory 92c0ca59-0c9a-84f0-d2f0-005056013e28 in container id 521305e4430dd845d59b1943736fdc88 backed by vsan (force=False)

Step 7: Verify that it is gone

# ls -lh /vmfs/volumes/vsanDatastore/testdir
ls: /vmfs/volumes/vsanDatastore/testdir: No such file or directory




Friday, September 1, 2017

VMworld 2017 Photos

Some photos for those who could not attend ...


It all starts with registration.


The calm before the storm.


Getting ready to greet participants...


Pat in action...


Nice Backpacks guys :)


Wednesday, July 26, 2017

Understanding PFTT and SFTT

vSAN 6.6 New Features

Here is what my cluster looks like:


This policy illustrates how to use primary and secondary failures to tolerate. The vms using this policy would be mirrored across sites and within each site as well.



Notice the vm is mirrored across sites and each replica in turn is also mirrored within each site. Notice the number and placement of the components and the witnesses.




This example demonstrates how to have a vm that is not mirrored across sites but is mirrored within one site.

\

Notice the 2 replica copies and the witness are in one site. The two components and the witness are all in the same site.


Pretty cool indeed !!!

VMworld 2017 is coming


See U there :)



Viva Las Vegas...

Thursday, June 15, 2017

How to Enable Encryption on vSAN 6.6

Encrypting a vSAN 6.6 Datastore

Step 1: Select your vCenter Server, click on Configure, select Key Management Servers and click on the Green Plus Sign. Specify the name of the KMS cluster, the IP address and a port to use. Currently, there are two supported KMS Servers (Hytrust and EMC). The KMS servers need to be KMIP 1.1 compliant.


Step 2: You will have to establish a trust relationship with the KMS server. Since different KMS servers are supported, you will have to select the type of certificate to download. Different choices are available.


Step 3: Verify that the connection state is Normal and that the procedure succeeded.



Step 4: Select your vSAN cluster, click on Configure, select General and click on Edit. Enable Encryption. The KMS related information should be automatically populated. Click on OK.


Step 5: Once you enable Encryption, every disk will be reformatted. This process will take time. The amount of time will depend on how many drives need to be formatted and the size of the drives.


Once this is done, the entire datastore is encrypted. Encryption works with both the hybrid solution as well as the all-flash. If new servers are added to the cluster, the disk groups created on the new host will be formatted to support encryption.