Originally posted by: manjunathns
In response to the e-mail inquiry you sent, I thought it would be helpful to share with others, and hence documenting the reply in this link. Let me know if you have any comments.
• How to map virtualDisks (from StoragePools rest response) to LPARs ?
Mapping a virtual disk from the storage pool (or volume group) includes 1. create the client scsi adapter for the logical partition 2. create a server scsi adapter on a VIOS (where the Storage Pool is created) 3. Map the virtual disk to the server adapter.
All these steps can be performed in a single POST operation on a VirtualIOServer REST object. You will need to add new entry to VirtualSCSIMappings of the VirtualIOServer REST response, and perform the POST operation. REST VirtualIOServer GET response has VirtualSCSIMappings, which is collection of "VirtualSCSIMapping" REST object.
The entry which you need to add to the VirtualSCSIMappings, should be something like below. Where you need to specify the atom link of the LogicalPartition to which the virtual disk to be mapped in "AssociatedLogicalPartition" and specify the virtual disk to be mapped in "VirtualDisk" section. And perform the POST operation.
<VirtualSCSIMapping schemaVersion="V1_4_0">
<Metadata>
<Atom/>
</Metadata>
<AssociatedLogicalPartition kxe="false" kb="CUR" href="https://<HMC IP>:12443/rest/api/uom/ManagedSystem/$ManagedSystemUUID/LogicalPartition/$LogicalPartitionUUID" rel="related"/>
<Storage kb="CUR" kxe="false">
<VirtualDisk schemaVersion="V1_4_0">
<Metadata>
<Atom/>
</Metadata>
<DiskName kxe="false" kb="CUR">mydisk</DiskName>
</VirtualDisk>
</Storage>
</VirtualSCSIMapping>
Please note : You should perform a GET of VirtualIOServer, and to the received response you need to add the new "VirtualSCSIMapping". Then modified feed can be POSTed to attach the VirtualDisk. Removal of the exiting mapping from the GET response and performing POST will unmap the storage and remove the client/server SCSI adapter.
• How to map virtualDisks to vhost ?
The steps is same as above. In HMC REST, you need to use the POST on VirtualIOServer mechanism to attach/detach the storage to the client partition. If you want to attach the storage to the specific vHost, then specify that in the "ServerAdapter" section in the VirtualSCSIMapping. In the below example, after POST operation a mapping will be created, where the virtual disk will be mapped to the server SCSI Adapter with the slot number 21. If before the POST, VIOS does not have the server SCSI adapter with this slot, then HMC REST will create the new server with the slot number specified and map the storage to it.
<VirtualSCSIMapping schemaVersion="V1_4_0">
<Metadata>
<Atom/>
</Metadata>
<AssociatedLogicalPartition kxe="false" kb="CUR" href="https://<HMC IP>:12443/rest/api/uom/ManagedSystem/$ManagedSystemUUID/LogicalPartition/$LogicalPartitionUUID" rel="related"/>
<ServerAdapter kb="CUR" kxe="false" schemaVersion="V1_4_0">
<Metadata>
<Atom/>
</Metadata>
<VirtualSlotNumber kb="COD" kxe="false">21</VirtualSlotNumber>
</ServerAdapter>
<Storage kb="CUR" kxe="false">
<VirtualDisk schemaVersion="V1_4_0">
<Metadata>
<Atom/>
</Metadata>
<DiskName kxe="false" kb="CUR">mydisk</DiskName>
</VirtualDisk>
</Storage>
</VirtualSCSIMapping>
Note : Similar to the server adapter, you could specify client slot number also. If you do not specify any client/server slot number then HMC REST will pick the next available slot number to create the mapping and then attach the storage to the newly created server SCSI adapter.
You will be able to map multiple store to the same server adapter. To do this, you need to create the multiple VirtualSCSIMapping object with the same server adapter but with the different storage. And then perform the POST with the modified feed.
• Is there an rest response that would include hostname and IP address properties for a LPAR ?
The REST GET response for LogicalPartition object will have an attribute ResourceMonitoringIPAddress. This indicates the IP Address of the logical partition. But we do not have have a way to report the hostname in the REST response. The format will be something like below.
<ResourceMonitoringIPAddress kb="CUD" kxe="false">9.41.165.124</ResourceMonitoringIPAddress>