Symptom
No matter what value is put in the getStorageDiskByPath(array('storageDiskPath'=>"$device")) call, it looks up data for the /dev/mapper/iet1p1 device.
Resolution
The issue has been corrected in CDP 4.2.0. Freebytes and devices are now displayed correctly.
try
{
//get a list of paths
$client = new soapclient('http://10.230.106.78:9080/StorageDisk?wsdl',
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";
}
}
?>
Related Articles
Page: Accessing API Documentation (CDP) Labels: enterprise_edition, advanced_edition, standard_edition, api |
Page: Accessing Example API Functions (CDP) Labels: enterprise_edition, standard_edition, advanced_edition, api |
Page: Running soapUI Script on Linux (CDP) Labels: api |
Page: API - Solved Issue with Closed Disk Safe (CDP) Labels: api |
Page: API - Solved Issue with Wrong User Attributes Keys when Creating and Getting Power Users (CDP) Labels: api |
Page: API - Solved Issue with createPolicy (CDP) Labels: api |
Page: API - Solved Issue with getStorageDiskByPath (CDP) Labels: api |