Skip to content

Commit

Permalink
Merge pull request #49 from avolovplesk/patch-1
Browse files Browse the repository at this point in the history
Fix for SVM-2851: now it will be possible to change bandwidth using upgrade/downgrade via configurable options
  • Loading branch information
redikultsevsilver authored Oct 29, 2021
2 parents 54a07f9 + bc43ad4 commit 8fb4126
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions modules/servers/solusvmpro/solusvmpro.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,11 @@ function solusvmpro_ChangePackage( $params ) {
$ccpu = $solusvm->getCcpu();
$cextraip = $solusvm->getCextraip();
$cnspeed = $solusvm->getCnspeed();
$cbandwidth = $solusvm->getCbandwidth();
#########################################

//Apply custom resources
if ( !empty($cmem) || !empty($cdisk) || !empty($ccpu) || !empty($cextraip) ){
if ( !empty($cmem) || !empty($cdisk) || !empty($ccpu) || !empty($cextraip) || !empty($cbandwidth) ){

$resource_errors = "";
$error_divider = " ";
Expand Down Expand Up @@ -722,6 +723,14 @@ function solusvmpro_ChangePackage( $params ) {
}

}

if ( $cbandwidth > 0 ){
$solusvm->apiCall( 'vserver-bandwidth', array( "limit" => $cbandwidth, "vserverid" => $customField["vserverid"] ) );
if ( !$solusvm->isSuccessResponse($solusvm->result) ) {
$resource_errors .= (string) $solusvm->result["statusmsg"];
}

}

if ( $cextraip > 0 ){
//first() function doesn't work
Expand Down Expand Up @@ -1264,4 +1273,3 @@ function solusvmpro_customclientareaunavailable( $params, $cparams ) {
return $output;
}
}

0 comments on commit 8fb4126

Please sign in to comment.