View Source

{kb-symptom}

No matter what value is put in the {{getStorageDiskByPath(array('storageDiskPath'=>"$device"))}} call, it looks up data for the {{/dev/mapper/iet1p1}} device.

{kb-resolution}

The issue has been corrected in CDP 4.2.0. Freebytes and devices are now displayed correctly.
{code}
<?

try
{
//get a list of paths
$client = new soapclient('http://10.230.106.78:9080/StorageDisk?wsdl&#39;,
array(
'login'=>'admin',
'password'=>'bobbit',
'trace'=>1
)
);

$response=$client->getStorageDiskPaths() ;
if (is_array($response->return))
{


foreach ($response->return as $device)
{
if ($device != 'none')
{
$devices[] = $device;
}
}
}
else
{
$devices[] = $response->return;
}
}
catch (SoapFault $exception)
{
return array("API Failure: $exception");
}


$largest_bytes = 0;
foreach ($devices as $device)
{
//find the one with the most free space
try
{
$response=$client->getStorageDiskByPath(array('storageDiskPath'=>$device)) ;
echo $device . " " . $response->return->freeBytes . "\r\n";
}
catch (SoapFault $exception)
{
return array("API Failure: $exception");
}
}
foreach ($devices as $device)
{
//find the one with the most free space
try
{
#$response=$client->getStorageDiskByPath(array('storageDiskPath'=>$device)) ;
$response=$client->getStorageDiskByPath(array('storageDiskPath'=>"$device")) ;
#echo $device . " " . $response->return->freeBytes . "\r\n";
echo $device . " " . $response->return->path . "\r\n";
}
catch (SoapFault $exception)
{
echo "API Failure: $exception";
}
}

?>
{code}

{kb-related-articles}