VCAP4-DCA Certification

This morning I’ve received a pleasant email from VMware.

The subject was: Your VCAP4-DCA Score Report

And I’m excited to say that I passed the VCAP4-DCA exam. I’ve got 382 point of the 500 where 300 point are necessary to pass the exam.

How did I prepare for this exam:

I must say that this was the most difficult test I have ever done in my IT career.  My test exists on doing 34 labs  in 4 hours (not native English speaking) . When I was finishing the last lab (the command was issued but was still running) I ran out of time. The stuff you really have to now for this exam is:

  • vSphere ESX and ESXi (Duh!)
  • Update Manager
  • CLI
  • PowerCLI
  • VMware Management Assisant (vMA)
  • vCenter with all it’s features (Distributed Switches, Host Profiles, Reporing, etc)

But most important is real live experience or a lot of lab time. This is not an exam that you can study with a exam essentials.

So now up to the next level: VCAP-DCD

Enter Maintenance mode: Operation Time out

I’ve got this question a couple of time through email and in my training. Let me explain the error (in my case because there can be multiple causes).

A while ago I giving a VMware course where I had 2 ESX host available. Both host where member of a HA en DRS cluster. When I tried to put one host in maintenance mode I took forever and finally I ended up with the error:

Operation Time out

Looking at the Tasks and Events tab didn’t make me any wiser. I looked like a VM was the problem but this VM migrated successfully. The real cause of the problem was HA. In this configuration HA prevented to put one host in maintenance mode because then HA didn’t have enough hosts available for failover. Temporally disabling HA solved the problem.

Again this is one solution. There can me multiple causes witch prevent putting a host in maintenance mode.

vCLI: Managing iSCSI Storage

As I want to get deeper into VMware CLI (vCLI) I deciced to make a summary of the vSphere Command-Line Interface Installation and Scripting Guide. Every chapter will be a separate blog post.

This summary is meant for my documentation but feel free to make use of it.

In this blog post: Managing iSCSI Storage

Setting up Software iSCSI

  1. Determine the HBA type and retrieve the HBA ID (you will get something back like vmhba32)
    vicfg-iscsi –adapter –list
  2. Enable the Software iSCSI client
    vicfg-iscsi –swiscsi –enable
    You can check the status with
    vicfg-iscsi –swiscsi –list
  3. If you want you can set the iSCSI name (IQN) or alias
    vicfg-iscsi -I -n <iscsi_name> <adapter_name>
    vicfg-iscsi –iscsiname –name <iscsi_name> <adapter_name>
    vicfg-iscsi -I -a <alias_name> <adapter_name>
    vicfg-iscsi –iscsiname –alias <alias_name> <adapter_name>
  4. Add a dynamic discovery address or a static discovery address
    Dynamic: vicfg-iscsi <conn_options> –discovery –add –ip <ip_addr | domain_name> <adapter_name>
    Static: vicfg-iscsi <conn_options> –static –add –ip <ip_addr | domain_name> –name <iscsi_name <adapter_name>
  5. If you want to use CHAP authentication
    vicfg-iscsi –authentication –level <level> –method <auth_method>
    –auth_username <auth_u_name> –auth_password <auth_password>
    [–ip <stor_ip_addr|stor_hostname> [:<portnum>] [-name <iscsi_name]]
    <adapter_name>
  6. If you want to use mutual CHAP run the vicfg-iscsi -A command again with the -b option. Best practice is to use a different username and password.
    For the <level> you can use:

    • chapProhibited to disable host CHAP authentication
    • chapRequired to enable host CHAP authentication
  7. For additional iSCSI paremeters use vicfg-iscsi -W
  8. Rescan the host with vicfg-rescan

Setting up Dependent Hardware iSCSI

  1. Determine the HBA type and retrieve the HBA ID (you will get something back like vmhba32)
    vicfg-iscsi –adapter –list
  2. If you want you can set the iSCSI name (IQN) or alias
    vicfg-iscsi -I -n <iscsi_name> <adapter_name>
    vicfg-iscsi –iscsiname –name <iscsi_name> <adapter_name>
    vicfg-iscsi -I -a <alias_name> <adapter_name>
    vicfg-iscsi –iscsiname –alias <alias_name> <adapter_name>
  3. Set up port binding
    • Identify the VMkernel port of the dependent hardware iSCSI adapter.
      esxcli <conn_options> swiscsi vmknic list -d <vmhba>
    • Connect the dependent hardware iSCSI initiator to the iSCSI VMkernel ports by running the
      following command for each port.
      esxcli <conn_options> swiscsi nic add -n <port_name> -d <vmhba>
    • Verify that the ports were added to the dependent hardware iSCSI initiator.
      esxcli <conn_options> swiscsi nic list -d <vmhba>
    • Rescan the dependent hardware iSCSI initiator.
      vicfg-rescan <conn_options> <vmhba>
  4. The rest of the steps are the same as from step 4 Software iSCSI

Setting up independent Hardware iSCSI

  1. Determine the HBA Type and HBA ID
    vicf-iscsi –adapter –list
  2. Configure the HBA by running vicfg-iscsi -N with one or more of the following options:
    • –list (list network adapters)
    • –ip <ip address> (sets the HBA IPv4 address)
    • –subnetmask <subnetmask> (Sets the HBA subnetmask)
    • –gateway <default gateway> (Set the default gateway)
    • –set ARP=TRUE|FALSE (enable or disable ARP redirect)

    Of course you can use these option in one command line

  3. The rest is the same as from step 3 Software iSCSI

vicfg-iscsi Command syntax

-A –authentication -c <level>
-m <auth_method> -b
-u <ma_username>
-w <ma_password>
[-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]]
<adapter_name>
–level <level>
–method <auth_method> –mutual
–auth_username <ma_username>
–auth_password <ma_password>
[–ip <stor_ip_addr|stor_hostname> [:<portnum>]
[–name <iscsi_name>]] <adapter_name>
Enables mutual authentication.
You must enable authentication
before you can enable mutual
authentication.
-A –authentication -c <level>
-m <auth_method>
-u <auth_u_name>
-w <a_password>
[-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]]
<adapter_name>
–level <level>
–method <auth_method>
–auth_username <auth_u_name>
–auth_password <auth_password>
[–ip <stor_ip_addr|stor_hostname> [:<portnum>]
[–name <iscsi_name>]] <adapter_name>
Enables authentication using the
specified options.
-A –authentication -l <adapter_name>
–list <adapter_name>
Lists supported authentication
methods.
-D –discovery -a -i <stor_ip_addr|stor_hostname[:<portnum>] <adapter_name>
–add –ip <stor_ip_addr|stor_hostname> [:<portnum>]
<adapter_name>
Adds a dynamic discovery
address.
-D –discovery -l <adapter_name>
–list <adapter_name>
Lists dynamic discovery
addresses.
-D –discovery -r -i <stor_ip_addr|stor_hostname>[:<portnum>] <adapter_name>
–remove –ip <stor_ip_addr|stor_hostname> [:<portnum>]
<adapter_name>
Removes a dynamic discovery
address.
-H -l [<adapter_name>]
–list [<adapter_name>]
Lists all iSCSI adapters or a
specified adapter.
-L –lun -l <adapter_name>
–list <adapter_name>
Lists LUN information.
-L –lun -l -t <target_ID> <adapter_name>
–list –target_id <target_id> <adapter_name>
Lists LUN information for a
specific target.
-N –network (Independent hardware iSCSI only) -l <adapter_name>
–list <adapter_name>
Lists network properties.
-N –network (Independent hardware iSCSI only) -i <ip_addr> <adapter_name>
–ip <ip_addr> <vmhba>
Sets the HBA IPv4 address to
ip_addr.
-N –network (Independent hardware iSCSI only) -s <subnet_mask> <adapter_name>
–subnetmask <subnet_mask> <adapter_name>
Sets the HBA network mask to
subnet_mask.
-N –network (Independent hardware iSCSI only) -g <default_gateway> <adapter_name>
–gateway <default_gateway> <adapter_name>
Sets the HBA gateway to
default_gateway.
-N –network (Independent hardware iSCSI only) -i <ip_addr> -s <subnet mask>
-g <default_gateway> <adapter_name>
–ip <ip_addr> –subnetmask <subnet_mask>
–gateway <default_gateway> <adapter_name>
Sets the IP address, subnet mask,
and default gateway in one
command.
-p –pnp (Independent hardware iSCSI only) -l <adapter_name>
–list <adapter_name>
Lists physical network portal
options.
-p –pnp (Independent hardware iSCSI only) -M <mtu_size> <adapter_name>
–mtu <mtu-size> <adapter_name>
Sets physical network portal
options.
-I –iscsiname -a <alias_name> <adapter_name>
–alias <alias_name> <adapter_name>
Sets the iSCSI initiator alias.
-I –iscsiname -n <iscsi_name> <adapter_name>
–name <iscsi_name> <adapter_name>
Sets the iSCSI initiator name.
-I –iscsiname -l <adapter_name>
–list <adapter_name>
Lists iSCSI initiator options.
-M –mtu -p -M <mtu_size> <adapter_name>
–pnp –mtu <mtu-size> <adapter_name>
Sets MTU size. Used with the
–pnp option.
-S –static -l <adapter_name>
–list <adapter_name>
Lists static discovery addresses.
-S –static -r -i <stor_ip_addr|stor_hostname> [:<portnum>] -n <target_name>
<adapter_name>
–remove –ip <stor_ip_addr|stor_hostname> [:<portnum>] -name
<target_name> <adapter_name>
Removes a static discovery
address.
-S –static -a -i <stor_ip_addr|stor_hostname> [:<portnum>]
-n <target_name> <adapter_name>
–add –ip <stor_ip_addr|stor_hostname> [:<portnum>]
-name <target_name> <adapter_name>
Adds a static discovery address.
-P –phba -l <adapter_name>
–list <adapter_name>
Lists external, vendor‐specific
properties of an iSCSI adapter.
-T –target -l <adapter_name>
–list <adapter_name>
Lists target information.
-W ‐‐parameter -l [-i <stor_ip_addr|stor_hostname> [:<portnum>]
[-n <iscsi_name]] <adapter_name>
–list [–ip <stor_ip_addr|stor_hostname> [:<portnum>]
[–name <iscsi_name]] <adapter_name>
Lists iSCSI parameter
information.
-W ‐‐parameter -l -k [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n
<iscsi_name]] <adapter_name>
–list –detail
[–ip <stor_ip_addr|stor_hostname> [:<portnum>]
[–name <iscsi_name]] <adapter_name>
Lists iSCSI parameter details.
-W ‐‐parameter -W -j <name>=<value>
-i <stor_ip_addr|stor_hostname> [:port_num>] [-n <iscsi_name>]]
<adapter_name>
–parameter –set <name>=<value>
–ip <stor_ip_addr|stor_hostname> [:port_num>]
[–name <iscsi_name>]] <adapter_name>
Sets iSCSI parameters.
-W ‐‐parameter -W -o <param_name>
-i <stor_ip_addr|stor_hostname> [:port_num>] [-n <iscsi_name>]]
<adapter_name>
-parameter –reset <param_name>
-ip <stor_ip_addr|stor_hostname> [:port_num>]
[-name <iscsi_name>]] <adapter_name>
Returns parameters in discovery
target or send target to default
inheritance behavior.
-z –reset_auth -a -z
-m <auth_method> -b
[-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]]
<adapter_name>
–authentication –reset_auth
–method <auth_method>
[–ip <stor_ip_addr|stor_hostname> [:<portnum>]
[–name <iscsi_name>]] <adapter_name>
Resets target level authentication
properties to be inherited from
adapter level. Used with the
–authentication option.

vCLI: Managing Storage

As I want to get deeper into VMware CLI (vCLI) I deciced to make a summary of the vSphere Command-Line Interface Installation and Scripting Guide. Every chapter will be a separate blog post.

This summary is meant for my documentation but feel free to make use of it.

In this blog post: Managing Storage

Examining LUNs

  • Listing all logical devices known on this system with detail information
    vicfg-scsidevs –list
  • List all logical devices with abbreviated information.
    vicfg-scsidevs –compact-listThe information includes the device ID, device type, size, plugin, and device display name.
  • List all device unique identifiers.
    vicfg-scsidevs –uids
    The command lists the primary UID for each device (naa.xxx or other primary name) and any other UIDs for each UID (VML name). You can specify –device to only list information for a specific device.
  • List a specific logical device with its detailed information.
    vicfg-scsidevs -l -d mpx.vmhba32:C0:T1:L0
  • Print mappings for VMFS volumes to the corresponding partition, path to that partition, VMFS uuid, extent number, and volume names.
    vicfg-scsidevs –vmfs
  • Print HBA devices with identifying information.
    vicfg-scsidevs –hbas
    The return value includes the adapter ID, driver ID, adapter UID, PCI, vendor, and model.
  • Print a mapping between HBAs and the devices it provides paths to.
    vicfg-scsidevs –hba-device-list

Managing paths with mpath

Listing paths

  • List all devices with their corresponding paths, state of the path, adapter type, and other information.
    vicfg-mpath <conn_options> –list-paths
  • Display a short listing of all paths.
    vicfg-mpath <conn_options> –list-compact
  • List all paths with adapter and device mappings.
    vicfg-mpath <conn_options> –list-map
  • List paths and detailed information by specifying the path UID (long path). The path UID is the first item
    in the vicfg-mpath –list display.
    vicfg-mpath <conn_options> –list -P sas.5001c231c79c4a00-sas.1221000001000000naa.5000c5000289c61b
  • List paths and detailed information by specifying the path runtime name.
    vicfg-mpath <conn_options> -l -P vmhba32:C0:T0:L0The return information includes the runtime name, device, device display name, adapter, adapter
    identifier, target identifier, plugin, state, transport, and adapter and target transport details.
  • List detailed information for the paths for the device specified with –device.
    vicfg-mpath <conn_options> -l -d mpx.vmhba32:C0:T1:L0
    vicfg-mpath <conn_options> –list –device naa.60060…

Changing the State of a Path

  • Set the state of a LUN to off
    vicfg-mpath <conn_options> –state off –path vmhba32:C0:T1:L0
  • Set the state of a LUN to on
    vicfg-mpath <conn_options> –state active –path vmhba32:C0:T1:L0

Note:
The change -PSPoperation will fail if I/O is active when the path setting is changed. Reissue the command.
You must issue at least one I/O operation before the change take effect.

Managing Path Policies

The following path selection policies are available with the NMP (Native Multipath Policy).

  • VMW_PSP_FIXED
    The host will always use the preferred path you have selected when it’s available. If the path ain’t available the policy will try another available path.
  • VMW_PSP_FIXED_AP
    Extension to the VMW_PSP_FIXED policy to active-passive and ALUA mode array’s
  • VMW_PSP_MRU
    The host will keep using the same path until it’s unavailable. If the current path is unavailable the host will try another path (random). When the first path come back the host will not fail back. It will keep using the same path.
  • VMW_PSP_RR
    The host will use round-robin through all available pahts. This policy is used for load balacing.

To change the path policy

  • To list the multipathing plugin loaded on the system
    vicfg-mpath <conn-options> –list-plugins
  • Set the path policy
    esxcli <conn_options> nmp device setpolicy –device naa.xxx –psp VMW_PSP_RR
  • Optional you have to specify the preffered path
    esxcli <conn_options> nmp fixed getpreferred –device naa.xxx
    esxcli <conn_options> nmp fixed setpreffered –device naa.xxx –path vmhba3:C0T2:L3
  • To view and manipulate round robin path selection settings
    esxcli <conn_options> nmp roundrobin getconfig –device na.xxx
    esxcli <conn_options> nmp roundrobin setconfig –type “bytes” -B 12345 –device naa.xxx (for bytes)
    esxcli <conn_options> nmp roundrobin setconfig –type=iops –iops 4200 –device naa.xxx (for iops)

Masking Paths with esxcli corestorage claimrule

  1. Run esxcli corestorage claimrules list to determine the next available rule ID.
    User rule IDs start at 101

    • Rules 0-100 are reserved for internal use by VMware.
    • Rules 101-65435 are available for general use.
    • Rules 65436-65535 are reserved for internal use by VMware.
  2. Decide which rule ID to use.
    The rules are used sequential. So make sure you use the correct rule ID or another claimrule will be used.
  3. Add the MASK_PATH plugin to the claim rule with the ID you decided to use.
    esxcli <conn_options> corestorage claimrule add –plugin MASK_PATH –rule <ruleID>
    –type <type> -A <adapter>
  4. Verify that the claim rule was added correctly.
    esxcli <conn_options> corestorage claimrule list
  5. Load the path claiming rules.
    esxcli <conn_options> corestorage claimrule load
  6. Release the device from the current plugin so that it can be claimed by another rule. For example, you
    might run the following command for each path:
    esxcli <conn_options> corestorage claiming unclaim -t location -A vmhba0 -C 0 -T 0 -L 149
  7. Run the path claiming rules, which include the newly added rules.
  8. esxcli <conn_options> corestorage claimrule run

To unmask the path

  1. Delete the MASK_PATH claim rule.
    esxcli <conn_options> corestorage claimrule delete -r <rule#>
  2. Verify that the claim rule was deleted correctly.
    esxcli <conn_options> corestorage claimrule list
  3. Reload the path claiming rules from the configuration file into the VMkernel.
    esxcli <conn_options> corestorage claimrule load
  4. Run esxcli corestorage claiming unclaim for each path to the masked device, for example:
    esxcli <conn_options> corestorage claiming unclaim -t location -A vmhba0 -C 0 -T 0 -L 149
  5. Run the path claiming rules.
    esxcli <conn_options> corestorage claimrule run

Managing NFS/NAS DAtastores

  • List all known NAS file systems.
    vicfg-nas <conn_options> -l
  • Add a new NAS file system to the ESX/ESXi host.
    vicfg-nas <conn_options –add –nasserver dir42.eng.vmware.com -s /<mount_dir> nfsstore-dir42
  • Add a second NAS file system with read‐only access.
    vicfg-nas <conn_options> -a -y –n esx42nas2 -s /home FileServerHome2
  • Delete one of the NAS file systems.
    vicfg-nas <conn_options> -d FileServerHome1

Migrating Virtual Machines with svmotion

  • Running svmotion in interactive mode (you will be prompted for the information)
    svmotion <conn_options> –interactive
  • Running svmotion in noninteracitve mode
    svmotion [standard vCLI options] –datacenter=<datacenter_name>
    –vm <VM config datastore path>:<new datastore>
    [–disks <virtual disk datastore path>:<new datastore>,
    <virtual disk datastore path>:<new datastore>]

    By default the –vm option will migrate the completed Virtual Machine to the new location (config files and vmdks)
    The –disks option will migrate only that vmdk.

Managing Duplicate VMFS Datastores with vicfg-volume

Each VMFS datastore created in a LUN has a unique UUID that is stored in the file system superblock. When
the LUN is replicated or a snapshot made, the resulting LUN copy is identical, byte‐for‐byte, to the original
LUN. As a result, if the original LUN contains a VMFS datastore with UUID X, the LUN copy appears to
contain an identical VMFS datastore, or a VMFS datastore copy, with the same UUID X.
ESX/ESXi hosts can determine whether a LUN contains the VMFS datastore copy, and either mount the
datastore copy with its original UUID or change the UUID to resignature the datastore.
When a LUN contains a VMFS datastore copy, you can mount the datastore with the existing signature or
assign a new signature.

To mount a datastore

  1. List all volumes that have been detected as snapshots or replicas.
    vicfg-volume <conn_options> –list
  2. Run vicfg-volume –persistent-mount with the VMFS‐UUID or label as an argument to mount a
    volume.
    vicfg-volume <conn_options> –persistent-mount <VMFS-UUID|label>

To umount a datastore

  1. vicfg-volume <conn_options> –unmount <VMFS-UUID|label>

Resignature  a VMFS copy

  • Datastore resignaturing is irreversible.
  • The LUN copy that contains the VMFS datastore that you resignature is no longer treated as a LUN copy.
  • A spanned datastore can be resignatured only if all its extents are online.
  • The resignaturing process is crash and fault tolerant. If the process is interrupted, you can resume it later.
  • You can mount the new VMFS datastore without a risk of its UUID conflicting with UUIDs of any other
    datastore, such as an ancestor or child in a hierarchy of LUN snapshots.
  1. Make sure the copy is not mounted.
  2. Run vicfg-volume with the resignature option.
    vicfg-volume <conn_options> –resignature <VMFS-UUID|label>
    The command returns to the prompt or signals an error.
  3. It’spossible that vmx, vmdk, vmsd or vmsn file has a reference to the original signature. You will have to change these.

Rescanning Storage Adapters

  • vicfg-rescan <conn_options> vmhba1