sidebar | permalink | keywords | summary |
---|---|---|---|
sidebar |
vmware/vsphere_ontap_auto_block_iscsi.html |
vSphere, datastore, VMFS, iSCSI, ONTAP tools, vlan, network interface, service policy |
This page provides steps to deploy a NetApp ONTAP storage iSCSI VMFS datastore in a VMware vSphere environment. |
This section covers the creation of a VMFS datastore with ONTAP iSCSI storage.
For automated provisioning, use the following script: Ansible Playbook.
-
The basic skills necessary to manage a vSphere environment and ONTAP.
-
An ONTAP storage system (FAS/AFF/CVO/ONTAP Select/ASA) running ONTAP 9.8 or later
-
ONTAP credentials (SVM name, userID, and password)
-
ONTAP network port, SVM, and LUN information for iSCSI
-
vCenter Server credentials
-
vSphere host(s) information
-
vSphere 7.0 or later
-
-
iSCSI VMKernel adapter IP information
-
Network switch(es)
-
With ONTAP system network data ports and connected vSphere hosts
-
VLAN(s) configured for iSCSI
-
(Optional) link aggregation configured for ONTAP network data ports
-
-
ONTAP Tool for VMware vSphere deployed, configured, and ready to consume
-
Check compatibility with the Interoperability Matrix Tool (IMT).
-
Complete the following ONTAP and vSphere tasks.
-
Verify the ONTAP license for iSCSI.
-
Use the
system license show
command to check if iSCSI is listed. -
Use
license add -license-code <license code>
to add the license.
-
-
Verify that iSCSI network logical interfaces are available on the SVM.
NoteWhen an SVM is created using the GUI, iSCSI network interfaces are also created. -
Use the
Network interface
command to view or make changes to the network interface.TipTwo iSCSI network interfaces per node are recommended. -
Create an iSCSI network interface. You can use the default-data-blocks service policy.
-
Verify that the data-iscsi service is included in the service policy. You can use
network interface service-policy show
to verify. -
Create and map the LUN. Skip this step if you are using ONTAP tools for VMware vSphere. Repeat this step for each LUN.
-
Verify that at least one NIC is available for the iSCSI VLAN. Two NICs are preferred for better performance and fault tolerance.
-
Identify the number of physical NICs available on the vSphere host.
-
Configure the iSCSI initiator. A typical use case is a software iSCSI initiator.
-
Verify that iSCSI portgroups are available.
-
We typically use a single virtual switch with multiple uplink ports.
-
Use 1:1 adapter mapping.
-
-
Verify that iSCSI VMKernel adapters are enabled to match the number of NICs and that IPs are assigned.
-
Bind the iSCSI software adapter to the iSCSI VMKernel adapter(s).
-
Provision the VMFS datastore with ONTAP Tools. Repeat this step for all datastores.
After these the tasks are completed, the VMFS datastore is ready to consume for provisioning virtual machines.
## Disclaimer: Sample script for reference purpose only.
- hosts: '{{ vsphere_host }}'
name: Play for vSphere iSCSI Configuration
connection: local
gather_facts: false
tasks:
# Generate Session ID for vCenter
- name: Generate a Session ID for vCenter
uri:
url: "https://{{ vcenter_hostname }}/rest/com/vmware/cis/session"
validate_certs: false
method: POST
user: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
force_basic_auth: yes
return_content: yes
register: vclogin
# Generate Session ID for ONTAP tools with vCenter
- name: Generate a Session ID for ONTAP tools with vCenter
uri:
url: "https://{{ ontap_tools_ip }}:8143/api/rest/2.0/security/user/login"
validate_certs: false
method: POST
return_content: yes
body_format: json
body:
vcenterUserName: "{{ vcenter_username }}"
vcenterPassword: "{{ vcenter_password }}"
register: login
# Get existing registered ONTAP Cluster info with ONTAP tools
- name: Get ONTAP Cluster info from ONTAP tools
uri:
url: "https://{{ ontap_tools_ip }}:8143/api/rest/2.0/storage/clusters"
validate_certs: false
method: Get
return_content: yes
headers:
vmware-api-session-id: "{{ login.json.vmwareApiSessionId }}"
register: clusterinfo
- name: Get ONTAP Cluster ID
set_fact:
ontap_cluster_id: "{{ clusterinfo.json | json_query(clusteridquery) }}"
vars:
clusteridquery: "records[?ipAddress == '{{ netapp_hostname }}' && type=='Cluster'].id | [0]"
- name: Get ONTAP SVM ID
set_fact:
ontap_svm_id: "{{ clusterinfo.json | json_query(svmidquery) }}"
vars:
svmidquery: "records[?ipAddress == '{{ netapp_hostname }}' && type=='SVM' && name == '{{ svm_name }}'].id | [0]"
- name: Get Aggregate detail
uri:
url: "https://{{ ontap_tools_ip }}:8143/api/rest/2.0/storage/clusters/{{ ontap_svm_id }}/aggregates"
validate_certs: false
method: GET
return_content: yes
headers:
vmware-api-session-id: "{{ login.json.vmwareApiSessionId }}"
cluster-id: "{{ ontap_svm_id }}"
when: ontap_svm_id != ''
register: aggrinfo
- name: Select Aggregate with max free capacity
set_fact:
aggr_name: "{{ aggrinfo.json | json_query(aggrquery) }}"
vars:
aggrquery: "max_by(records, &freeCapacity).name"
- name: Convert datastore size in MB
set_fact:
datastoreSizeInMB: "{{ iscsi_datastore_size | human_to_bytes/1024/1024 | int }}"
- name: Get vSphere Cluster Info
uri:
url: "https://{{ vcenter_hostname }}/api/vcenter/cluster?names={{ vsphere_cluster }}"
validate_certs: false
method: GET
return_content: yes
body_format: json
headers:
vmware-api-session-id: "{{ vclogin.json.value }}"
when: vsphere_cluster != ''
register: vcenterclusterid
- name: Create iSCSI VMFS-6 Datastore with ONTAP tools
uri:
url: "https://{{ ontap_tools_ip }}:8143/api/rest/3.0/admin/datastore"
validate_certs: false
method: POST
return_content: yes
status_code: [200]
body_format: json
body:
traditionalDatastoreRequest:
name: "{{ iscsi_datastore_name }}"
datastoreType: VMFS
protocol: ISCSI
spaceReserve: Thin
clusterID: "{{ ontap_cluster_id }}"
svmID: "{{ ontap_svm_id }}"
targetMoref: ClusterComputeResource:{{ vcenterclusterid.json[0].cluster }}
datastoreSizeInMB: "{{ datastoreSizeInMB | int }}"
vmfsFileSystem: VMFS6
aggrName: "{{ aggr_name }}"
existingFlexVolName: ""
volumeStyle: FLEXVOL
datastoreClusterMoref: ""
headers:
vmware-api-session-id: "{{ login.json.vmwareApiSessionId }}"
when: ontap_cluster_id != '' and ontap_svm_id != '' and aggr_name != ''
register: result
changed_when: result.status == 200