Associating VMware instances with SLA policies

Associate VMware instances with SLA policies. IBM Spectrum Protect Plus allows you to specify them at four different levels: datacenters, folders, virtual machines, and hard disks. To associate all the instances under a specific VMware vCenter, select all the datacenters under it instead.

_images/refmanageprotection_vmware_assoc3.png

(Continued.) Associate folders with SLA policies from the drill-down menu.

_images/refmanageprotection_vmware_assoc4.png

(Continued.) Associate virtual machines with SLA policies from the drill-down menu.

_images/refmanageprotection_vmware_assoc5.png

(Continued.) Associate hard disks with SLA policies from the drill-down menu.

Method and URI

To associate SLA policies with VMware instances, use a POST method and a URI:

POST    https://{hostname|IP}/ngp/hypervisor

This POST request is idempotent.

Parameters

Parameter 1: action

Apply SLA policies to target hypervisors.

  • Value: applySLAPolicies

  • Type: System string. Required. Available in the web user interface.

Data

Data 1: subtype

The type of the virtualized system.

  • Value: vmware

  • Type: System string. Required. Available in the web user inteface.

Data 2: resources

Key

Value (example)

Type

Description

subtype

vmware

System |b|

Type of hypervisor servers

resources

[{…}, …, {…}]

Array |b|

Specify hypervisor servers

slapolicies

[{…}, …, {…}]

Array |b|

Specify SLA policies

resources:

Key

Value (example)

Type

Description

href

https://…

String |s|

URI of the VMware instance

id

4f0c8182d0507f2f4a3ffe374bc40a32

String |s|

ID of the VMware instance

metapath

/MS:1001/DC:f76ed…/FLDR:4f0c…

String |s|

Metapath of the VMware instance

resources > href:

Use the following URI format for a datacenter:

https://{hostname|IP}/api/hypervisor/{hypervisorHypervisorId}
    /datacenter/{hypervisorDatacenterId}

Tip

To get a {hypervisorDatacenterId} value based on its name, follow the instructions in Getting a {hypervisorDatacenterId}.

Use the following URI format for a folder:

https://{hostname|IP}/api/hypervisor/{hypervisorHypervisorId}
    /folder/{hypervisorFolderId}

Tip

To get a {hypervisorFolderId} value based on its name, follow the instructions in Getting a {hypervisorFolderId} for a VMware environment.

Use the following URI format for a virtual machine:

https://{hostname|IP}/api/hypervisor/{hypervisorHypervisorId}
    /vm/{hypervisorVmId}

Tip

To get a {hypervisorVmId} value based on its name, follow the instructions in Getting a {hypervisorVmId}.

Use the following URI format for a hard disk:

https://{hostname|IP}/api/hypervisor/{hypervisorHypervisorId}
    /vdisk/{hypervisorVdiskId}

Tip

To get a {hypervisorVdiskId} value based on its name, follow the instructions in Getting a {hypervisorVdiskId} for a VMware environment.

resources > metapath:

The metapath of the target object has the following structure:

/MS:{hypervisorHypervisorId}
/DC:{hypervisorDatacenterId}
/FLDR:{hypervisorFolderId1}
/FLDR:{hypervisorFolderId2}
...
/VM:{hypervisorVmId}
/VDSK:{hypervisorVdiskId}

As above, multilevel folders are represented by a series of /FLDR:{hypervisorFolderId}. Omit the child items such as hard disks, virtual machines, and folders to make the metapath of the parent instance. For example, a metapath of a datacenter has the following format:

/MS:{hypervisorHypervisorId}/DC:{hypervisorDatacenterId}

slapolicies:

Key

Value (example)

Type

Description

href

https://…

String |s|

URI of the SLA policy

id

2000

String |s|

{slapolicyId} of the SLA policy

name

Gold

String |b|

Name of the SLA policy

Tip

To get an {slapolicyId} value based on its name, follow the instructions in Getting an {slapolicyId}.

To associate with no SLA policies, use

"slapolicies": []

Example 1: Associate no SLA policy with a datacenter

Assume that you want to associate no SLA policy with the following datacenter:

  • Hypervisor: VMware - Dallas ({hypervisorHypervisorId}: 1001)

  • Datacenter: BlueMachines - Dallas - DataCenter1 ({hypervisorDatacenterId}: f76edd18b1d3ce7865bbab693881ab53)

  • SLA policies: None.

hypervisor_hypervisor_id = "1001"    # VMware - Dallas
hypervisor_datacenter_id = "f76edd18b1d3ce7865bbab693881ab53"

_params = {"action": "applySLAPolicies"}

_data = f'''{{
    "subtype":   "vmware",
    "version":   "1.0",
    "resources": [
        {{
            "href":         "https://{spp_ipv4}/api/hypervisor/{hypervisor_hyper
visor_id}/datacenter/{hypervisor_datacenter_id}",
            "id":           "{hypervisor_datacenter_id}",
            "metadataPath": "/MS:{hypervisor_hypervisor_id}/DC:{hypervisor_datac
enter_id}"
        }}
    ],
    "slapolicies": []
}}'''

requests.post('https://' + spp_ipv4 + '/ngp/hypervisor',
    headers={...}, params=_params, data=_data, verify=...)
_images/refmanageprotection_vmware_assoc2.png

The same action can be taken in the IBM Spectrum Protect Plus web user interface: In the VMware pane, select the datacenter from the drill-down menu, click Select SLA Policy, uncheck all the SLA policies, and click Save.

The request prompts a response that is similar to the response body in Getting information about virtualized systems, with the HTTP status of 201 (Created). Review the response to ensure that the datacenter is not associated with any SLA policy.

Example2: Associate SLA policies with folders

Assume that you want to associate the following SLA policies with the folders.

  • Hypervisor: VMware - Dallas ({hypervisorHypervisorId}: 1001)

  • Datacenter: BlueMachines - Dallas - DataCenter1 ({hypervisorDatacenterId}: f76edd18b1d3ce7865bbab693881ab53)

  • Folders:

    • Lab folder ({hypervisorFolderId} 7cdc5a08345ca923f02d330bc131b5a0)

    • Production folder ({hypervisorFolderId} e7d4515b0177f815491f91b7dee932e0)

  • SLA policies:

    • Gold ({slapolicyId} 2000)

    • Diamond ({slapolicyId} 2005)

hypervisor_hypervisor_id = "1001"
hypervisor_datacenter_id = "f76edd18b1d3ce7865bbab693881ab53"

hypervisor_folder_id1 = "7cdc5a08345ca923f02d330bc131b5a0"
hypervisor_folder_id2 = "e7d4515b0177f815491f91b7dee932e0"

sla_name1 = "Gold"
sla_id1 = "2000"

sla_name2 = "Diamond"
sla_id2 = "2005"

_params = {"action": "applySLAPolicies"}

_data = f'''{{
    "subtype":   "vmware",
    "version":   "1.0",
    "resources": [
        {{
            "href":         "https://{spp_ipv4}/api/hypervisor/{hypervisor_hyper
visor_id}/folder/{hypervisor_folder_id1}",
            "id":           "{hypervisor_folder_id1}",
            "metadataPath": "/MS:{hypervisor_hypervisor_id}/DC:{hypervisor_datac
enter_id}/FLDR:{hypervisor_folder_id1}"
        }},
        {{
            "href":         "https://{spp_ipv4}/api/hypervisor/{hypervisor_hyper
visor_id}/folder/{hypervisor_folder_id2}",
            "id":           "{hypervisor_folder_id2}",
            "metadataPath": "/MS:{hypervisor_hypervisor_id}/DC:{hypervisor_datac
enter_id}/FLDR:{hypervisor_folder_id2}"
        }}
    ],
    "slapolicies": [
        {{
            "href":"https://{spp_ipv4}/api/spec/storageprofile/{sla_id1}",
            "id":"{sla_id1}",
            "name":"{sla_name1}"
        }},
        {{
            "href":"https://{spp_ipv4}/api/spec/storageprofile/{sla_id2}",
            "id":"{sla_id2}",
            "name":"{sla_name2}"
        }}
    ]
}}'''

requests.post('https://' + spp_ipv4 + '/ngp/hypervisor',
    headers={...}, params=_params, data=_data, verify=...)

The request prompts a response that is similar to the response body in Getting information about virtualized systems, with the HTTP status of 201 (Created). Review the response to ensure that the folders are associated with the SLA policies.

Example 3: Associate an SLA policy with a virutal machine

Assume that you want to associate the following SLA policy with the virtual machine.

  • Hypervisor: VMware - Dallas ({hypervisorHypervisorId}: 1001)

  • Datacenter: BlueMachines - Dallas - DataCenter1 ({hypervisorDatacenterId}: f76edd18b1d3ce7865bbab693881ab53)

  • Folder: Lab folder ({hypervisorFolderId} 7cdc5a08345ca923f02d330bc131b5a0)

  • Virtual machine: VM ({hypervisorVmId} ec44616651cda8b66fec4f7fd0daf554

  • SLA policy: Gold ({slapolicyId} 2000)

hypervisor_hypervisor_id = "1001"
hypervisor_datacenter_id = "f76edd18b1d3ce7865bbab693881ab53"
hypervisor_folder_id = "7cdc5a08345ca923f02d330bc131b5a0"
hypervisor_vm_id = "ec44616651cda8b66fec4f7fd0daf554"

sla_name = "Gold"
sla_id = "2000"

_params = {"action": "applySLAPolicies"}

_data = f'''{{
    "subtype":   "vmware",
    "version":   "1.0",
    "resources": [
        {{
            "href":         "https://{spp_ipv4}/api/hypervisor/{hypervisor_hyper
visor_id}/vm/{hypervisor_vm_id}",
            "id":           "{hypervisor_vm_id}",
            "metadataPath": "/MS:{hypervisor_hypervisor_id}/DC:{hypervisor_datac
enter_id}/FLDR:{hypervisor_folder_id}/VM:{hypervisor_vm_id}"
        }}
    ],
    "slapolicies": [
        {{
            "href":"https://{spp_ipv4}/api/spec/storageprofile/{sla_id}",
            "id":"{sla_id}",
            "name":"{sla_name}"
        }}
    ]
}}'''

requests.post('https://' + spp_ipv4 + '/ngp/hypervisor',
    headers={...}, params=_params, data=_data, verify=...)

The request prompts a response that is similar to the response body in Getting information about virtualized systems, with the HTTP status of 201 (Created). Review the response to ensure that the folders are associated with the SLA policies.

Example 4: Associate an SLA policy with a hard disk

Assume that you want to associate the following SLA policy with the hard disk under the VMware vCenter server.

  • Hypervisor: VMware - Dallas ({hypervisorHypervisorId}: 1001)

  • Datacenter: BlueMachines - Dallas - DataCenter1 ({hypervisorDatacenterId}: f76edd18b1d3ce7865bbab693881ab53)

  • Folder: Lab folder ({hypervisorFolderId} 7cdc5a08345ca923f02d330bc131b5a0)

  • Virtual machine: VM ({hypervisorVmId} ec44616651cda8b66fec4f7fd0daf554

  • Hard disk: Hard disk 1 ({hypervisorVdiskId} e738a8a316cc11e8f7f84fa903e3dddc

  • SLA policy: Gold ({slapolicyId} 2000)

hypervisor_hypervisor_id = "1001"
hypervisor_datacenter_id = "f76edd18b1d3ce7865bbab693881ab53"
hypervisor_folder_id = "7cdc5a08345ca923f02d330bc131b5a0"
hypervisor_vm_id = "ec44616651cda8b66fec4f7fd0daf554"
hypervisor_vdisk_id = "e738a8a316cc11e8f7f84fa903e3dddc"

sla_name = "Gold"
sla_id = "2000"

_params = {"action": "applySLAPolicies"}

_data = f'''{{
    "subtype":   "vmware",
    "version":   "1.0",
    "resources": [
        {{
            "href":         "https://{spp_ipv4}/api/hypervisor/{hypervisor_hyper
visor_id}/vdisk/{hypervisor_vdisk_id}",
            "id":           "{hypervisor_vdisk_id}",
            "metadataPath": "/MS:{hypervisor_hypervisor_id}/DC:{hypervisor_datac
enter_id}/FLDR:{hypervisor_folder_id}/VM:{hypervisor_vm_id}/VDISK:{hypervisor_v
disk_id}"
        }}
    ],
    "slapolicies": [
        {{
            "href":"https://{spp_ipv4}/api/spec/storageprofile/{sla_id}",
            "id":"{sla_id}",
            "name":"{sla_name}"
        }}
    ]
}}'''

requests.post('https://' + spp_ipv4 + '/ngp/hypervisor',
    headers={...}, params=_params, data=_data, verify=...)

The request prompts a response that is similar to the response body in Getting information about virtualized systems, with the HTTP status of 201 (Created). Review the response to ensure that the folders are associated with the SLA policies.