Intel AMT Features > Storage Administration and Operations > Use Cases > Storage: Get the Block Handles for an Application
CollapseAll image

Storage: Get the Block Handles for an Application

Given a session handle and an application handle, it is possible to retrieve the handles for all the blocks allocated by that application. A registered application may pass in its own application handle, or the application handle of one of the other applications with the same vendor, as retrieved in Storage: Retrieve Information (General Flow) (step 2b).

1.  Register the application, as described in the Storage: Register Application, Perform Task, Unregister Application flow. You should have the session handle and application handle available.

2.  As part of the “Perform Task” step, perform the following operations.

a.   Retrieve the block handles for blocks allocated by the application: Invoke AMT_ThirdPartyDataStorageService.GetAllocatedBlocks with the session handle and the application handle as input parameters. The method returns an array of block handles as the single output parameter.

Click here for a snippet demonstrating this step

You can execute this snippet by inserting it into the execution template found here.

  

$thirdPartyDataStorageServiceRef =$wsmanConnectionObject.NewReference("SELECT * FROM AMT_ThirdPartyDataStorageService WHERE Name='Intel(r) AMT Third Party Data Storage Service'")

$inputObject =$thirdPartyDataStorageServiceRef.CreateMethodInput("GetAllocatedBlocks")

# $sessionHandle is the session handle returned by 'RegisterApplication' method.

$inputObject.SetProperty("SessionHandle",$sessionHandle.ToString())

# $applicationHandle is the application handle returned by 'GetCurrentApplicationHandle' method.

$inputObject.SetProperty("BlockOwnerApplication",$applicationHandle.ToString())

$outputObject =$thirdPartyDataStorageServiceRef.InvokeMethod($inputObject)

$returnValue =$outputObject.GetProperty("ReturnValue")

if($returnValue -like "0")

{

    $blockHandles =$outputObject.GetProperty("BlockHandles")

}

 

 

b.   Optionally, use AMT_ThirdPartyDataStorageService.GetBlockAttributes to retrieve information about one or more of the blocks. As input, pass it the session handle and the block handle for the block of interest. As output parameters, the method returns:

   The block’s size, in bytes.

   Whether the block is hidden or not, as a Boolean.

   The block’s name, as a string. 32 characters maximum

Click here for a snippet demonstrating this step

You can execute this snippet by inserting it into the execution template found here.

  

$thirdPartyDataStorageServiceRef =$wsmanConnectionObject.NewReference("SELECT * FROM AMT_ThirdPartyDataStorageService WHERE Name='Intel(r) AMT Third Party Data Storage Service'")

$inputObject =$thirdPartyDataStorageServiceRef.CreateMethodInput("GetBlockAttributes")

# $sessionHandle is the session handle returned by 'RegisterApplication' method.

$inputObject.SetProperty("SessionHandle",$sessionHandle.ToString())

# $blockHandle is the block handle returned by 'Create a block for the registered application' use case.

$inputObject.SetProperty("BlockHandle",$blockHandle.ToString())

$outputObject =$thirdPartyDataStorageServiceRef.InvokeMethod($inputObject)

$returnValue =$outputObject.GetProperty("ReturnValue")

if($returnValue -like "0")

{

    $blockSize =$outputObject.GetProperty("BlockSize")

    $blockHidden =$outputObject.GetProperty("BlockHidden")

    $blockName =$outputObject.GetProperty("BlockName")

}

 

 

3.  Unregister the application when done. See Storage: Register Application, Perform Task, Unregister Application.

Instance Diagram

Not applicable

Classes Used in This Flow

SDK Sample

If there is a sample demonstrating this flow, it is included in the SDK installation file. See SDK Installation Layout for details.

 

See Also:

   Storage Concepts and Objects

   Application Development Guidelines

   Examples of Using the Storage Feature

Copyright © 2006-2022, Intel Corporation. All rights reserved.