Version 1 by Nata Ramanenka
on Aug 06, 2012 10:32.

compared with
Version 2 by Nata Ramanenka
on Aug 06, 2012 10:33.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (4)

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

{kb-cause}
The problem occurred if the user tried to create a Policy with parameters missing, for example, {{-Enabled}}.

{kb-resolution}

The issue has been corrected in CDP 4.2.0. Freebytes and devices are 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}