Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Jan 2012 10:46:48 +0100 (CET)
From:      marc.werner@seemoo.tu-darmstadt.de
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        marc.werner@seemoo.tu-darmstadt.de
Subject:   ports/164055: sysutils / zfs-periodic: Test if scrubbing is in process fails when using volume describtors instead of pools
Message-ID:  <201201120946.q0C9kmTo079755@datastore01.seemoo.tu-darmstadt.de>
Resent-Message-ID: <201201121500.q0CF0Qot060110@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         164055
>Category:       ports
>Synopsis:       sysutils / zfs-periodic: Test if scrubbing is in process fails when using volume describtors instead of pools
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 12 15:00:26 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Marc Werner
>Release:        FreeBSD 8.2-RELEASE-p3 amd64
>Organization:
Technische Universität Darmstadt
>Environment:
System: FreeBSD datastore01.seemoo.tu-darmstadt.de 8.2-RELEASE-p3 FreeBSD 8.2-RELEASE-p3 #0: Tue Sep 27 18:45:57 UTC 2011 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64

One ZFS pool with different volumes. Each volume needs to be snapshotted differently. Some are only snapshotted on a daily basis others are snapshotted hourly.

>Description:
	
We have one zpool which contains different volumes created with 'zfs create' i.e. storage_pool01/home storage_pool01/www etc. Some of these volumes need to be snapshotted every hour others only once a day.
Using  sysutils / zfs-periodic we setup a configuration in /etc/periodic.conf which uses the volume descriptors (with the slash) in the *_zfs_snapshot_pools= option.

With this config the check if a scrub is running on the pool fails as zpool in the scrub_in_progress() function only accepts pool names (without a slash) but gets supplied volume names.

>How-To-Repeat:

Setup sysutils / zfs-periodic and /etc/periodic.conf to snapshot volumes (pool/volume) instead of entire pools. Our periodic.conf looks like this:

ourly_output="root"
hourly_show_success="NO"
hourly_show_info="YES"
hourly_show_badconfig="YES"

hourly_zfs_snapshot_enable="YES"
hourly_zfs_snapshot_pools="storage_pool01/home/staff storage_pool01/shares"
hourly_zfs_snapshot_keep=720

daily_zfs_snapshot_enable="YES"
daily_zfs_snapshot_pools="storage_pool01/home/students storage_pool01/home/hiwi"
daily_zfs_snapshot_keep=30

monthly_zfs_scrub_enable="YES"
monthly_zfs_scrub_pools="storage_pool01"


>Fix:

strip the pool from the volume descriptor before running zpool status in scrub_in_progress():

scrub_in_progress()
{
  # This code was added to allow snapshotting of single volumes without getting an error here
  IFS='/' read -ra  arr<<< "$1"
  pool=${arr[0]}

  if zpool status $pool | grep "scrub in progress" > /dev/null; then
    return 0
  else
    return 1
  fi
}


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201120946.q0C9kmTo079755>