コード例 #1
0
    def setupAccounts(self, account_limit=2, domain_limit=2, project_limit=2):

        self.debug("Creating a domain under: %s" % self.domain.name)
        self.child_domain = Domain.create(self.apiclient,
            services=self.services["domain"],
            parentdomainid=self.domain.id)

        self.debug("domain crated with domain id %s" % self.child_domain.id)

        self.child_do_admin = Account.create(self.apiclient,
            self.services["account"],
            admin=True,
            domainid=self.child_domain.id)

        self.debug("domain admin created for domain id %s" %
                   self.child_do_admin.domainid)

        # Create project as a domain admin
        self.project = Project.create(self.apiclient,
            self.services["project"],
            account=self.child_do_admin.name,
            domainid=self.child_do_admin.domainid)
        # Cleanup created project at end of test
        self.cleanup.append(self.project)

        # Cleanup accounts created
        self.cleanup.append(self.child_do_admin)
        self.cleanup.append(self.child_domain)

        self.debug("Updating the CPU resource count for domain: %s" %
                   self.child_domain.name)
        # Update resource limits for account 1
        responses = Resources.updateLimit(self.apiclient,
            resourcetype=8,
            max=account_limit,
            account=self.child_do_admin.name,
            domainid=self.child_do_admin.domainid)

        self.debug("CPU Resource count for child domain admin account is now: %s" %
                   responses.max)

        self.debug("Updating the CPU limit for project")
        responses = Resources.updateLimit(self.apiclient,
            resourcetype=8,
            max=project_limit,
            projectid=self.project.id)

        self.debug("CPU Resource count for project is now")
        self.debug(responses.max)

        self.debug("Updating the CPU limit for domain only")
        responses = Resources.updateLimit(self.apiclient,
            resourcetype=8,
            max=domain_limit,
            domainid=self.child_domain.id)

        self.debug("CPU Resource count for domain %s with id %s is now %s" %
                   (responses.domain, responses.domainid, responses.max))

        return
コード例 #2
0
    def setupAccounts(self):

        self.debug("Creating a domain under: %s" % self.domain.name)
        self.parent_domain = Domain.create(
            self.apiclient, services=self.services["domain"], parentdomainid=self.domain.id
        )
        self.parentd_admin = Account.create(
            self.apiclient, self.services["account"], admin=True, domainid=self.domain.id
        )

        self.debug("Updating the Memory resource count for domain: %s" % self.domain.name)
        Resources.updateLimit(
            self.apiclient,
            resourcetype=9,
            max=4096,
            account=self.parentd_admin.name,
            domainid=self.parentd_admin.domainid,
        )
        self.debug("Creating a sub-domain under: %s" % self.parent_domain.name)
        self.cdomain_1 = Domain.create(
            self.apiclient, services=self.services["domain"], parentdomainid=self.parent_domain.id
        )

        self.debug("Creating a sub-domain under: %s" % self.parent_domain.name)
        self.cdomain_2 = Domain.create(
            self.apiclient, services=self.services["domain"], parentdomainid=self.parent_domain.id
        )

        self.cadmin_1 = Account.create(self.apiclient, self.services["account"], admin=True, domainid=self.cdomain_1.id)

        self.debug("Updating the Memory resource count for domain: %s" % self.cdomain_1.name)
        Resources.updateLimit(self.apiclient, resourcetype=9, max=2048, domainid=self.cadmin_1.domainid)

        self.debug("Updating the Memory resource count for account: %s" % self.cadmin_1.name)
        Resources.updateLimit(
            self.apiclient, resourcetype=9, max=2048, account=self.cadmin_1.name, domainid=self.cadmin_1.domainid
        )

        self.cadmin_2 = Account.create(self.apiclient, self.services["account"], admin=True, domainid=self.cdomain_2.id)

        self.debug("Updating the Memory resource count for domain: %s" % self.cdomain_2.name)
        Resources.updateLimit(self.apiclient, resourcetype=9, max=2048, domainid=self.cadmin_2.domainid)

        self.debug("Updating the Memory resource count for domain: %s" % self.cadmin_2.name)
        Resources.updateLimit(
            self.apiclient, resourcetype=9, max=2048, account=self.cadmin_2.name, domainid=self.cadmin_2.domainid
        )

        # Cleanup the resources created at end of test
        self.cleanup.append(self.cadmin_1)
        self.cleanup.append(self.cadmin_2)
        self.cleanup.append(self.cdomain_1)
        self.cleanup.append(self.cdomain_2)
        self.cleanup.append(self.parentd_admin)
        self.cleanup.append(self.parent_domain)

        users = {self.parent_domain: self.parentd_admin, self.cdomain_1: self.cadmin_1, self.cdomain_2: self.cadmin_2}
        return users
コード例 #3
0
    def setupAccounts(self):

        self.debug("Creating a sub-domain under: %s" % self.domain.name)

        self.child_domain = Domain.create(
            self.apiclient,
            services=self.services["domain"],
            parentdomainid=self.domain.id
        )
        self.child_do_admin = Account.create(
            self.apiclient,
            self.services["account"],
            admin=True,
            domainid=self.child_domain.id
        )
        # Cleanup the resources created at end of test
        self.cleanup.append(self.child_do_admin)
        self.cleanup.append(self.child_domain)

        Resources.updateLimit(
            self.apiclient,
            resourcetype=8,
            max=16,
            account=self.child_do_admin.name,
            domainid=self.child_do_admin.domainid
        )

        self.domain = Domain.create(
            self.apiclient,
            services=self.services["domain"],
            parentdomainid=self.domain.id
        )

        self.admin = Account.create(
            self.apiclient,
            self.services["account"],
            admin=True,
            domainid=self.domain.id
        )

        # Cleanup the resources created at end of test
        self.cleanup.append(self.admin)
        self.cleanup.append(self.domain)

        Resources.updateLimit(
            self.apiclient,
            resourcetype=8,
            max=16,
            account=self.admin.name,
            domainid=self.admin.domainid
        )
        return
コード例 #4
0
    def setupAccounts(self):

        self.debug("Creating a sub-domain under: %s" % self.domain.name)

        self.child_domain = Domain.create(
            self.apiclient,
            services=self.services["domain"],
            parentdomainid=self.domain.id
        )
        self.child_do_admin = Account.create(
            self.apiclient,
            self.services["account"],
            admin=True,
            domainid=self.child_domain.id
        )
        # Cleanup the resources created at end of test
        self.cleanup.append(self.child_do_admin)
        self.cleanup.append(self.child_domain)

        Resources.updateLimit(
            self.apiclient,
            resourcetype=8,
            max=16,
            account=self.child_do_admin.name,
            domainid=self.child_do_admin.domainid
        )

        self.domain = Domain.create(
            self.apiclient,
            services=self.services["domain"],
            parentdomainid=self.domain.id
        )

        self.admin = Account.create(
            self.apiclient,
            self.services["account"],
            admin=True,
            domainid=self.domain.id
        )

        # Cleanup the resources created at end of test
        self.cleanup.append(self.admin)
        self.cleanup.append(self.domain)

        Resources.updateLimit(
            self.apiclient,
            resourcetype=8,
            max=16,
            account=self.admin.name,
            domainid=self.admin.domainid
        )
        return
コード例 #5
0
    def setupAccounts(self):

        self.debug("Creating a domain under: %s" % self.domain.name)

        self.parent_domain = Domain.create(self.apiclient,
                                           services=self.services["domain"],
                                           parentdomainid=self.domain.id)
        self.parentd_admin = Account.create(self.apiclient,
                                            self.services["account"],
                                            admin=True,
                                            domainid=self.domain.id)

        self.debug("Updating the Memory resource limit for domain: %s" %
                   self.domain.name)
        Resources.updateLimit(self.apiclient,
                              resourcetype=8,
                              max=10,
                              domainid=self.parentd_admin.domainid,
                              account=self.parentd_admin.name)
        self.debug("Creating a sub-domain under: %s" % self.parent_domain.name)
        self.cdomain_1 = Domain.create(self.apiclient,
                                       services=self.services["domain"],
                                       parentdomainid=self.parent_domain.id)

        self.debug("Creating a sub-domain under: %s" % self.parent_domain.name)
        self.cdomain_2 = Domain.create(self.apiclient,
                                       services=self.services["domain"],
                                       parentdomainid=self.parent_domain.id)

        self.cadmin_1 = Account.create(self.apiclient,
                                       self.services["account"],
                                       admin=True,
                                       domainid=self.cdomain_1.id)

        self.debug("Updating the Memory resource count for domain: %s" %
                   self.cdomain_1.name)
        Resources.updateLimit(self.apiclient,
                              resourcetype=8,
                              max=4,
                              domainid=self.cadmin_1.domainid)

        self.debug("Updating the Memory resource count for account: %s" %
                   self.cadmin_1.name)
        Resources.updateLimit(self.apiclient,
                              resourcetype=8,
                              max=2,
                              account=self.cadmin_1.name,
                              domainid=self.cadmin_1.domainid)

        self.cadmin_2 = Account.create(self.apiclient,
                                       self.services["account"],
                                       admin=True,
                                       domainid=self.cdomain_2.id)

        self.debug("Updating the Memory resource count for domain: %s" %
                   self.cdomain_2.name)
        Resources.updateLimit(self.apiclient,
                              resourcetype=8,
                              max=5,
                              domainid=self.cadmin_2.domainid)

        self.debug("Updating the Memory resource count for account: %s" %
                   self.cadmin_2.name)
        Resources.updateLimit(self.apiclient,
                              resourcetype=8,
                              max=3,
                              account=self.cadmin_2.name,
                              domainid=self.cadmin_2.domainid)
        # Cleanup the resources created at end of test
        self.cleanup.append(self.cadmin_1)
        self.cleanup.append(self.cadmin_2)
        self.cleanup.append(self.cdomain_1)
        self.cleanup.append(self.cdomain_2)
        self.cleanup.append(self.parentd_admin)
        self.cleanup.append(self.parent_domain)

        users = {
            self.parent_domain: self.parentd_admin,
            self.cdomain_1: self.cadmin_1,
            self.cdomain_2: self.cadmin_2
        }
        return users
コード例 #6
0
    def setupAccounts(self, account_limit=2, domain_limit=2, project_limit=2):

        self.debug("Creating a domain under: %s" % self.domain.name)
        self.child_domain = Domain.create(self.apiclient,
                                          services=self.services["domain"],
                                          parentdomainid=self.domain.id)

        self.debug("domain crated with domain id %s" % self.child_domain.id)

        self.child_do_admin = Account.create(self.apiclient,
                                             self.services["account"],
                                             admin=True,
                                             domainid=self.child_domain.id)

        self.debug("domain admin created for domain id %s" %
                   self.child_do_admin.domainid)

        # Create project as a domain admin
        self.project = Project.create(self.apiclient,
                                      self.services["project"],
                                      account=self.child_do_admin.name,
                                      domainid=self.child_do_admin.domainid)

        # Cleanup created project at end of test
        self.cleanup.append(self.project)

        # Cleanup accounts created
        self.cleanup.append(self.child_do_admin)
        self.cleanup.append(self.child_domain)

        self.debug("Updating the Memory resource count for domain: %s" %
                   self.child_domain.name)
        # Update resource limits for account 1
        responses = Resources.updateLimit(
            self.apiclient,
            resourcetype=9,
            max=(account_limit * 1024),
            account=self.child_do_admin.name,
            domainid=self.child_do_admin.domainid)

        self.debug(
            "Memory Resource count for child domain admin account is now: %s" %
            responses.max)

        # Update resource limits for project
        responses = Resources.updateLimit(self.apiclient,
                                          resourcetype=9,
                                          max=(project_limit * 1024),
                                          projectid=self.project.id)

        self.debug("Memory Resource count for project is now")
        self.debug(responses.max)

        # TODO: Update the Memory limit for domain only
        responses = Resources.updateLimit(self.apiclient,
                                          resourcetype=9,
                                          max=(domain_limit * 1024),
                                          domainid=self.child_domain.id)

        self.debug("Memory Resource count for domain %s with id %s is now %s" %
                   (responses.domain, responses.domainid, responses.max))
        return