def setUpClass(cls):
        cls.api_client = super(TestSnapshotOnRootVolume,
                               cls).getClsTestClient().getApiClient()
        cls.services = Services().services
        cls.domain = get_domain(cls.api_client, cls.services)
        cls.zone = get_zone(cls.api_client, cls.services)
        cls.template = get_template(
                                    cls.api_client,
                                    cls.zone.id,
                                    cls.services["ostype"])
        cls.account = Account.create(cls.api_client,
                                     cls.services["account"],
                                     domainid=cls.domain.id)
        # pdb.set_trace()
        cls.service_offering = ServiceOffering.create(
                                            cls.api_client,
                                            cls.services["service_offering"])
        cls.disk_offering = DiskOffering.create(
                                    cls.api_client,
                                    cls.services["disk_offering"],
                                    domainid=cls.domain.id)
        cls.service_offering2 = ServiceOffering.create(
                                            cls.api_client,
                                            cls.services["service_offering2"])
        cls.disk_offering2 = DiskOffering.create(
                                    cls.api_client,
                                    cls.services["disk_offering2"],
                                    domainid=cls.domain.id)

        cls._cleanup = [cls.account,
                        cls.service_offering,
                        cls.disk_offering,
                        cls.service_offering2,
                        cls.disk_offering2]
Пример #2
0
    def setUpClass(cls):
        cls.api_client = super(TestSnapshotOnRootVolume,
                               cls).getClsTestClient().getApiClient()
        cls.services = Services().services
        cls.domain = get_domain(cls.api_client, cls.services)
        cls.zone = get_zone(cls.api_client, cls.services)
        cls.template = get_template(cls.api_client, cls.zone.id,
                                    cls.services["ostype"])
        cls.account = Account.create(cls.api_client,
                                     cls.services["account"],
                                     domainid=cls.domain.id)
        # pdb.set_trace()
        cls.service_offering = ServiceOffering.create(
            cls.api_client, cls.services["service_offering"])
        cls.disk_offering = DiskOffering.create(cls.api_client,
                                                cls.services["disk_offering"],
                                                domainid=cls.domain.id)
        cls.service_offering2 = ServiceOffering.create(
            cls.api_client, cls.services["service_offering2"])
        cls.disk_offering2 = DiskOffering.create(
            cls.api_client,
            cls.services["disk_offering2"],
            domainid=cls.domain.id)

        cls._cleanup = [
            cls.account, cls.service_offering, cls.disk_offering,
            cls.service_offering2, cls.disk_offering2
        ]
Пример #3
0
    def setUpClass(cls):
        cls._cleanup = []
        cls.api_client = super(TestVMOwnership,
                               cls).getClsTestClient().getApiClient()
        cls.services  = Services().services
        # Get Zone  Domain and create Domains and sub Domains.
        cls.domain           = get_domain(cls.api_client, cls.services)
        cls.zone             = get_zone(cls.api_client, cls.services)
        cls.services['mode'] = cls.zone.networktype
        # Get and set template id for VM creation.
        cls.template = get_template(cls.api_client,
                                    cls.zone.id,
                                    cls.services["ostype"])
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = cls.template.id

        def create_domain_account_user(parentDomain=None):
            domain  =  Domain.create(cls.api_client,
                                     cls.services["domain"],
                                     parentdomainid=parentDomain.id if parentDomain else None)
            cls._cleanup.append(domain)
            # Create an Account associated with domain
            account = Account.create(cls.api_client,
                                     cls.services["account"],
                                     domainid=domain.id)
            cls._cleanup.append(account)
            # Create an User, Project, Volume associated with account
            user    = User.create(cls.api_client,
                                  cls.services["user"],
                                  account=account.name,
                                  domainid=account.domainid)
            cls._cleanup.append(user)
            project = Project.create(cls.api_client,
                                     cls.services["project"],
                                     account=account.name,
                                     domainid=account.domainid)
            cls._cleanup.append(project)
            volume  = Volume.create(cls.api_client,
                                    cls.services["volume"],
                                    zoneid=cls.zone.id,
                                    account=account.name,
                                    domainid=account.domainid,
                                    diskofferingid=cls.disk_offering.id)
            cls._cleanup.append(volume)
            return {'domain':domain, 'account':account, 'user':user, 'project':project, 'volume':volume}

        # Create disk offerings.
        try:
            cls.disk_offering = DiskOffering.create(cls.api_client,
                                                    cls.services["disk_offering"])
            # Create service offerings.
            cls.service_offering = ServiceOffering.create(cls.api_client,
                                                          cls.services["service_offering"])
            # Cleanup
            cls._cleanup = [cls.service_offering]
            # Create domain, account, user, project and volumes.
            cls.domain_account_user1   = create_domain_account_user()
            cls.domain_account_user2   = create_domain_account_user()
            cls.sdomain_account_user1  = create_domain_account_user(cls.domain_account_user1['domain'])
            cls.sdomain_account_user2  = create_domain_account_user(cls.domain_account_user2['domain'])
            cls.ssdomain_account_user2 = create_domain_account_user(cls.sdomain_account_user2['domain'])
        except Exception as e:
          raise e
        return
Пример #4
0
    def setUpClass(cls):
        cls._cleanup = []
        cls.api_client = super(TestVMOwnership,
                               cls).getClsTestClient().getApiClient()
        cls.services = Services().services
        # Get Zone  Domain and create Domains and sub Domains.
        cls.domain = get_domain(cls.api_client, cls.services)
        cls.zone = get_zone(cls.api_client, cls.services)
        cls.services['mode'] = cls.zone.networktype
        # Get and set template id for VM creation.
        cls.template = get_template(cls.api_client, cls.zone.id,
                                    cls.services["ostype"])
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = cls.template.id

        def create_domain_account_user(parentDomain=None):
            domain = Domain.create(
                cls.api_client,
                cls.services["domain"],
                parentdomainid=parentDomain.id if parentDomain else None)
            cls._cleanup.append(domain)
            # Create an Account associated with domain
            account = Account.create(cls.api_client,
                                     cls.services["account"],
                                     domainid=domain.id)
            cls._cleanup.append(account)
            # Create an User, Project, Volume associated with account
            user = User.create(cls.api_client,
                               cls.services["user"],
                               account=account.name,
                               domainid=account.domainid)
            cls._cleanup.append(user)
            project = Project.create(cls.api_client,
                                     cls.services["project"],
                                     account=account.name,
                                     domainid=account.domainid)
            cls._cleanup.append(project)
            volume = Volume.create(cls.api_client,
                                   cls.services["volume"],
                                   zoneid=cls.zone.id,
                                   account=account.name,
                                   domainid=account.domainid,
                                   diskofferingid=cls.disk_offering.id)
            cls._cleanup.append(volume)
            return {
                'domain': domain,
                'account': account,
                'user': user,
                'project': project,
                'volume': volume
            }

        # Create disk offerings.
        try:
            cls.disk_offering = DiskOffering.create(
                cls.api_client, cls.services["disk_offering"])
            # Create service offerings.
            cls.service_offering = ServiceOffering.create(
                cls.api_client, cls.services["service_offering"])
            # Cleanup
            cls._cleanup.append(cls.service_offering)
            # Create domain, account, user, project and volumes.
            cls.domain_account_user1 = create_domain_account_user()
            cls.domain_account_user2 = create_domain_account_user()
            cls.sdomain_account_user1 = create_domain_account_user(
                cls.domain_account_user1['domain'])
            cls.sdomain_account_user2 = create_domain_account_user(
                cls.domain_account_user2['domain'])
            cls.ssdomain_account_user2 = create_domain_account_user(
                cls.sdomain_account_user2['domain'])
        except Exception as e:
            raise e
        return