Use the createVolumeWithObject API to create a new volume.
########====CDP Server Configuration Start====########
#set CDP server host name
$HOST="10.230.106.206";
#set CDP server to access API
$PORT="9443";
#set CDP user
$USER="admin";
#set CDP user password
$PASS="admin";
########====CDP Server Configuration End====########
//arguments
$VOLNAME="APItest4";
$VOLDESC="APItestDesc";
$VOLPATH="/root/APIVol4";
$VOLQUOTATYPE="NONE";
$volume->name = $VOLNAME;
$volume->description = $VOLDESC;
$volume->path = $VOLPATH;
$volume->quotaType = $VOLQUOTATYPE;
$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" => "DAILY"),
array( "key" => "RECOVERY_POINT_LIMIT", "value" => "20"),
array( "key" => "ARCHIVE_POINT_LIMIT", "value" => "20"),
array( "key" => "CREATE_DIRECTORY", "value" => "true")
);
$volume->volumeAttributeMap = $MAP;
#Create a new volume.
try{
$client = new soapclient("https://$HOST:$PORT/Volume?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'trace'=>1,
'classmap'=>array('Volume'=>'Volume')
)
);
$client->createVolumeWithObject(array('volume'=>$volume));
echo "Successfully executed create volume\n";
}
catch (SoapFault $exception)
{
echo $exception;
}
Labels:
None