Bug 1408476

Summary: pcs does not currently work with systemd's instantiated services
Product: Red Hat Enterprise Linux 7 Reporter: Michele Baldessari <michele>
Component: pcsAssignee: Ivan Devat <idevat>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.3CC: cfeist, cluster-maint, gfidente, idevat, mlisik, omular, rsteiger, tojeline
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: pcs-0.9.156-1.el7 Doc Type: Bug Fix
Doc Text:
Cause: User creates a cluster resource based on a systemd service which supports multiple instances (i.e. there is the "@" character in the resource agent name). Consequence: The resource agent is not recognized by pcs and the command fails. User has to specify --force in the command for it to succeed. Fix: Fixed validation of systemd resource agent names. Result: It is possible to create cluster resource based on a systemd service which supports multiple instances.
Story Points: ---
Clone Of:
: 1412244 (view as bug list) Environment:
Last Closed: 2017-08-01 18:26:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1335682, 1412244    
Attachments:
Description Flags
Locally tested fix
none
proposed fix none

Description Michele Baldessari 2016-12-23 16:05:48 UTC
Created attachment 1235077 [details]
Locally tested fix

Description of problem:
Currently (pcs-0.9.152-10.el7.centos.x86_64) we do not support systemd instantiated services (0pointer.de/blog/projects/instances.html) aka the services that have an @ in the service filename and that can be instantiated multiple times.

For example:
[root@centos pcs]# pcs resource create gettytest systemd:getty@tty3 
Error: Unable to create resource 'systemd:getty@tty3', it is not installed on this system (use --force to override)

With --force this does get created and it works, but pcs is not considering the instantiated service scenario when it does the prevalidation.

I attach the trivial patch that fixes it for me. I attach it here to the downstream bug only, because this is actually already fixed in pcs master via the following change:
commit 491ac087fd06480a9fda0dfc5dd97f6b9dfbae56
Author: Tomas Jelinek <tojeline>
Date:   Tue Oct 11 17:12:11 2016 +0200

    get resource/fence agents info from pacemaker



With the attached patch applied I can correctly do the following:
[root@centos system]# pcs resource create gettytest4 systemd:getty@tty4

[root@centos system]# pcs status
Cluster name: clustername
Stack: corosync
Current DC: centos (version 1.1.15-11.el7_3.2-e174ec8) - partition with quorum
Last updated: Fri Dec 23 16:40:53 2016		Last change: Fri Dec 23 16:40:49 2016 by root via cibadmin on centos

1 node and 4 resources configured

Online: [ centos ]

Full list of resources:

 gettytest4	(systemd:getty@tty4):	Started centos

Comment 2 Tomas Jelinek 2017-01-11 14:45:23 UTC
Created attachment 1239460 [details]
proposed fix

This will be eventually fixed by a rebase. Until then (and for the z-stream) here is the patch.

Comment 4 Michele Baldessari 2017-01-12 18:26:31 UTC
Giulio, could you provide us some feedback on this just to be 100% sure we covered your use case correctly?

Comment 5 Giulio Fidente 2017-01-13 15:47:50 UTC
hi guys, thanks a lot! I've tested manually the "proposed fix" attachment together with https://review.openstack.org/#/c/407039/ (meant to deploy the ceph rbd-mirror daemon) and it completed successfully:

  [root@overcloud-controller-0 ~]# pcs status|grep -i rbd
   ceph-rbd-mirror_openstack      (systemd:ceph-rbd-mirror@openstack):    Started overcloud-controller-0

looking forward to use it in OSPd11 :)

Comment 6 Ivan Devat 2017-02-20 07:32:06 UTC
After Fix:                                                                      
[vm-rhel72-1 ~] $ rpm -q pcs                                                                                                                                                                                         
pcs-0.9.156-1.el7.x86_64                                                        
[vm-rhel72-1 ~] $ pcs resource create gettytest systemd:getty@tty3              
[vm-rhel72-1 ~] $ pcs status|grep gettytest                                     
 gettytest      (systemd:getty@tty3):   Started vm-rhel72-2

Comment 10 errata-xmlrpc 2017-08-01 18:26:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1958