Blame SOURCES/bz1458153-01-give-back-orig.-master-behav.-resource-create.patch

715401
From 9783358accb4002f30b9f7990e9facd68e22331e Mon Sep 17 00:00:00 2001
f778fe
From: Ivan Devat <idevat@redhat.com>
f778fe
Date: Mon, 5 Jun 2017 17:13:41 +0200
715401
Subject: [PATCH 2/6] give back orig. --master behav. (resource create)
f778fe
f778fe
---
f778fe
 pcs/cli/common/parse_args.py           |   8 +-
48ab60
 pcs/cli/common/test/test_parse_args.py |  34 ++++-
48ab60
 pcs/resource.py                        |  19 +++
48ab60
 pcs/test/cib_resource/test_create.py   | 181 ++++++++++++++++++++-----
48ab60
 pcs/test/test_constraints.py           |  28 ++--
f778fe
 pcs/test/test_resource.py              |  10 +-
48ab60
 pcs/utils.py                           |   7 +
f778fe
 7 files changed, 228 insertions(+), 59 deletions(-)
f778fe
f778fe
diff --git a/pcs/cli/common/parse_args.py b/pcs/cli/common/parse_args.py
715401
index 19a658e5..7235835b 100644
f778fe
--- a/pcs/cli/common/parse_args.py
f778fe
+++ b/pcs/cli/common/parse_args.py
d01bb5
@@ -307,7 +307,13 @@ def upgrade_args(arg_list):
f778fe
             and
f778fe
             args_without_options[:2] == ["resource", "create"]
f778fe
         ):
f778fe
-            upgraded_args.append("master")
f778fe
+            #upgraded_args.append("master")
f778fe
+
f778fe
+            #We do not replace flag --master with keyword "manster" here because
f778fe
+            #we want to give grace period to openstack that uses original
f778fe
+            #missbehaviour.
f778fe
+            #see https://bugzilla.redhat.com/show_bug.cgi?id=1458153
f778fe
+            upgraded_args.append(arg)
f778fe
         else:
f778fe
             upgraded_args.append(arg)
f778fe
     return upgraded_args
f778fe
diff --git a/pcs/cli/common/test/test_parse_args.py b/pcs/cli/common/test/test_parse_args.py
a3a2ad
index efe38d0e..900094c9 100644
f778fe
--- a/pcs/cli/common/test/test_parse_args.py
f778fe
+++ b/pcs/cli/common/test/test_parse_args.py
a3a2ad
@@ -486,9 +486,21 @@ class UpgradeArgs(TestCase):
f778fe
             upgrade_args(["first", "--cloneopt=1", "second"])
f778fe
         )
f778fe
 
f778fe
-    def test_upgrade_2dash_master_in_resource_create(self):
f778fe
-        self.assertEqual(
f778fe
-            ["resource", "create", "master", "second"],
f778fe
+    # def test_upgrade_2dash_master_in_resource_create(self):
f778fe
+    #     self.assertEqual(
f778fe
+    #         ["resource", "create", "master", "second"],
f778fe
+    #         upgrade_args(["resource", "create", "--master", "second"])
f778fe
+    #     )
f778fe
+
f778fe
+    def test_do_not_upgrade_2dash_master_in_resource_create__original_behaviour(
f778fe
+        self
f778fe
+    ):
f778fe
+        """
f778fe
+        downstream temporary behaviour
f778fe
+        fixes bz 1458153
f778fe
+        """
f778fe
+        self.assertEqual(
f778fe
+            ["resource", "create", "--master", "second"],
f778fe
             upgrade_args(["resource", "create", "--master", "second"])
f778fe
         )
f778fe
 
a3a2ad
@@ -498,10 +510,22 @@ class UpgradeArgs(TestCase):
f778fe
             upgrade_args(["first", "--master", "second"])
f778fe
         )
f778fe
 
f778fe
-    def test_upgrade_2dash_master_in_resource_create_with_complications(self):
f778fe
+    # def test_upgrade_2dash_master_in_resource_create_with_complications(self):
f778fe
+    #     self.assertEqual(
f778fe
+    #         [
f778fe
+    #             "-f", "path/to/file", "resource", "-V", "create", "master",
f778fe
+    #             "second"
f778fe
+    #         ],
f778fe
+    #         upgrade_args([
f778fe
+    #             "-f", "path/to/file", "resource", "-V", "create", "--master",
f778fe
+    #             "second"
f778fe
+    #         ])
f778fe
+    #     )
f778fe
+
f778fe
+    def test_no_upgrade_2dash_master_complications__original_behaviour(self):
f778fe
         self.assertEqual(
f778fe
             [
f778fe
-                "-f", "path/to/file", "resource", "-V", "create", "master",
f778fe
+                "-f", "path/to/file", "resource", "-V", "create", "--master",
f778fe
                 "second"
f778fe
             ],
f778fe
             upgrade_args([
f778fe
diff --git a/pcs/resource.py b/pcs/resource.py
715401
index 3274910a..ac24cf4a 100644
f778fe
--- a/pcs/resource.py
f778fe
+++ b/pcs/resource.py
d01bb5
@@ -397,6 +397,25 @@ def resource_create(lib, argv, modifiers):
f778fe
     ra_type = argv[1]
f778fe
 
f778fe
     parts = parse_create_args(argv[2:])
f778fe
+
f778fe
+    if modifiers["master"] and "master" in parts:
f778fe
+        raise error("you cannot specify both --master and master")
f778fe
+
f778fe
+    #This is for `pcs resource create`. Fix of the bug
f778fe
+    #https://bugzilla.redhat.com/show_bug.cgi?id=1378107
f778fe
+    #caused problems in openstack which uses `pcs resource create`
f778fe
+    #see https://bugzilla.redhat.com/show_bug.cgi?id=1458153
f778fe
+    #so we give back the original misbehavior of master here temporarily.
f778fe
+    #When user uses `--master` she gets the original behaviour. With `master`
f778fe
+    #she gets new behaviour.
f778fe
+    if modifiers["master"]:
f778fe
+        warn(
f778fe
+            "flag '--master' is deprecated, use keyword 'master' instead (see"
f778fe
+            " the usage)"
f778fe
+        )
f778fe
+        parts["master"] = parts["meta"]
f778fe
+        parts["meta"] = {}
f778fe
+
f778fe
     parts_sections = ["clone", "master", "bundle"]
f778fe
     defined_options = [opt for opt in parts_sections if opt in parts]
f778fe
     if modifiers["group"]:
f778fe
diff --git a/pcs/test/cib_resource/test_create.py b/pcs/test/cib_resource/test_create.py
48ab60
index ecb16384..57d95350 100644
f778fe
--- a/pcs/test/cib_resource/test_create.py
f778fe
+++ b/pcs/test/cib_resource/test_create.py
48ab60
@@ -238,7 +238,7 @@ class Success(ResourceTestLocal):
f778fe
     def test_with_master(self):
f778fe
         self.assert_effect(
f778fe
             [
f778fe
-                "resource create R ocf:heartbeat:Dummy --no-default-ops --master",
f778fe
+                # "resource create R ocf:heartbeat:Dummy --no-default-ops --master",
f778fe
                 "resource create R ocf:heartbeat:Dummy --no-default-ops master",
f778fe
             ],
f778fe
             """<resources>
48ab60
@@ -659,7 +659,7 @@ class SuccessGroup(ResourceTestLocal):
48ab60
 class SuccessMaster(ResourceTestLocal):
f778fe
     def test_disable_is_on_master_element(self):
f778fe
         self.assert_effect(
f778fe
-            "resource create R ocf:heartbeat:Dummy --no-default-ops --disabled --master",
f778fe
+            "resource create R ocf:heartbeat:Dummy --no-default-ops --disabled master",
f778fe
             """<resources>
f778fe
                 <master id="R-master">
f778fe
                     <meta_attributes id="R-master-meta_attributes">
48ab60
@@ -680,13 +680,55 @@ class SuccessMaster(ResourceTestLocal):
f778fe
             </resources>"""
f778fe
         )
f778fe
 
f778fe
-    def test_put_options_after_master_as_its_meta_fix_1(self):
f778fe
+    # def test_put_options_after_master_as_its_meta_fix_1(self):
f778fe
+    #     """
f778fe
+    #     fixes bz 1378107 (do not use master options as primitive options)
f778fe
+    #     """
f778fe
+    #     self.assert_effect(
f778fe
+    #         "resource create R ocf:heartbeat:Dummy state=a"
f778fe
+    #             " --master is-managed=false --force"
f778fe
+    #         ,
f778fe
+    #         """<resources>
f778fe
+    #             <master id="R-master">
f778fe
+    #                 
f778fe
+    #                     type="Dummy"
f778fe
+    #                 >
f778fe
+    #                     <instance_attributes id="R-instance_attributes">
f778fe
+    #                         
f778fe
+    #                             name="state" value="a"
f778fe
+    #                         />
f778fe
+    #                     </instance_attributes>
f778fe
+    #                     <operations>
f778fe
+    #                         
f778fe
+    #                             name="monitor" timeout="20"
f778fe
+    #                         />
f778fe
+    #                         
f778fe
+    #                             name="start" timeout="20"
f778fe
+    #                         />
f778fe
+    #                         
f778fe
+    #                             name="stop" timeout="20"
f778fe
+    #                         />
f778fe
+    #                     </operations>
f778fe
+    #                 </primitive>
f778fe
+    #                 <meta_attributes id="R-master-meta_attributes">
f778fe
+    #                     
f778fe
+    #                         name="is-managed" value="false"
f778fe
+    #                 />
f778fe
+    #                 </meta_attributes>
f778fe
+    #             </master>
f778fe
+    #         </resources>"""
f778fe
+    #     )
f778fe
+
f778fe
+    def test_put_options_after_master_as_primitive_options__original_behaviour(
f778fe
+        self
f778fe
+    ):
f778fe
         """
f778fe
-        fixes bz 1378107 (do not use master options as primitive options)
f778fe
+        downstream temporary behaviour
f778fe
+        fixes bz 1458153
f778fe
         """
f778fe
         self.assert_effect(
f778fe
             "resource create R ocf:heartbeat:Dummy state=a"
f778fe
-                " --master is-managed=false --force"
f778fe
+                " --master fake=false --force"
f778fe
             ,
f778fe
             """<resources>
f778fe
                 <master id="R-master">
48ab60
@@ -694,6 +736,9 @@ class SuccessMaster(ResourceTestLocal):
f778fe
                         type="Dummy"
f778fe
                     >
f778fe
                         <instance_attributes id="R-instance_attributes">
f778fe
+                            
f778fe
+                                value="false"
f778fe
+                            />
f778fe
                             
f778fe
                                 name="state" value="a"
f778fe
                             />
48ab60
@@ -719,22 +764,58 @@ class SuccessMaster(ResourceTestLocal):
f778fe
                             />
f778fe
                         </operations>
f778fe
                     </primitive>
f778fe
-                    <meta_attributes id="R-master-meta_attributes">
f778fe
-                        
f778fe
-                            name="is-managed" value="false"
f778fe
-                    />
f778fe
-                    </meta_attributes>
f778fe
                 </master>
f778fe
             </resources>"""
f778fe
-        )
f778fe
-
f778fe
-    def test_put_options_after_master_as_its_meta_fix_2(self):
f778fe
+            ,
f778fe
+            output="Warning: flag '--master' is deprecated, use keyword"
f778fe
+                " 'master' instead (see the usage)\n"
f778fe
+        )
f778fe
+
f778fe
+
f778fe
+    # def test_put_options_after_master_as_its_meta_fix_2(self):
f778fe
+    #     """
f778fe
+    #     fixes bz 1378107 (do not use master options as operations)
f778fe
+    #     """
f778fe
+    #     self.assert_effect(
f778fe
+    #         "resource create R ocf:heartbeat:Dummy state=a op monitor"
f778fe
+    #             " interval=10s --master is-managed=false --force"
f778fe
+    #             " --no-default-ops"
f778fe
+    #         ,
f778fe
+    #         """<resources>
f778fe
+    #             <master id="R-master">
f778fe
+    #                 
f778fe
+    #                     type="Dummy"
f778fe
+    #                 >
f778fe
+    #                     <instance_attributes id="R-instance_attributes">
f778fe
+    #                         
f778fe
+    #                             name="state" value="a"
f778fe
+    #                         />
f778fe
+    #                     </instance_attributes>
f778fe
+    #                     <operations>
f778fe
+    #                         
f778fe
+    #                             name="monitor"
f778fe
+    #                         />
f778fe
+    #                     </operations>
f778fe
+    #                 </primitive>
f778fe
+    #                 <meta_attributes id="R-master-meta_attributes">
f778fe
+    #                     
f778fe
+    #                         name="is-managed" value="false"
f778fe
+    #                 />
f778fe
+    #                 </meta_attributes>
f778fe
+    #             </master>
f778fe
+    #         </resources>"""
f778fe
+    #     )
f778fe
+
f778fe
+    def test_put_options_after_master_as_operation_opts__original_behaviour(
f778fe
+        self
f778fe
+    ):
f778fe
         """
f778fe
-        fixes bz 1378107 (do not use master options as operations)
f778fe
+        downstream temporary behaviour
f778fe
+        fixes bz 1458153
f778fe
         """
f778fe
         self.assert_effect(
f778fe
             "resource create R ocf:heartbeat:Dummy state=a op monitor"
f778fe
-                " interval=10s --master is-managed=false --force"
f778fe
+                " interval=10s --master timeout=3m --force"
f778fe
                 " --no-default-ops"
f778fe
             ,
f778fe
             """<resources>
48ab60
@@ -749,22 +830,53 @@ class SuccessMaster(ResourceTestLocal):
f778fe
                         </instance_attributes>
f778fe
                         <operations>
f778fe
                             
f778fe
-                                name="monitor"
f778fe
+                                name="monitor" timeout="3m"
f778fe
                             />
f778fe
                         </operations>
f778fe
                     </primitive>
f778fe
-                    <meta_attributes id="R-master-meta_attributes">
f778fe
-                        
f778fe
-                            name="is-managed" value="false"
f778fe
-                    />
f778fe
-                    </meta_attributes>
f778fe
                 </master>
f778fe
             </resources>"""
f778fe
-        )
f778fe
-
f778fe
-    def test_do_not_steal_primitive_meta_options(self):
f778fe
+            ,
f778fe
+            output="Warning: flag '--master' is deprecated, use keyword"
f778fe
+                " 'master' instead (see the usage)\n"
f778fe
+        )
f778fe
+
f778fe
+    # def test_do_not_steal_primitive_meta_options(self):
f778fe
+    #     """
f778fe
+    #     fixes bz 1378107
f778fe
+    #     """
f778fe
+    #     self.assert_effect(
f778fe
+    #         "resource create R ocf:heartbeat:Dummy meta a=b --master b=c"
f778fe
+    #             " --no-default-ops"
f778fe
+    #         ,
f778fe
+    #         """<resources>
f778fe
+    #             <master id="R-master">
f778fe
+    #                 
f778fe
+    #                     type="Dummy"
f778fe
+    #                 >
f778fe
+    #                     <meta_attributes id="R-meta_attributes">
f778fe
+    #                         
f778fe
+    #                             value="b"
f778fe
+    #                         />
f778fe
+    #                     </meta_attributes>
f778fe
+    #                     <operations>
f778fe
+    #                         
f778fe
+    #                             name="monitor" timeout="20"
f778fe
+    #                         />
f778fe
+    #                     </operations>
f778fe
+    #                 </primitive>
f778fe
+    #                 <meta_attributes id="R-master-meta_attributes">
f778fe
+    #                     
f778fe
+    #                         value="c"
f778fe
+    #                     />
f778fe
+    #                 </meta_attributes>
f778fe
+    #             </master>
f778fe
+    #         </resources>"""
f778fe
+    #     )
f778fe
+    def test_steals_primitive_meta_options__original_behaviour(self):
f778fe
         """
f778fe
-        fixes bz 1378107
f778fe
+        downstream temporary behaviour
f778fe
+        fixes bz 1458153
f778fe
         """
f778fe
         self.assert_effect(
f778fe
             "resource create R ocf:heartbeat:Dummy meta a=b --master b=c"
48ab60
@@ -775,11 +887,6 @@ class SuccessMaster(ResourceTestLocal):
f778fe
                     
f778fe
                         type="Dummy"
f778fe
                     >
f778fe
-                        <meta_attributes id="R-meta_attributes">
f778fe
-                            
f778fe
-                                value="b"
f778fe
-                            />
f778fe
-                        </meta_attributes>
f778fe
                         <operations>
48ab60
                             
48ab60
                                 name="monitor" timeout="20s"
48ab60
@@ -787,18 +894,24 @@ class SuccessMaster(ResourceTestLocal):
f778fe
                         </operations>
f778fe
                     </primitive>
f778fe
                     <meta_attributes id="R-master-meta_attributes">
f778fe
+                        
f778fe
+                            value="b"
f778fe
+                        />
f778fe
                         
f778fe
                             value="c"
f778fe
                         />
f778fe
                     </meta_attributes>
f778fe
                 </master>
f778fe
             </resources>"""
f778fe
+            ,
f778fe
+            output="Warning: flag '--master' is deprecated, use keyword"
f778fe
+                " 'master' instead (see the usage)\n"
f778fe
         )
f778fe
 
f778fe
     def test_takes_master_meta_attributes(self):
f778fe
         self.assert_effect(
f778fe
             "resource create --no-default-ops R ocf:heartbeat:IPaddr2"
f778fe
-                " ip=192.168.0.99 --master cidr_netmask=32"
f778fe
+                " ip=192.168.0.99 master cidr_netmask=32"
f778fe
             ,
f778fe
             """<resources>
f778fe
                 <master id="R-master">
48ab60
@@ -1048,7 +1161,7 @@ class FailOrWarn(ResourceTestLocal):
f778fe
     def test_error_master_clone_combination(self):
f778fe
         self.assert_pcs_fail(
f778fe
             "resource create R ocf:heartbeat:Dummy --no-default-ops --clone"
f778fe
-                " --master"
f778fe
+                " master"
f778fe
             ,
f778fe
             "Error: you can specify only one of clone, master, bundle or"
f778fe
                 " --group\n"
48ab60
@@ -1056,7 +1169,7 @@ class FailOrWarn(ResourceTestLocal):
f778fe
 
f778fe
     def test_error_master_group_combination(self):
f778fe
         self.assert_pcs_fail(
f778fe
-            "resource create R ocf:heartbeat:Dummy --no-default-ops --master"
f778fe
+            "resource create R ocf:heartbeat:Dummy --no-default-ops master"
f778fe
                 " --group G"
f778fe
             ,
f778fe
             "Error: you can specify only one of clone, master, bundle or"
48ab60
@@ -1074,7 +1187,7 @@ class FailOrWarn(ResourceTestLocal):
f778fe
 
f778fe
     def test_error_bundle_master_combination(self):
f778fe
         self.assert_pcs_fail(
f778fe
-            "resource create R ocf:heartbeat:Dummy --no-default-ops --master"
f778fe
+            "resource create R ocf:heartbeat:Dummy --no-default-ops master"
f778fe
                 " bundle bundle_id"
f778fe
             ,
f778fe
             "Error: you can specify only one of clone, master, bundle or"
f778fe
diff --git a/pcs/test/test_constraints.py b/pcs/test/test_constraints.py
715401
index df8594a5..671f0122 100644
f778fe
--- a/pcs/test/test_constraints.py
f778fe
+++ b/pcs/test/test_constraints.py
d01bb5
@@ -393,43 +393,43 @@ Ticket Constraints:
f778fe
 
f778fe
     def testColocationConstraints(self):
f778fe
         # see also BundleColocation
f778fe
-        line = "resource create M1 ocf:heartbeat:Dummy --master"
f778fe
+        line = "resource create M1 ocf:heartbeat:Dummy master"
f778fe
         output, returnVal = pcs(temp_cib, line)
f778fe
         assert returnVal == 0 and output == ""
f778fe
 
f778fe
-        line = "resource create M2 ocf:heartbeat:Dummy --master"
f778fe
+        line = "resource create M2 ocf:heartbeat:Dummy master"
f778fe
         output, returnVal = pcs(temp_cib, line)
f778fe
         assert returnVal == 0 and output == ""
f778fe
 
f778fe
-        line = "resource create M3 ocf:heartbeat:Dummy --master"
f778fe
+        line = "resource create M3 ocf:heartbeat:Dummy master"
f778fe
         output, returnVal = pcs(temp_cib, line)
f778fe
         assert returnVal == 0 and output == "",[returnVal, output]
f778fe
 
f778fe
-        line = "resource create M4 ocf:heartbeat:Dummy --master"
f778fe
+        line = "resource create M4 ocf:heartbeat:Dummy master"
f778fe
         output, returnVal = pcs(temp_cib, line)
f778fe
         assert returnVal == 0 and output == "",[returnVal, output]
f778fe
 
f778fe
-        line = "resource create M5 ocf:heartbeat:Dummy --master"
f778fe
+        line = "resource create M5 ocf:heartbeat:Dummy master"
f778fe
         output, returnVal = pcs(temp_cib, line)
f778fe
         assert returnVal == 0 and output == "",[returnVal, output]
f778fe
 
f778fe
-        line = "resource create M6 ocf:heartbeat:Dummy --master"
f778fe
+        line = "resource create M6 ocf:heartbeat:Dummy master"
f778fe
         output, returnVal = pcs(temp_cib, line)
f778fe
         assert returnVal == 0 and output == "",[returnVal, output]
f778fe
 
f778fe
-        line = "resource create M7 ocf:heartbeat:Dummy --master"
f778fe
+        line = "resource create M7 ocf:heartbeat:Dummy master"
f778fe
         output, returnVal = pcs(temp_cib, line)
f778fe
         assert returnVal == 0 and output == "",[returnVal, output]
f778fe
 
f778fe
-        line = "resource create M8 ocf:heartbeat:Dummy --master"
f778fe
+        line = "resource create M8 ocf:heartbeat:Dummy master"
f778fe
         output, returnVal = pcs(temp_cib, line)
f778fe
         assert returnVal == 0 and output == "",[returnVal, output]
f778fe
 
f778fe
-        line = "resource create M9 ocf:heartbeat:Dummy --master"
f778fe
+        line = "resource create M9 ocf:heartbeat:Dummy master"
f778fe
         output, returnVal = pcs(temp_cib, line)
f778fe
         assert returnVal == 0 and output == "",[returnVal, output]
f778fe
 
f778fe
-        line = "resource create M10 ocf:heartbeat:Dummy --master"
f778fe
+        line = "resource create M10 ocf:heartbeat:Dummy master"
f778fe
         output, returnVal = pcs(temp_cib, line)
f778fe
         assert returnVal == 0 and output == ""
f778fe
 
715401
@@ -1066,7 +1066,7 @@ Ticket Constraints:
f778fe
         assert returnVal == 1
f778fe
 
f778fe
     def testLocationBadRules(self):
f778fe
-        o,r = pcs("resource create stateful0 ocf:heartbeat:Dummy --master")
f778fe
+        o,r = pcs("resource create stateful0 ocf:heartbeat:Dummy master")
f778fe
         ac(o,"")
f778fe
         assert r == 0
f778fe
 
715401
@@ -1087,7 +1087,7 @@ Ticket Constraints:
f778fe
 """)
f778fe
         assert r == 0
f778fe
 
f778fe
-        o,r = pcs("resource create stateful1 ocf:heartbeat:Dummy --master")
f778fe
+        o,r = pcs("resource create stateful1 ocf:heartbeat:Dummy master")
f778fe
         ac(o,"")
f778fe
         assert r == 0
f778fe
 
715401
@@ -1126,7 +1126,7 @@ Ticket Constraints:
f778fe
         ac(o,"")
f778fe
         assert r == 0
f778fe
 
f778fe
-        o,r = pcs("resource create stateful1 ocf:pacemaker:Stateful --master")
f778fe
+        o,r = pcs("resource create stateful1 ocf:pacemaker:Stateful master")
f778fe
         ac(o, """\
f778fe
 Warning: changing a monitor operation interval from 10 to 11 to make the operation unique
f778fe
 """)
715401
@@ -1247,7 +1247,7 @@ Ticket Constraints:
f778fe
         self.assertEqual(0, returnVal)
f778fe
 
f778fe
         output, returnVal = pcs(
f778fe
-            "resource create stateful1 ocf:pacemaker:Stateful --master"
f778fe
+            "resource create stateful1 ocf:pacemaker:Stateful master"
f778fe
         )
f778fe
         ac(output, """\
f778fe
 Warning: changing a monitor operation interval from 10 to 11 to make the operation unique
f778fe
diff --git a/pcs/test/test_resource.py b/pcs/test/test_resource.py
715401
index fd1a0731..3a47053f 100644
f778fe
--- a/pcs/test/test_resource.py
f778fe
+++ b/pcs/test/test_resource.py
d01bb5
@@ -2898,7 +2898,7 @@ Ticket Constraints:
f778fe
 
f778fe
         output, returnVal  = pcs(
f778fe
             temp_cib,
f778fe
-            "resource create --no-default-ops D2 ocf:heartbeat:Dummy --master"
f778fe
+            "resource create --no-default-ops D2 ocf:heartbeat:Dummy master"
f778fe
         )
f778fe
         assert returnVal == 0
f778fe
         assert output == "", [output]
d01bb5
@@ -3011,7 +3011,7 @@ Warning: changing a monitor operation interval from 10 to 11 to make the operati
f778fe
         ac(o,"")
f778fe
         assert r == 0
f778fe
 
f778fe
-        o,r = pcs("resource create D3 ocf:heartbeat:Dummy --master")
f778fe
+        o,r = pcs("resource create D3 ocf:heartbeat:Dummy master")
f778fe
         ac(o,"")
f778fe
         assert r == 0
f778fe
 
d01bb5
@@ -3237,7 +3237,7 @@ Warning: changing a monitor operation interval from 10 to 11 to make the operati
f778fe
 
f778fe
         output, returnVal = pcs(
f778fe
             temp_cib,
f778fe
-            "resource create --no-default-ops dummy ocf:heartbeat:Dummy --master"
f778fe
+            "resource create --no-default-ops dummy ocf:heartbeat:Dummy master"
f778fe
         )
f778fe
         ac(output, "")
f778fe
         self.assertEqual(0, returnVal)
715401
@@ -3935,7 +3935,7 @@ Error: Cannot remove more than one resource from cloned group
f778fe
         # However those test the pcs library. I'm leaving these tests here to
f778fe
         # test the cli part for now.
f778fe
         self.assert_pcs_success(
f778fe
-            "resource create --no-default-ops dummy ocf:pacemaker:Stateful --master",
f778fe
+            "resource create --no-default-ops dummy ocf:pacemaker:Stateful master",
f778fe
             "Warning: changing a monitor operation interval from 10 to 11 to make the operation unique\n"
f778fe
         )
f778fe
 
715401
@@ -5548,7 +5548,7 @@ class CloneMasterUpdate(unittest.TestCase, AssertPcsMixin):
f778fe
 
f778fe
     def test_no_op_allowed_in_master_update(self):
f778fe
         self.assert_pcs_success(
f778fe
-            "resource create dummy ocf:heartbeat:Dummy --master"
f778fe
+            "resource create dummy ocf:heartbeat:Dummy master"
f778fe
         )
48ab60
         self.assert_pcs_success(
48ab60
             "resource show dummy-master",
f778fe
diff --git a/pcs/utils.py b/pcs/utils.py
715401
index e56a1e8b..793f0b5e 100644
f778fe
--- a/pcs/utils.py
f778fe
+++ b/pcs/utils.py
715401
@@ -2982,6 +2982,13 @@ def get_modifiers():
f778fe
         "wait": pcs_options.get("--wait", False),
f778fe
         "watchdog": pcs_options.get("--watchdog", []),
be1b1f
         "no_watchdog_validation": "--no-watchdog-validation" in pcs_options,
f778fe
+
f778fe
+        #This is for `pcs resource create`. Fix of the bug
f778fe
+        #https://bugzilla.redhat.com/show_bug.cgi?id=1378107
f778fe
+        #caused problems in openstack which uses `pcs resource create`
f778fe
+        #see https://bugzilla.redhat.com/show_bug.cgi?id=1458153
f778fe
+        #so we give back the original misbehavior of master here temporarily.
f778fe
+        "master": "--master" in pcs_options,
f778fe
     }
f778fe
 
f778fe
 def exit_on_cmdline_input_errror(error, main_name, usage_name):
f778fe
-- 
715401
2.21.0
f778fe