@@ -1702,14 +1702,21 @@ def check_sanity(self) -> VerifyResult:
1702
1702
if self .node is None : # eh?
1703
1703
logger .error ("%s: no xml (strange)" , self .obj_id )
1704
1704
return utils .get_check_rc ()
1705
+
1706
+ rc = VerifyResult .SUCCESS
1705
1707
l = get_resource_meta_list ()
1706
1708
if self .obj_type == "clone" :
1707
1709
l += constants .clone_meta_attributes
1708
1710
elif self .obj_type == "ms" :
1709
1711
l += constants .clone_meta_attributes + constants .ms_meta_attributes
1710
1712
elif self .obj_type == "group" :
1713
+ for c in self .node .iterchildren ():
1714
+ if c .tag == "primitive" and c .get ("class" ) == "ocf" and c .get ("type" ) == "remote" :
1715
+ logger .error ("Remote resource '%s' cannot be in a group" , c .get ("id" ))
1716
+ rc |= VerifyResult .FATAL_ERROR
1711
1717
l += constants .group_meta_attributes
1712
- return sanity_check_meta (self .obj_id , self .node , l )
1718
+ rc |= sanity_check_meta (self .obj_id , self .node , l )
1719
+ return rc
1713
1720
1714
1721
def repr_gv (self , gv_obj , from_grp = False ):
1715
1722
'''
@@ -1774,6 +1781,24 @@ def _check_if_constraint_ref_is_child(obj) -> VerifyResult:
1774
1781
return rc
1775
1782
1776
1783
1784
+ def check_if_primitive_in_constraint_is_remote (obj ) -> VerifyResult :
1785
+ rc = VerifyResult .SUCCESS
1786
+ primitives = []
1787
+ if obj .obj_type == "colocation" :
1788
+ primitives = [obj .node .get ("rsc" ), obj .node .get ("with-rsc" )]
1789
+ elif obj .obj_type == "order" :
1790
+ primitives = [obj .node .get ("first" ), obj .node .get ("then" )]
1791
+ for rscid in primitives :
1792
+ tgt = cib_factory .find_object (rscid )
1793
+ if not tgt :
1794
+ logger .warning ("%s: resource %s does not exist" , obj .obj_id , rscid )
1795
+ rc |= VerifyResult .WARNING
1796
+ elif tgt .node .get ("class" ) == "ocf" and tgt .node .get ("type" ) == "remote" :
1797
+ logger .error ("Cannot put remote resource '%s' in %s constraint" , rscid , obj .obj_type )
1798
+ rc |= VerifyResult .FATAL_ERROR
1799
+ return rc
1800
+
1801
+
1777
1802
class CibLocation (CibObject ):
1778
1803
'''
1779
1804
Location constraint.
@@ -2000,7 +2025,9 @@ def check_sanity(self) -> VerifyResult:
2000
2025
if self .node is None :
2001
2026
logger .error ("%s: no xml (strange)" , self .obj_id )
2002
2027
return utils .get_check_rc ()
2003
- return _check_if_constraint_ref_is_child (self )
2028
+ rc1 = _check_if_constraint_ref_is_child (self )
2029
+ rc2 = check_if_primitive_in_constraint_is_remote (self )
2030
+ return rc1 | rc2
2004
2031
2005
2032
2006
2033
class CibRscTicket (CibSimpleConstraint ):
0 commit comments