rbd showmapped has trailing whitespace which break rbd monitor

Bug #1129217 reported by James Page
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ceph (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Taken from rbd RA

find_rbd_dev() {
    local sedpat

    # Example output from "rbd showmapped" (tab separated):
    # id pool image snap device
    # 0 rbd test - /dev/rbd0

    # Build the sed pattern, substituting "-" for the snapshot name if
    # it's unset
    sedpat="[0-9]\+[ \t]\+${OCF_RESKEY_pool}[ \t]\+${OCF_RESKEY_name}[ \t]\+${OCF_RESKEY_snap:--}[ \t]\+\(/dev/rbd[0-9]\+\)"

    # Run rbd showmapped, filter out the header line, then try to
    # extract the device name
    rbd showmapped | tail -n +2 | sed -n -e "s,$sedpat,\1,p"
}

rbd showmapped is outputing a trailing whitespace character at the end of the block device which means that the monitor check can't find the mapped block device

add | tr -d ' ' fixes the problem

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: ceph-resource-agents 0.56.3-0ubuntu1 [modified: usr/lib/ocf/resource.d/ceph/rbd]
ProcVersionSignature: Ubuntu 3.8.0-6.13-generic 3.8.0-rc7
Uname: Linux 3.8.0-6-generic x86_64
ApportVersion: 2.8-0ubuntu4
Architecture: amd64
Date: Mon Feb 18 10:47:14 2013
MarkForUpload: True
PackageArchitecture: all
SourcePackage: ceph
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
James Page (james-page) wrote :
Revision history for this message
James Page (james-page) wrote :

Alternatively:

    sedpat="[0-9]\+[ \t]\+${OCF_RESKEY_pool}[ \t]\+${OCF_RESKEY_name}[ \t]\+${OCF_RESKEY_snap:--}[ \t]\+\(/dev/rbd[0-9]\+\).*"

Trims the whitespace as well.

Revision history for this message
Sage Weil (sage-newdream) wrote :

What about just iterating over the device nodes that udev creates? /dev/rbd/$pool/$image

Revision history for this message
James Page (james-page) wrote :

That might work well....

James Page (james-page)
Changed in ceph (Ubuntu):
importance: Undecided → High
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ceph - 0.56.3-0ubuntu2

---------------
ceph (0.56.3-0ubuntu2) raring; urgency=low

  * Fix problem with trailing whitespace in RBD OCF (LP: #1129217):
    - d/p/ocf-whitespace.patch: Strip any trailing whitespace from the
      output of rbd showmapped.
 -- James Page <email address hidden> Mon, 18 Feb 2013 17:32:00 +0000

Changed in ceph (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.