Browse Source

try to check ressources on changepackage

andre 4 years ago
parent
commit
d965307ce2
1 changed files with 13 additions and 8 deletions
  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