View Source

Use the {{deleteVolume}} API to delete the entered volume.
{code}
########====CDP Server Configuration Start====########
#set CDP server host name
$HOST="10.230.131.25";
#set CDP server to access API
$PORT="9443";
#set CDP user
$USER="admin";
#set CDP user password
$PASS="admin";
########====CDP Server Configuration End====########

$VOLUMEID="317ffb06-abbc-4d77-957e-3eee5d9f9135"; //ID of the volume to delete
#Delete the entered volume.
try{

$client = new soapclient("https://$HOST:$PORT/Volume?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'cache_wsdl' => WSDL_CACHE_NONE,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
'trace'=>1
)
);

$volume=$client->getVolumes() ;
var_dump($volume);
}
catch (SoapFault $exception)
{
echo $exception;
exit(1);
}

foreach($volume->return as $tmp)
{
if($tmp->id == $VOLUMEID)
{
$volume = $tmp;
break;
}
}

try{

$client = new soapclient("https://$HOST:$PORT/Volume?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'trace'=>1
)
);

$client->deleteVolume(array('volume'=>$volume)) ;

echo "Successfully deleted volume: $VOLUMEID\n";
exit(0);
}
catch (SoapFault $exception)
{
echo $exception;
echo(1);
}
{code}