puppetlabs-corosync help using multiple primitive operations

340 views
Skip to first unread message

treydock

unread,
Jun 23, 2012, 7:06:17 PM6/23/12
to puppet...@googlegroups.com
Setting up a HA iSCSI / NFS target using this document, http://www.linbit.com/fileadmin/tech-guides/ha-iscsi.pdf, and I am unable to find a way to use the puppetlabs-corosync module to emulate this command

crm(live)configure# primitive p_drbd_coraid23 ocf:linbit:drbd \
 params drbd_resource=coraid23 \
 op monitor interval=29 role=Master \
 op monitor interval=31 role=Slave
crm(live)configure# ms ms_drbd_coraid23 p_drbd_coraid23 \
 meta master-max=1 master-node-max=1 \ 
 clone-max=2 clone-node-max=1 notify=true

I defined the cs_primitive type like this...


  cs_primitive {
    'p_drbd_coraid23':
      ensure            => present,
      primitive_class => 'ocf',
      primitive_type  => 'drbd',
      provided_by     => 'linbit',
      promotable      => true,
      parameters      => {
        'drbd_resource' => 'coraid23'
      },
      operations      => {
        'monitor' => {
          'interval'  => '29',
          'role'      => 'Master',
        },
        'monitor' => {
          'interval'  => '31',
          'role'      => 'Slave',
        }
      },
      metadata        => {
        'master-max'      => '1',
        'master-node-max' => '1',
        'clone-max'       => '2',
        'clone-node-max'  => '1',
        'notify'          => 'true',
      };


What results is only 1 of the 2 operations being defined, and my guess is that this is because of logic like this...

operations = {}
operations['monitor'] = a
operations['monitor'] = b

puts operations['monitor']
=> b

Any suggestions? 

Thanks
- Trey

willi....@home24.de

unread,
Jul 21, 2014, 11:41:46 AM7/21/14
to puppet...@googlegroups.com
I have the same problem.

Hunter Haugen

unread,
Jul 21, 2014, 8:00:02 PM7/21/14
to puppet-users
Reading through the type/provider code, it looks like it is not coded in a way to deal with entries with duplicate keys, and I don't see any open pull requests to deal with this either. The puppetlabs-corosync module is not currently under active development from the PL module team yet, though we are getting nearer to it as we work through our list. (And will be happy to merge any quality PRs that you find necessary.)

Any pull requests to refactor it would be welcome! One potential backwards-compatible way to implement this would be for the providers to check for arrays of values of any operations hash entry, and create one entry per hash in the array. Such as:

      operations      => {
        'monitor' => [
          {
            'interval'  => '29',
            'role'      => 'Master',
          },
          {
            'interval'  => '31',
            'role'      => 'Slave',
          }
        ]
      },

It should continue to work as before if the value is not an array.

-Hunter


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/8065d250-39f4-4ede-a3e9-4926fd738a2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

willi....@home24.de

unread,
Jul 22, 2014, 12:16:19 PM7/22/14
to puppet...@googlegroups.com
Hi Trey,

I'm using Hiera and changed now:

    p_drbd_jira:
      primitive_class:  ocf
      primitive_type:   drbd
      provided_by:      linbit
      parameters:
        drbd_resource:  jira
      operations:
        monitor:
          - {interval:  '10s', role:  'Master'}
          - {interval:  '20s', role:  'Slave'}

puppet agent -t --debug:
Error: /Stage[main]/H24-corosync::Config/H24-corosync::Resource[primitive]/Cs_primitive[p_drbd_jira]: Could not evaluate: undefined method `each_pair' for #<Array:0x000000037c9a68>

My class to get the data from Hiera:

class h24-corosync::config {

    $config = hiera('h24-corosync::config',
        {
            property => {},
            primitive => {},
            colocation => {},
            order => {},
            group => {}
        })
    h24-corosync::resource { 'property':
        params => $config[property],
        defaults => {ensure => present}
    } ->
    h24-corosync::resource { 'primitive':
        params => $config[primitive],
        #defaults => {operations => {monitor => { 'interval' => '30s' }}}
    } ->
    h24-corosync::resource { 'group':
        params => $config[group]
    } ->
    h24-corosync::resource { 'colocation':
        params => $config[colocation]
    } ->
    h24-corosync::resource { 'order':
        params => $config[order]
    }

}

Which code do I have to change?

Regards - Willi

Hunter Haugen

unread,
Jul 22, 2014, 7:49:19 PM7/22/14
to puppet-users
You will have to update the provider code at https://github.com/puppetlabs/puppetlabs-corosync/tree/master/lib/puppet/provider/cs_primitive to support array values of the cs_primitive operations hash. If you take the time to do this and send a pull request on github, that would be great :).
 

Regards - Willi

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages