Skip to content

Commit

Permalink
Fix to allow upgrade/downgrade Bandwidth
Browse files Browse the repository at this point in the history
Added variable for bandwidth limit (cbandwidth) and api call to change it.
  • Loading branch information
avolovplesk committed Oct 29, 2021
1 parent 54a07f9 commit bc43ad4
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 bc43ad4

Please sign in to comment.