Use the updateVolume API to refresh the values for the entered volume.
########====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="2a6f6bc0-0625-4128-a121-147af155cd98"; //volume to update
$VOLNAME="";
$VOLDESC="PruebaAPIII";
$VOLPATH="";
$VOLQUOTATYPE="";
$VOLSOFTQUOTA="";
$VOLHARDQUOTA="";
$DISKSAFEIDS="";
#Refresh the values for 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->getVolumeById(array('id'=>"$VOLUMEID")) ;
var_dump($volume);
}
catch (SoapFault $exception)
{
echo $exception;
exit(1);
}
$volumeObj=get_object_vars($volume);
$volumeObj["id"] = $VOLUMEID;
if($VOLNAME!="")
{
$volumeObj["name"] = $VOLNAME;
}
if($VOLDESC!="")
{
$volumeObj["description"] = $VOLDESC;
}
if($VOLPATH!="")
{
$volumeObj["path"] = $VOLPATH;
}
if($VOLQUOTATYPE!="")
{
$volumeObj["quotaType"] = $VOLQUOTATYPE;
}
if($VOLSOFTQUOTA!="")
{
$volumeObj["softQuota"] = $VOLSOFTQUOTA;
}
if($VOLHARDQUOTA!="")
{
$volumeObj["hardQuota"] = $VOLHARDQUOTA;
}
if($DISKSAFEIDS!="")
{
$volumeObj["diskSafeIDs"] = $DISKSAFEIDS;
}
$MAP = array(
array( "key" => "FILE_EXCLUDES_ENABLED", "value" => "false"),
array( "key" => "ARCHIVING_ENABLED", "value" => "false"),
array( "key" => "CONTROLPANELS_ENABLED", "value" => "false"),
array( "key" => "REPLICATION_FREQUENCY_LIMIT", "value" => "HOURLY"),
array( "key" => "RECOVERY_POINT_LIMIT", "value" => "10"),
array( "key" => "ARCHIVE_POINT_LIMIT", "value" => "20")
);
$volumeObj["volumeAttributeMap"] = $MAP;
try{
$client = new soapclient("https://$HOST:$PORT/Volume?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE,
'classmap'=>array('Volume'=>'Volume')
)
);
$client->updateVolume(array('volume'=>$volumeObj));
echo "Successfully executed updated volume: $VOLUMEID\n";
}
catch (SoapFault $exception)
{
echo $exception;
}
Labels:
None