コード例 #1
0
def set_deep_meta_attr(attr, value, rsc_id):
    '''
    If the referenced rsc is a primitive that belongs to a group,
    then set its attribute.
    Otherwise, go up to the topmost resource which contains this
    resource and set the attribute there (i.e. if the resource is
    cloned).
    If it's a group then check its children. If any of them has
    the attribute set to a value different from the one given,
    then ask the user whether to reset them or not (exact
    behaviour depends on the value of config.core.manage_children).
    '''
    target_node = xmlutil.RscState().rsc2node(rsc_id)
    if target_node is None:
        common_error("resource %s does not exist" % rsc_id)
        return False

    if target_node.tag == 'tag':
        return set_deep_meta_attr_tag(target_node, attr, value)
    if not (target_node.tag == "primitive" and
            target_node.getparent().tag == "group"):
        target_node = xmlutil.get_topmost_rsc(target_node)
    if not set_deep_meta_attr_node(target_node, attr, value):
        return False
    return xmlutil.commit_rsc(target_node)
コード例 #2
0
ファイル: ui_resource.py プロジェクト: icclab/crmsh
 def update_obj(obj):
     """
     set the meta attribute in the given object
     """
     node = obj.node
     obj.set_updated()
     if not (node.tag == "primitive" and
             node.getparent().tag == "group"):
         node = xmlutil.get_topmost_rsc(node)
     return set_deep_meta_attr_node(node, attr, value)
コード例 #3
0
 def update_obj(obj):
     """
     set the meta attribute in the given object
     """
     node = obj.node
     obj.set_updated()
     if not (node.tag == "primitive" and
             node.getparent().tag == "group"):
         node = xmlutil.get_topmost_rsc(node)
     return set_deep_meta_attr_node(node, attr, value)
コード例 #4
0
ファイル: rsctest.py プロジェクト: lge/crmsh
 def set_rscenv(self, op):
     '''
     Setup the environment. Class specific.
     '''
     self.rscenv = {}
     n = self.rscdef_node
     self.timeout = get_op_timeout(n, op, "20s")
     self.rscenv["%stimeout" % self.pfx["meta_attributes"]] = str(self.timeout)
     if op == "monitor":
         self.rscenv["%sinterval" % self.pfx["meta_attributes"]] = "10000"
     if is_cloned(n):
         # some of the meta attributes for clones/ms are used
         # by resource agents
         cn = get_topmost_rsc(n)
         self.nvset2env(get_child_nvset_node(cn))
コード例 #5
0
 def set_rscenv(self, op):
     '''
     Setup the environment. Class specific.
     '''
     self.rscenv = {}
     n = self.rscdef_node
     self.timeout = get_op_timeout(n, op, "20s")
     self.rscenv["%stimeout" % self.pfx["meta_attributes"]] = str(
         self.timeout)
     if op == "monitor":
         self.rscenv["%sinterval" % self.pfx["meta_attributes"]] = "10000"
     if is_cloned(n):
         # some of the meta attributes for clones/ms are used
         # by resource agents
         cn = get_topmost_rsc(n)
         self.nvset2env(get_child_nvset_node(cn))
コード例 #6
0
ファイル: rsctest.py プロジェクト: lge/crmsh
 def is_ms(self):
     return is_ms(get_topmost_rsc(self.rscdef_node))
コード例 #7
0
 def is_ms(self):
     return is_ms(get_topmost_rsc(self.rscdef_node))