Ejemplo n.º 1
0
 def test_get_num_from_scalar_unit_size_negative(self):
     try:
         Constraint.get_num_from_scalar_unit_size(self.InputMemSize,
                                                  self.UserInputUnit)
     except Exception as error:
         self.assertTrue(isinstance(error, ValueError))
         self.assertEqual('input unit "qB" is not a valid unit',
                          error.__str__())
Ejemplo n.º 2
0
 def test_get_num_from_scalar_unit_size_negative(self):
     try:
         Constraint.get_num_from_scalar_unit_size(self.InputMemSize,
                                                  self.UserInputUnit)
     except Exception as error:
         self.assertTrue(isinstance(error, ValueError))
         self.assertEqual('input unit "qB" is not a valid unit',
                          error.__str__())
    def handle_properties(self):
        tosca_props = self._get_tosca_props(
            self.nodetemplate.get_properties_objects())
        objectstore_props = {}
        container_quota = {}
        skip_check = False

        for key, value in tosca_props.items():
            if key == "store_name":
                objectstore_props["name"] = value
            elif key == "store_size" or key == "store_maxsize":
                #currently heat is not supporting dynamically increase
                #the container quota-size.
                #if both defined in tosca template, consider store_maxsize.
                if skip_check:
                    continue
                quota_size = None
                if "store_maxsize" in tosca_props.keys():
                    quota_size = tosca_props["store_maxsize"]
                else:
                    quota_size = tosca_props["store_size"]
                container_quota["Quota-Bytes"] = \
                    Constraint.get_num_from_scalar_unit_size(quota_size)
                objectstore_props["X-Container-Meta"] = container_quota
                skip_check = True

        objectstore_props["X-Container-Read"] = '".r:*"'
        self.properties = objectstore_props
Ejemplo n.º 4
0
    def handle_properties(self):
        tosca_props = self._get_tosca_props(
            self.nodetemplate.get_properties_objects())
        objectstore_props = {}
        container_quota = {}
        skip_check = False

        for key, value in tosca_props.items():
            if key == "store_name":
                objectstore_props["name"] = value
            elif key == "store_size" or key == "store_maxsize":
                #currently heat is not supporting dynamically increase
                #the container quota-size.
                #if both defined in tosca template, consider store_maxsize.
                if skip_check:
                    continue
                quota_size = None
                if "store_maxsize" in tosca_props.keys():
                    quota_size = tosca_props["store_maxsize"]
                else:
                    quota_size = tosca_props["store_size"]
                container_quota["Quota-Bytes"] = \
                    Constraint.get_num_from_scalar_unit_size(quota_size)
                objectstore_props["X-Container-Meta"] = container_quota
                skip_check = True

        objectstore_props["X-Container-Read"] = '".r:*"'
        self.properties = objectstore_props
Ejemplo n.º 5
0
 def test_scenario_get_num_from_scalar_unit_size(self):
     resolved = Constraint.get_num_from_scalar_unit_size(
         self.InputMemSize, self.UserInputUnit)
     self.assertEqual(resolved, self.expected)
Ejemplo n.º 6
0
 def test_scenario_get_num_from_scalar_unit_size(self):
     resolved = Constraint.get_num_from_scalar_unit_size(self.InputMemSize,
                                                         self.UserInputUnit)
     self.assertEqual(resolved, self.expected)