This is an automated email from the ASF dual-hosted git repository.

vladi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack-csbench.git


The following commit(s) were added to refs/heads/main by this push:
     new 93805ee  Allow -limits to update limits for domains (#4)
93805ee is described below

commit 93805eef00e2b84b7c1f82522a642a27384a7bd3
Author: Vishesh <[email protected]>
AuthorDate: Thu Dec 21 14:02:42 2023 +0530

    Allow -limits to update limits for domains (#4)
---
 domain/domain.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/domain/domain.go b/domain/domain.go
index cfc0b14..2b1c15a 100644
--- a/domain/domain.go
+++ b/domain/domain.go
@@ -95,12 +95,17 @@ func ListAccounts(cs *cloudstack.CloudStackClient, domainId 
string) []*cloudstac
 func UpdateLimits(cs *cloudstack.CloudStackClient, account 
*cloudstack.Account) bool {
        for i := 0; i <= 11; i++ {
                p := cs.Limit.NewUpdateResourceLimitParams(i)
-               p.SetAccount(account.Name)
                p.SetDomainid(account.Domainid)
                p.SetMax(-1)
                _, err := cs.Limit.UpdateResourceLimit(p)
                if err != nil {
-                       log.Printf("Failed to update resource limit due to: 
%v", err)
+                       log.Printf("Failed to update domain's resource limit 
due to: %v", err)
+                       return false
+               }
+               p.SetAccount(account.Name)
+               _, err = cs.Limit.UpdateResourceLimit(p)
+               if err != nil {
+                       log.Printf("Failed to update account's resource limit 
due to: %v", err)
                        return false
                }
        }

Reply via email to