What are the differences between the `master` and the `--master` option in the `pcs resource create` command?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 7 with High Availability or Resilient Storage Add-on
  • Upgrading from pcs-0.9.152 to pcs-0.9.158
  • Using pcs resource create command with --master or master option

Issue

  • What are differences when migrating from --master to master keyword in pcs resource create command?
  • How to change the pcs resource create command from using --master option to using the new master option?

Resolution

To change the syntax from 0.9.152 version to 0.9.158 , check the simplified syntax below.

### 0.9.152 syntax
# pcs resource create <resource_name> <resource_type> [<resource_attributes>] --master [<resource_attributes>] meta <Master_meta_attributes>

### 0.9.158 syntax
# pcs resource create <resource_name> <resource_type> <resource_attributes> master <Master_meta_attributes>

If there were some <Master_meta_attributes> specified in the 0.9.152 version, then it is needed to also remove the meta keyword just before them. Without that change, the meta keyword would, in version 0.9.158 , assign these attributes to primitive resources, instead of the Master resource.

Example of change from 0.9.152 syntax to 0.9.158 syntax, that leads to the same result.

### 0.9.152 syntax
# pcs resource create test Stateful --master state=/tmp/ttt meta interleave=true
# pcs resource create test Stateful state=/tmp/ttt --master meta interleave=true

### 0.9.158 syntax
# pcs resource create test Stateful state=/tmp/ttt master interleave=true

# pcs resource show test-master
 Master: test-master
  Meta Attrs: interleave=true
  Resource: test (class=ocf provider=pacemaker type=Stateful)
   Attributes: state=/tmp/ttt
...

Root Cause

The version 0.9.158 introduced several changes in the way the parameters are handled with the pcs resource create command. Due to these changes, the previous versions allowed some options to be specified in various places, making the processing of the command and its understanding difficult. Some of the changes related to the --master parameter are described below.

In 0.9.152 the --master parameter must be followed by the meta keyword, to indicate that the following values will be considered to be Meta Attrs for the Master resource.
In 0.9.158 the master parameter should be followed directly by values that will be considered to be Meta Attrs for the Master resource. Using the meta keyword after master or anywhere else will cause the values to be considered as Meta Attrs for the primitive resource, based on which the Master resource is created.

Additionally, the 0.9.152 version allowed to specify the regular resource attributes even after the --master keyword. In 0.9.158 it is not possible to have <resource_options> after the master keyword. This way, it is more clear where to look for which attributes.

SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.