Hypervisor

For the hypervisor collection resource, you can use an object value to return another value for the same object.

Getting a {hypervisorHypervisorId}

IBM Spectrum Protect Plus assigns an ID, {hypervisorHypervisorId}, to each virtualized system server. The virtualized systems can be associated with vCenter Servers, Hyper-V servers, or Amazon EC2 accounts.

Method and URI: To convert the value of an object for a virtualized system, use a GET method with a URI:

GET     https://{hostname|IP}/api/hypervisor/

Path: Response body (JSON) > hypervisors > name & id

Example: Assume that you added a vCenter Server instance, 10.0.0.10 (VMware-Dallas), to IBM Spectrum Protect Plus. A Python snippet that is similar to the following example can be used to return its {hypervisorHypervisorId} value, 1001:

 object_name = "10.0.0.10"    # VMware-Dallas

 _response = requests.get('https://' + spp_ipv4 + '/api/hypervisor/',
     headers=..., verify=...)

 _response_json = json.loads(_response.text)    # Convert to JSON

 object_json = _response_json['hypervisors']

 for keys in object_json:
     if keys['name'] == object_name
         object_id = keys['id']

 print(object_id)
1001

Getting a {hypervisorDatacenterId}

In VMware vCenter, every vCenter Server has one or more datacenters. With IBM Spectrum Protect Plus, you can associate SLA policies with datacenters.

Method and URI: To convert the value of an object for a datacenter, use a GET method with a URI:

GET     https://{hostname|IP}/api/hypervisor/{hypervisorHypervisorId}
           /vmcontent

Path: Response body (JSON) > contents > name & id

Example: Assume that you added a vCenter Server, 10.0.0.10 (VMware-Dallas, {hypervisorHypervisorId} 1001), to IBM Spectrum Protect Plus. You have a datacenter, Dallas - Datacenter2. A Python snippet that is similar to the following example can be used to return the datacenter’s {hypervisorDatacenterId} value, 76edd18b1d3ce7865bbab693881ab53:

 hypervisor_hypervisor_id = "1001"    # 10.0.0.10 (VMware-Dallas)
 object_name = "Dallas-DataCenter2"

 _response = requests.get('https://' + spp_ipv4 + '/api/hypervisor/'
     + hypervisor_hypervisor_id + '/vmcontent',
     headers=..., verify=...)

 _response_json = json.loads(_response.text)    # Convert to JSON

 object_json = _response_json['contents']

 for keys in object_json:
     if keys['name'] == object_name:
         object_id = keys['id']

 print(object_id)
76edd18b1d3ce7865bbab693881ab53

Getting a {hypervisorFolderId} for a VMware environment

In an environment that is managed by VMware vCenter Server software, you can create multilevel folders in datacenters. IBM Spectrum Protect Plus assigns an ID, {hypervisorFolderId}, to each VMware folder and subfolder.

Method and URI: To get the ID of the folder in the datacenter folder (the root folder), use a GET method and a URI:

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

To get the ID of the subfolder in the folder or another subfolder with {hypervisorFolderId}, use a GET method and URI:

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

Path: Response body (JSON) > contents > name & id

Example: Assume that you added a VMware vCenter Server to IBM Spectrum Protect Plus. The vCenter Server name is 10.0.0.10 (VMware-Dallas) and the {hypervisorHypervisorId} value is 1001. You also have a datacenter that is named Dallas - Datacenter2 with a {hypervisorDatacenterId} value of 76edd18b1d3ce7865bbab693881ab53. In this datacenter, you added a folder, Production. A Python snippet that is similar to the following example can be used to return the {hypervisorFolderId} value, 6c5c1265cb91ca615ec16221fc0befe8:

 object_name = "Production"

 hypervisor_hypervisor_id = "1001"    # 10.0.0.10 (VMware-Dallas)
 hypervisor_datacenter_id = "76edd18b1d3ce7865bbab693881ab53"
     # Dallas-DataCenter2

 _response = requests.get('https://' + spp_ipv4 + '/api/hypervisor/'
     + hypervisor_hypervisor_id + '/datacenter/' + hypervisor_datacenter_id
     + '/vmcontent',
     headers=..., verify=...)

 _response_json = json.loads(_response.text)    # Convert to JSON

 object_json = _response_json['contents']

 for keys in object_json:
     if keys['name'] == object_name:
         object_id = keys['id']

 print(object_id)
6c5c1265cb91ca615ec16221fc0befe8

Assume that you added a subfolder, online-services-subfolder, in the Production folder. A Python snippet that is similar to the following example can be used to return the {hypervisorFolderId} value of this subfolder, 51d0128ff2ece10133fc1e34acbbf86f:

 object_name = "online-services-subfolder"

 hypervisor_hypervisor_id = "1001"    # 10.0.0.10 (VMware-Dallas)
 hypervisor_folder_id = "6c5c1265cb91ca615ec16221fc0befe8"    # Production

 _response = requests.get('https://' + spp_ipv4 + '/api/hypervisor/'
     + hypervisor_hypervisor_id + '/folder/' + hypervisor_folder_id
     + '/vmcontent',
     headers=..., verify=...)

 _response_json = json.loads(_response.text)    # Convert to JSON

 object_json = _response_json['contents']

 for keys in object_json:
     if keys['name'] == object_name:
         object_id = keys['id']

 print(object_id)
51d0128ff2ece10133fc1e34acbbf86f

In a VMware datacenter, you can create nested folders. Folders and subfolders within the hierarchy can have the same names, if the folders or subfolders with matching names have different folder paths. For example, assume that you have a VMware datacenter with folder New_York. You cannot create another folder using the same name, New_York, because these two folders share the same folder path. By contrast, you can create a subfolder, New_York, in the New_York folder because the two folders have different paths.

_images/converter_vmwarefolders1.png

Figure 90 In a VMware datacenter, you can create multiple, nested folders. You can use the same name for multiple folders or subfolders, if the matching folders or subfolders do not share the same path.

Getting a {hypervisorVmId}

Every virtual machine on VMware and Microsoft Hyper-V will have an ID, {hypervisorVmId}.

Method and URI: To get the ID of the folder in the datacenter folder (the root folder), use a GET method and a URI:

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

If the target VMware virtual machine is in a folder or a subfolder, use the following URI:

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

To get the ID of the virtual machine that is hosted by Hyper-V or Amazon EC2, use a GET method with a URI:

GET     https://{hostname|IP}/api/hypervisor/{hypervisorHypervisorId}

Path: Response body (JSON) > contents > name & id

Example: Assume that you have a virtual machine, Service-Dallas, in a subfolder, online-services-childfolder. The value of the {hypervisorFolderId} is 7a2ab40929457c84ed9c0e276a19f9ea. The server name is 10.0.0.10 (VMware - Dallas) and the {hypervisorHypervisorId} is 1001. A Python snippet that is similar to the following example can be used to return the virtual machine’s {hypervisorVmId} value, ec44616651cda8b66fec4f7fd0daf554:

 object_name = "Service-Dallas"

 hypervisor_hypervisor_id = "1001"    # 10.0.0.10 (VMware-Dallas)
 hypervisor_folder_id = "7a2ab40929457c84ed9c0e276a19f9ea"
     # online-services-subfolder

 _response = requests.get('https://' + spp_ipv4 + '/api/hypervisor/'
     + hypervisor_hypervisor_id
     + '/folder' + hypervisor_folder_id
     + '/vmcontent',
     headers=..., data=..., params=..., verify=...)

 _response_json = json.loads(_response.text)    # Convert to JSON

 object_json = _response_json['contents']

 for keys in object_json:
     if keys['name'] == object_name:
         object_id = keys['id']

 print(object_id)
ec44616651cda8b66fec4f7fd0daf554

Restriction: Do not use the same name for multiple virtual machines hosted on the same Hyper-V Server. With Microsoft Hyper-V, you can have multiple virtual machines sharing the same name in the same Hyper-V Server. Unlike VMware vCenter, Hyper-V does not support folders.

Getting a {hypervisorVdiskId} for a VMware environment

Every hard disk in a VMware virtual machine has an ID, {hypervisorVdiskId}.

Restriction: You can initiate operations for specific hard drives in a VMware vCenter environment, but not in a Microsoft Hyper-V environment or Amazon EC2 environment.

To get the ID of a virtual disk, use the GET method with a URI:

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

Path: Response body (JSON) > contents > name & id

Example: Assume that you want to get the {hypervisorVdiskId} of a hard disk, Hard disk 1, on a VMware virtual machine, Sales-Americas. The virtual machine has a {hypervisorVmId} of ec44616651cda8b66fec4f7fd0daf554. A Python snippet that is similar to the following example can be used to return the {hypervisorVdiskId} value, e738a8a316cc11e8f7f84fa903e3dddc:

 object_name = "Hard disk 1"

 hypervisor_hypervisor_id = "1001"    # 10.0.0.10 (VMware-Dallas)
 hypervisor_vm_id = "ec44616651cda8b66fec4f7fd0daf554"    # Sales-Americas

 _response = requests.get('https://' + spp_ipv4 + '/api/hypervisor/'
     + hypervisor_hypervisor_id
     + '/vm/' + hypervisor_vm_id
     + '/vmcontent',
     headers=..., data=..., params=..., verify=...)

 _response_json = json.loads(_response.text)    # Convert to JSON

 object_json = _response_json['contents']

 for keys in object_json:
     if keys['name'] == object_name:
         object_id = keys['id']

 print(object_id)
e738a8a316cc11e8f7f84fa903e3dddc

Getting a {hypervisorView}

To specify the type of view filter, use one of the following system values:

View filter

{hypervisorView}

VMware

Hyper-V

Amazon EC2

Datastore

storageview

x

x

Tags

tagview

x

x

Tags and categories

tagcategory

x

Hosts and clusters

hostcontent

x