10 min read

In this article by Jeffery Taylor, the author of the book VMware Virtual SAN Cookbook, we have a functional VSAN cluster, we can leverage the power of Storage Policy-based Management (SPBM) to control how we deploy our virtual machines (VMs).We will discuss the following topics, with a recipe for each:

  • Creating storage policies
  • Applying storage policies to a new VM or a VM deployed from a template
  • Applying storage policies to an existing VM migrating to VSAN
  • Viewing a VM’s storage policies and object distribution
  • Changing storage policies on a VM already residing in VSAN
  • Modifying existing storage policies

(For more resources related to this topic, see here.)

Introduction

SPBM is where the administrative power of converged infrastructure becomes apparent. You can define VM-thick provisioning on a sliding scale, define how fault tolerant the VM’s storage should be, make distribution and performance decisions, and more. RAID-type decisions for VMs resident on VSAN are also driven through the use of SPBM. VSAN can provide RAID-1 (mirrored) and RAID-0 (striped) configurations, or a combination of the two in the form of RAID-10 (mirrored set of stripes).

All of this is done on a per-VM basis. As the storage and compute infrastructures are now converged, you can define how you want a VM to run in the most logical place—at the VM level or its disks. The need for a datastore-centric configuration, storage tiering, and so on is obviated and made redundant through the power of SPBM.

Technically, the configuration of storage policies is optional. If you choose not to define any storage policies, VSAN will create VMs and disks according to its default cluster-wide storage policy. While this will provide for generic levels of fault tolerance and performance, it is strongly recommended to create and apply storage policies according to your administrative need. Much of the power given to you through a converged infrastructure and VSAN is in the policy-driven and VM-centric nature of policy-based management.
While some of these options will be discussed throughout the following recipes, it is strongly recommended that you review the storage-policy appendix to familiarize yourself with all the storage-policy options prior to continuing.

Creating VM storage policies

Before a storage policy can be applied, it must be created. Once created, the storage policy can be applied to any part of any VM resident on VSAN-connected storage. You will probably want to create a number of storage policies to suit your production needs. Once created, all storage policies are tracked by vCenter and enforced/maintained by VSAN itself. Because of this, your policy selections remain valid and production continues even in the event of a vCenter outage.

In the example policy that we will create in this recipe, the VM policy will be defined as tolerating the failure of a single VSAN host. The VM will not be required to stripe across multiple disks and it will be 30percent thick-provisioned.

Getting ready

Your VSAN should be deployed and functional as per the previous article. You should be logged in to the vSphere Web Client as an administrator or as a user with rights to create, modify, apply, and delete storage policies.

How to do it…

  1. From the vSphere 5.5 Web Client, navigate to Home | VM Storage Policies.
  2. From the vSphere 6.0 Web Client, navigate to Home | Policies and Profiles | VM Storage Policies. Initially, there will be no storage policies defined unless you have already created storage policies for other solutions. This is normal.

    In VSAN 6.0, you will have the VSAN default policy defined here prior to the creation of your own policies.

  3. Click the Create a new VM storage policy button:

     VMware Virtual SAN Cookbook

  4. A wizard will launch to guide you through the process.
  5. If you have multiple vCenter Server systems in linked-mode, ensure that you have selected the appropriate vCenter Server system from the drop-down menu.
  6. Give your storage policy a name that will be useful to you and a description of what the policy does. Then, click Next:

     VMware Virtual SAN Cookbook

  7. The next page describes the concept of rule sets and requires no interaction. Click the Next button to proceed.
  8. When creating the rule set, ensure that you select VSAN from the Rules based on vendor-specific capabilities drop-down menu. This will expose the <Add capability> button. Select Number of failures to tolerate from the drop-down menu and specify a value of 1:

     VMware Virtual SAN Cookbook

  9. Add other capabilities as desired. For this example, we will specify a single stripe with 30% space reservation.
  10. Once all required policy definitions have been applied, click Next:

     VMware Virtual SAN Cookbook

  11. The next page will tell you which datastores are compatible with the storage policy you have created. As this storage policy is based on specific capabilities exposed by VSAN, only your VSAN datastore will appear as a matching resource. Verify that the VSAN datastore appears, and then click Next.
  12. Review the summary page and ensure that the policy is being created on the basis of your specifications. When finished, click Finish.
  13. The policy will be created. Depending on the speed of your system, this operation should be nearly instantaneous but may take several seconds to finish.

How it works…

The VSAN-specific policy definitions are presented through VMware Profile-Driven Storage service, which runs with vCenter Server. Profile-Driven Storage Service determines which policy definitions are available by communicating with the ESXi hosts that are enabled for VSAN. Once VSAN is enabled, each host activates a VASA provider daemon, which is responsible for communicating policy options to and receiving policy instructions from Profile-Driven Storage Service.

There’s more…

The nature of the storage policy definitions enabled by VSAN is additive. No policy option mutually excludes any other, and they can be combined in any way that your policy requirements demand. For example, specifying a number of failures to tolerate will not preclude the specification cache reservation.

See also

  • For a full explanation of all policy options and when you might want to use them

Applying storage policies to a new VM or a VM deployed from a template

When creating a new VM on VSAN, you will want to apply a storage policy to that VM according to your administrative needs. As VSAN is fully integrated into vSphere and vCenter, this is a straightforward option during the normal VM deployment wizard.

The workflow described in this recipe is for creating a new VM on VSAN. If deployed from a template, the wizard process is functionally identical from step 4 of the How to do it… section in this recipe.

Getting ready

You should be logged into vSphere Web Client as an administrator or a user authorized to create virtual machines.

You should have at least one storage policy defined (see previous recipe).

How to do it…

  1. Navigate to Home | Hosts and Clusters | Datacenter | Cluster.
  2. Right-click the cluster, and then select New Virtual Machine…:

     VMware Virtual SAN Cookbook

  3. In the subsequent screen, select Create a new virtual machine.
  4. Proceed through the wizard through Step 2b. For the compute resource, ensure that you select your VSAN cluster or one of its hosts:

     VMware Virtual SAN Cookbook

  5. On the next step, select one of the VM storage policies that you created in the previous recipe. Once you select a VSAN storage policy, only the VSAN datastore will appear as compatible. Any other datastores that you have present will be ineligible for selection:

     VMware Virtual SAN Cookbook

  6. Complete the rest of the VM-deployment wizard as you normally would to select the guest OS, resources, and so on.
  7. Once completed, the VM will deploy and it will populate in the inventory tree on the left side. The VM summary will reflect that the VM resides on the VSAN storage:

     VMware Virtual SAN Cookbook

How it works…

All VMs resident on the VSAN storage will have a storage policy applied. Selecting the appropriate policy during VM creation means that the VM will be how you want it to be from the beginning of the VM’s life. While policies can be changed later, this could involve a reconfiguration of the object, which can take time to complete and can result in increased disk and network traffic once it is initiated. Careful decision making during deployment can help you save time later.

Applying storage policies to an existing VM migrating to VSAN

When introducing VSAN into an existing infrastructure, you may have existing VMs that reside on the external storage, such as NFS, iSCSI, or Fibre Channel (FC). When the time comes to move these VMs into your converged infrastructure and VSAN, we will have to make policy decisions about how these VMs should be handled.

Getting ready

You should be logged into vSphere Web Client as an administrator or a user authorized to create, migrate, and modify VMs.

How to do it…

  1. Navigate to Home | Hosts and Clusters | Datacenter | Cluster.
  2. Identify the VM that you wish to migrate to VSAN. For the example used in this recipe, we will migrate the VM called linux-vm02 that resides on NFS Datastore.
  3. Right-click the VM and select Migrate… from the context menu:

     VMware Virtual SAN Cookbook

  4. In the resulting page, select Change datastore or Change both host and datastore as applicable, and then click Next.

    If the VM does not already reside on one of your VSAN-enabled hosts, you must choose the Change both host and datastore option for your migration.

  5. In the next step, select one of the VM storage policies that you created in the previous recipe. Once you select a VSAN storage policy, only the VSAN datastore will appear as compatible. Any other datastores that you have present will be ineligible for selection:

     VMware Virtual SAN Cookbook

    You can apply different storage policies to different VM disks. This can be done by performing the following steps:

    1. Click on the Advanced >> button to reveal various parts of the VM:

      Once clicked, the Advanced >> button will change to << Basic.

       VMware Virtual SAN Cookbook

    2. In the Storage column, click the existing datastore to reveal a drop-down menu. Click Browse. In the subsequent window, select the desired policy from the VM Storage Policy drop-down menu. You will find that the only compatible datastore is your VSAN datastore. Click OK:

       VMware Virtual SAN Cookbook

    3. Repeat the preceding step as needed for other disks and the VM configuration file.
  6. After performing the preceding steps, click on Next.
  7. Review your selection on the final page, and then click Finish.
  8. Migrations can potentially take a long time, depending on how large the VM is, the speed of the network, and other considerations. Please monitor the progress of your VM relocation tasks using the Recent Tasks pane:

     VMware Virtual SAN Cookbook

  9. Once the migration task finishes, the VM’s Summary tab will reflect that the datastore is now the VSAN datastore. For the example of this VM, the VM moved from NFS Datastore to vsanDatastore:

     VMware Virtual SAN Cookbook

How it works…

Much like the new VM workflow, we select the storage policy that we want to use during the migration of the VM to VSAN. However, unlike the deploy-from-template or VM-creation workflows, this process requires none of the VM configuration steps. We only have to select the storage policy, and then SPBM instructs VSAN how to place and distribute the objects. All object-distribution activities are completely transparent and automatic.

This process can be used to change the storage policy of a VM already resident in the VSAN cluster, but it is more cumbersome than modifying the policies by other means.

Summary

In this article, we learned that storage policies give you granular control over how the data for any given VM or VM disk is handled.

Storage policies allow you to define how many mirrors (RAID-1) and how many stripes (RAID-0) are associated with any given VM or VM disk.

Resources for Article:


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here