Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
This project is now read‑only. Starting Monday, February 2, please use https://ibm-ceph.atlassian.net/ for all bug tracking management.

Bug 1917599

Summary: [RFE] integrate snapshot quiesce hooks for rbd-nbd
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Jason Dillaman <jdillama>
Component: RBDAssignee: Ilya Dryomov <idryomov>
Status: CLOSED ERRATA QA Contact: Gopi <gpatta>
Severity: medium Docs Contact: Ranjini M N <rmandyam>
Priority: medium    
Version: 5.0CC: ceph-eng-bugs, idryomov, kdreyer, mmurthy, rmandyam
Target Milestone: ---Keywords: FutureFeature, TechPreview
Target Release: 5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ceph-16.1.0-486.el8cp Doc Type: Technology Preview
Doc Text:
.Snapshot quiesce hook support for `rbd-nbd` devices With this release, librbd API now offers quiesce and unquiesce hooks that enable coordinated snapshot creation. The `rbd-nbd` daemon optionally freezes and thaws the file system mounted on top of the mapped device to create file system consistent snapshots. This behavior can be customized by editing the `rbd-nbd_quiesce` shell script or by replacing it with a custom executable.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-08-30 08:27:52 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: 1959686    

Description Jason Dillaman 2021-01-18 21:23:06 UTC
Description of problem:
The librbd API has been extended to provide callback hooks to alert librbd clients that a snapshot creation is in-progress. librbd clients can register for the hook in order to quiesce / freeze the block device and/or file system prior to the snapshot being created.

The first librbd client to utilize this new hook is the "rbd-nbd" daemon which will invoke "fsfreeze" to freeze and thaw mounted file systems on NBD-backed RBD images.

Version-Release number of selected component (if applicable):
5.0

Comment 1 RHEL Program Management 2021-01-18 21:23:11 UTC
Please specify the severity of this bug. Severity is defined here:
https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity.

Comment 2 Ken Dreyer (Red Hat) 2021-01-22 17:30:08 UTC
Jason, is this all complete in pacific upstream now? Any information for QE to verify this feature?

Comment 3 Jason Dillaman 2021-02-09 18:13:40 UTC
It's been merged and documented upstream for a while now.

Comment 4 Ken Dreyer (Red Hat) 2021-03-03 00:40:28 UTC
I'm setting Fixed In Version to the current RH Ceph Storage 5 build.

Comment 11 Gopi 2021-08-09 15:33:35 UTC
Working as expected. Hence moving this bug to verified state.

[root@magna081 ~]# rbd device --device-type nbd map --quiesce --quiesce-hook /home/gpatta/hook/rbd-nbd_quiesce rbd-nbd_pool/rbd-nbd-image
/dev/nbd0
[root@magna081 ~]# rbd-nbd list-mapped
id       pool          namespace  image          snap  device   
1147676  rbd-nbd_pool             rbd-nbd-image  -     /dev/nbd0
[root@magna081 ~]#
[root@magna081 ~]# rbd snap create rbd-nbd_pool/rbd-nbd-image@quiesce1
Creating snap: 100% complete...done.

After inject some error to script:
[root@magna081 ~]# cat /home/gpatta/hook/rbd-nbd_quiesce
#!/bin/sh

echo "$0 $@" >&2

if [ $# -lt 2 ]; then
    echo "usage: $0 <dev> <cmd>" >&2
    exit 1
fi
exit 123
dev=$1
cmd=$2

export PATH=/usr/sbin:/usr/bin:/sbin:/bin

findmnt -S "${dev}" -fno TARGET |
while read mnt; do
    case "${cmd}" in
        quiesce)
            echo "freezing ${mnt}" >&2
            fsfreeze -f "${mnt}"
            ;;
        unquiesce)
            echo "unfreezing ${mnt}" >&2
            fsfreeze -u "${mnt}"
            ;;
        *)
            echo "unknown command ${cmd}" >&2
            exit 1
            ;;
    esac
done

[root@magna081 ~]# rbd snap create rbd-nbd_pool/rbd-nbd-image@quiesce1
Creating snap: 10% complete...2021-08-09T15:24:14.831+0000 7fb8d5172700 -1 librbd::ImageWatcher: 0x7fb8b80079e0 failed to notify quiesce: (123) No medium found
2021-08-09T15:24:14.831+0000 7fb8d5172700 -1 librbd::SnapshotCreateRequest: failed to notify quiesce: (123) No medium found
Creating snap: 10% complete...failed.
rbd: failed to create snapshot: (123) No medium found

Comment 13 errata-xmlrpc 2021-08-30 08:27:52 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 (Red Hat Ceph Storage 5.0 bug fix and enhancement), 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-2021:3294