コード例 #1
0
ファイル: etcd.py プロジェクト: xmonader/js-sdk
 def select_pool(self):
     query = {
         "cru": self.resources["cpu"],
         "mru": math.ceil(self.resources["memory"] / 1024),
         "sru": math.ceil(self.resources["disk_size"] / 1024),
     }
     cu, su = deployer.calculate_capacity_units(**query)
     self.pool_id = deployer.select_pool(self, cu=cu, su=su, **query)
コード例 #2
0
 def select_pool(self):
     query = {
         "cru": self.resources["cpu"],
         "mru": math.ceil(self.resources["memory"] / 1024),
         "sru": math.ceil(self.resources["disk_size"] / 1024),
     }
     cloud_units = j.sals.marketplace.deployer._calculate_cloud_units(**query)
     self.pool_id = deployer.select_pool(self, cu=cloud_units.cu, su=cloud_units.su, **query)
コード例 #3
0
ファイル: flist.py プロジェクト: xmonader/js-sdk
 def select_pool(self):
     query = {
         "cru": self.resources["cpu"],
         "mru": math.ceil(self.resources["memory"] / 1024),
         "sru": math.ceil(self.resources["disk_size"] / 1024),
     }
     if self.container_volume_attach:
         query["sru"] += math.ceil(self.vol_size / 1024)
     cu, su = deployer.calculate_capacity_units(**query)
     self.pool_id = deployer.select_pool(self, cu=cu, su=su, **query)
コード例 #4
0
ファイル: pools.py プロジェクト: xmonader/js-sdk
 def reserve_pool(self):
     if self.action == "create":
         valid = False
         pool_factory = StoredFactory(PoolConfig)
         while not valid:
             self.pool_name = self.string_ask(
                 "Please choose a name for your new capacity pool. This name will only be used by you to identify the pool for later usage and management.",
                 required=True,
                 is_identifier=True,
             )
             _, _, result = pool_factory.find_many(name=self.pool_name)
             if list(result):
                 self.md_show("the name is already used. please choose a different one")
                 continue
             valid = True
         self.pool_data = deployer.create_pool(self)
     else:
         pool_id = deployer.select_pool(self)
         self.pool_data = deployer.extend_pool(self, pool_id)
コード例 #5
0
    def select_pool(self):
        cloud_units = j.sals.marketplace.deployer.calculate_capacity_units(
            **self.query)
        # At least select pools lasts for 15 mins
        self.pool_id = deployer.select_pool(self,
                                            cu=cloud_units.cu * 60 * 15,
                                            su=cloud_units.su * 60 * 15,
                                            **self.query)
        if not self.pool_id:
            raise DeploymentFailed(
                f"Failed to find a node with the required resources CRU: {self.query.get('cru')}, MRU: {self.query.get('mru', 0)}, CRU: {self.query.get('cru', 0)}, SRU: {self.query.get('sru', 0)}, IPV4U: {self.query.get('ipv4u', 0)}"
            )
        self.selected_nodes = list(
            j.sals.zos.get(self.solution_metadata.get(
                "owner")).nodes_finder.nodes_by_capacity(
                    pool_id=self.pool_id,
                    cru=self.query["cru"],
                    mru=self.query["mru"],
                    sru=self.query["sru"]))

        if not self.selected_nodes:
            raise DeploymentFailed(
                f"Failed to find a node with the required resources CRU: {self.query.get('cru', 0)}, MRU: {self.query.get('mru', 0)}, CRU: {self.query.get('cru', 0)}, SRU: {self.query.get('sru')}"
            )