소스 검색

try to check ressources on changepackage

andre 4 년 전
부모
커밋
d965307ce2
1개의 변경된 파일13개의 추가작업 그리고 8개의 파일을 삭제
  1. 13 8
      app/Http/Actions/ChangePackage.php

+ 13 - 8
app/Http/Actions/ChangePackage.php

@@ -56,14 +56,19 @@ class ChangePackage extends AddonController
             $this->networkService = new NetworkService();
 
             $this->ressource = new ResourceManager();
-            logModuleCall(
-                'proxmoxCloud',
-                __FUNCTION__,
-                $this->ressource->vcpus(),
-                'Debug',
-                $params
-            );
-
+            if($this->ressource->vcpus()->getUsed() > $params['configoptions']['vcpus']){
+                throw new \Exception('vCPUs wurden unterbucht');
+            }
+            if($this->ressource->memory()->getUsed() > $params['configoptions']['Memory Limit']){
+                throw new \Exception('Memory wurde unterbucht');
+            }
+            if($this->ressource->disk()->getUsed() > $params['configoptions']['Storage Limit']){
+                throw new \Exception('Storage wurde unterbucht');
+            }
+            if($this->ressource->ipv4()->getUsed() > $params['configoptions']['IP Addresses Limit']){
+                throw new \Exception('IPv4 wurden unterbucht');
+            }
+            $this->resourceGuard()->backupLimit();
             //Bandwith limit
             $this->saveUsageLimit();
             //Assing ip