diff --git a/examples/nagios/nagios_check_albserver.pl b/examples/nagios/nagios_check_albserver.pl deleted file mode 100755 index 25558505..00000000 --- a/examples/nagios/nagios_check_albserver.pl +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/perl - -## -# Copyright (c) 2018 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# nagios_check_albserver.pl -# -# This script parses the output of "vdo status" for a given VDO volume, -# determines if UDS deduplication is enabled, and if so, returns -# a Nagios-compliance status code and single-line output for the -# deduplication status. -# -# The "vdo" program must be in the path used by "sudo". The user executing -# this program should be granted permission via sudoers (with the "NOPASSWD:" -# option) to execute the "vdo" program. -# -# $Id: //eng/vdo-releases/magnesium/src/tools/nagios/nagios_check_albserver.pl#1 $ -# -## - -use strict; -use warnings FATAL => qw(all); -use List::MoreUtils qw(first_index true); - -# Constants for the Nagios service status return values. -use constant { - NAGIOS_SERVICE_OK => 0, - NAGIOS_SERVICE_WARNING => 1, - NAGIOS_SERVICE_CRITICAL => 2, - NAGIOS_SERVICE_UNKNOWN => 3, -}; - -if (scalar(@ARGV) != 1) { - print("Usage: nagios_check_albserver.pl \n"); - exit(NAGIOS_SERVICE_UNKNOWN); -} - -my $vdoName = $ARGV[0]; -my @vdoStatusOutput = `sudo vdo status --name=$vdoName 2>&1`; - -my $badPath = true {/vdo: command not found/} @vdoStatusOutput; -if ($badPath > 0) { - print("The vdo command is not in the current path.\n"); - exit(NAGIOS_SERVICE_UNKNOWN); -} - -my $notFound = true {/VDO volume.*not found/} @vdoStatusOutput; -if ($notFound > 0) { - print("VDO volume $vdoName not found.\n"); - exit(NAGIOS_SERVICE_UNKNOWN); -} - -my $udsDedupeConfigIndex = first_index {/Deduplication:/} - @vdoStatusOutput; - -my $udsServerStatusIndex = first_index {/Index status:/} - @vdoStatusOutput; - -my $udsDedupeConfig = $vdoStatusOutput[$udsDedupeConfigIndex]; -chomp($udsDedupeConfig); - -# Default message -my $udsServerStatus = "Index is not running."; - -# If the index is running, $udsServerStatusIndex will not be -1. -if ($udsServerStatusIndex != -1) { - # The index of the "Server status" data is one line below the title string. - $udsServerStatus = "$vdoStatusOutput[$udsServerStatusIndex]"; - chomp($udsServerStatus); -} - -if ($udsServerStatus =~ "online\$") { - print("Deduplication is online.\n"); - exit(NAGIOS_SERVICE_OK); -} - -if ($udsDedupeConfig =~ "disabled") { - print("Deduplication is disabled.\n"); - exit(NAGIOS_SERVICE_OK); -} - -print("$udsServerStatus\n"); -exit(NAGIOS_SERVICE_CRITICAL); diff --git a/examples/systemd/97-vdo.preset b/examples/systemd/97-vdo.preset new file mode 100644 index 00000000..aa60e7c9 --- /dev/null +++ b/examples/systemd/97-vdo.preset @@ -0,0 +1 @@ +enable vdo.service diff --git a/examples/systemd/Makefile b/examples/systemd/Makefile index 74b17a6d..135102ad 100644 --- a/examples/systemd/Makefile +++ b/examples/systemd/Makefile @@ -16,19 +16,22 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # -# $Id: //eng/vdo-releases/magnesium/src/packaging/src-dist/user/examples/systemd/Makefile#2 $ +# $Id: //eng/vdo-releases/magnesium/src/packaging/src-dist/user/examples/systemd/Makefile#3 $ SERVICEFILE=vdo.service EXAMPLEFILES=VDO.mount.example +PRESETFILE=97-vdo.preset INSTALL = install INSTALLOWNER ?= -o root -g root unitdir ?= /lib/systemd/system +presetdir ?= /lib/systemd/system-preset defaultdocdir ?= /usr/share/doc name ?= vdo INSTALLDIR=$(DESTDIR)/$(unitdir) EXAMPLESDIR=$(DESTDIR)/$(defaultdocdir)/$(name)/examples/systemd +PRESETDIR=$(DESTDIR)/$(presetdir) .PHONY: all clean install all:; @@ -38,6 +41,8 @@ clean:; install: $(INSTALL) $(INSTALLOWNER) -d $(INSTALLDIR) $(INSTALL) $(INSTALLOWNER) -m 644 $(SERVICEFILE) $(INSTALLDIR) + $(INSTALL) $(INSTALLOWNER) -d $(PRESETDIR) + $(INSTALL) $(INSTALLOWNER) -m 644 $(PRESETFILE) $(PRESETDIR) $(INSTALL) -d $(EXAMPLESDIR) for i in $(EXAMPLEFILES); do \ $(INSTALL) $(INSTALLOWNER) -m 644 $$i $(EXAMPLESDIR); \ diff --git a/utils/vdo/base/Makefile b/utils/vdo/base/Makefile index ffd4e252..84bf2280 100644 --- a/utils/vdo/base/Makefile +++ b/utils/vdo/base/Makefile @@ -17,7 +17,7 @@ # # $Id: //eng/vdo-releases/magnesium/src/packaging/src-dist/user/utils/vdo/base/Makefile#1 $ -VDO_VERSION = 6.1.1.12 +VDO_VERSION = 6.1.1.24 UDS_DIR = ../../uds diff --git a/utils/vdo/base/statusCodes.c b/utils/vdo/base/statusCodes.c index 74ab5b04..4ed025fa 100644 --- a/utils/vdo/base/statusCodes.c +++ b/utils/vdo/base/statusCodes.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * $Id: //eng/vdo-releases/magnesium/src/c++/vdo/base/statusCodes.c#3 $ + * $Id: //eng/vdo-releases/magnesium/src/c++/vdo/base/statusCodes.c#5 $ */ #include "statusCodes.h" @@ -44,7 +44,7 @@ const struct errorInfo vdoStatusList[] = { { "VDO_BLOCK_SIZE_TOO_SMALL", "The block size is too small" }, { "VDO_UNKNOWN_PARTITION", "No partition exists with a given id" }, { "VDO_PARTITION_EXISTS", "A partition already exists with a given id"}, - { "VDO_NOT_CLEAN", "The device is not in a clean state" }, + { "VDO_NOT_READ_ONLY", "The device is not in read-only mode" }, { "VDO_INCREMENT_TOO_SMALL", "Physical block growth of too few blocks" }, { "VDO_CHECKSUM_MISMATCH", "Incorrect checksum" }, { "VDO_RECOVERY_JOURNAL_FULL", "The recovery journal is full" }, @@ -62,6 +62,7 @@ const struct errorInfo vdoStatusList[] = { { "VDO_READ_CACHE_BUSY", "Read cache has no free slots" }, { "VDO_BIO_CREATION_FAILED", "Bio creation failed" }, { "VDO_BAD_MAGIC", "Bad magic number" }, + { "VDO_BAD_NONCE", "Bad nonce" }, { "VDO_JOURNAL_OVERFLOW", "Journal sequence number overflow" }, }; diff --git a/utils/vdo/base/statusCodes.h b/utils/vdo/base/statusCodes.h index 9df13220..bf3b08da 100644 --- a/utils/vdo/base/statusCodes.h +++ b/utils/vdo/base/statusCodes.h @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * $Id: //eng/vdo-releases/magnesium/src/c++/vdo/base/statusCodes.h#3 $ + * $Id: //eng/vdo-releases/magnesium/src/c++/vdo/base/statusCodes.h#5 $ */ #ifndef STATUS_CODES_H @@ -72,8 +72,8 @@ enum vdoStatusCodes { VDO_UNKNOWN_PARTITION, /** a partition already exists with a given id */ VDO_PARTITION_EXISTS, - /** the VDO is not in a clean state */ - VDO_NOT_CLEAN, + /** the VDO is not in read-only mode */ + VDO_NOT_READ_ONLY, /** physical block growth of too few blocks */ VDO_INCREMENT_TOO_SMALL, /** incorrect checksum */ @@ -108,6 +108,8 @@ enum vdoStatusCodes { VDO_BIO_CREATION_FAILED, /** bad magic number */ VDO_BAD_MAGIC, + /** bad nonce */ + VDO_BAD_NONCE, /** sequence number overflow */ VDO_JOURNAL_OVERFLOW, /** one more than last error code */ diff --git a/utils/vdo/base/types.h b/utils/vdo/base/types.h index cc24eeae..319ef8fb 100644 --- a/utils/vdo/base/types.h +++ b/utils/vdo/base/types.h @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * $Id: //eng/vdo-releases/magnesium/src/c++/vdo/base/types.h#5 $ + * $Id: //eng/vdo-releases/magnesium/src/c++/vdo/base/types.h#6 $ */ #ifndef TYPES_H @@ -336,6 +336,8 @@ typedef struct vdoConfig { typedef struct vdoLoadConfig { /** the offset on the physical layer where the VDO begins */ PhysicalBlockNumber firstBlockOffset; + /** the expected nonce of the VDO */ + Nonce nonce; /** the thread configuration of the VDO */ ThreadConfig *threadConfig; /** the page cache size, in pages */ diff --git a/utils/vdo/base/vdoLoad.c b/utils/vdo/base/vdoLoad.c index b5e6051e..74302b1b 100644 --- a/utils/vdo/base/vdoLoad.c +++ b/utils/vdo/base/vdoLoad.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * $Id: //eng/vdo-releases/magnesium/src/c++/vdo/base/vdoLoad.c#3 $ + * $Id: //eng/vdo-releases/magnesium/src/c++/vdo/base/vdoLoad.c#5 $ */ #include "vdoLoad.h" @@ -261,6 +261,12 @@ static int startVDODecode(VDO *vdo, bool validateConfig) return VDO_SUCCESS; } + if (vdo->loadConfig.nonce != vdo->nonce) { + return logErrorWithStringError(VDO_BAD_NONCE, "Geometry nonce %" PRIu64 + " does not match superblock nonce %" PRIu64, + vdo->loadConfig.nonce, vdo->nonce); + } + BlockCount blockCount = vdo->layer->getBlockCount(vdo->layer); return validateVDOConfig(&vdo->config, blockCount, true); } @@ -540,6 +546,7 @@ int loadVDO(PhysicalLayer *layer, } vdo->loadConfig.firstBlockOffset = getDataRegionOffset(geometry); + vdo->loadConfig.nonce = geometry.nonce; result = loadSuperBlock(layer, getFirstBlockOffset(vdo), &vdo->superBlock); if (result != VDO_SUCCESS) { freeVDO(&vdo); diff --git a/utils/vdo/user/Makefile b/utils/vdo/user/Makefile index e2e7975e..3b37e007 100644 --- a/utils/vdo/user/Makefile +++ b/utils/vdo/user/Makefile @@ -19,7 +19,7 @@ # $Id: //eng/vdo-releases/magnesium/src/packaging/src-dist/user/utils/vdo/user/Makefile#3 $ -VDO_VERSION = 6.1.1.12 +VDO_VERSION = 6.1.1.24 UDS_DIR = ../../uds VDO_BASE_DIR = ../base diff --git a/utils/vdo/user/vdoConfig.c b/utils/vdo/user/vdoConfig.c index 91edcdcd..9f07afb8 100644 --- a/utils/vdo/user/vdoConfig.c +++ b/utils/vdo/user/vdoConfig.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * $Id: //eng/vdo-releases/magnesium/src/c++/vdo/user/vdoConfig.c#5 $ + * $Id: //eng/vdo-releases/magnesium/src/c++/vdo/user/vdoConfig.c#6 $ */ #include @@ -354,7 +354,7 @@ static int updateVDOSuperBlockState(PhysicalLayer *layer, if (requireReadOnly && !inReadOnlyMode(vdo)) { freeVDO(&vdo); - return logErrorWithStringError(VDO_NOT_CLEAN, + return logErrorWithStringError(VDO_NOT_READ_ONLY, "Can't force rebuild on a normal VDO"); } diff --git a/vdo-manager/man/vdo.8 b/vdo-manager/man/vdo.8 index 3cfc3b45..32186f4a 100644 --- a/vdo-manager/man/vdo.8 +++ b/vdo-manager/man/vdo.8 @@ -17,7 +17,7 @@ .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA .\" 02110-1301, USA. .\" -.\" $Id: //eng/vdo-releases/magnesium/src/python/vdo/man/vdo.8#11 $ +.\" $Id: //eng/vdo-releases/magnesium/src/python/vdo/man/vdo.8#13 $ . .\" Constants (as strings, for ease of use and consistency) .ds ackThreadsDefault 1 @@ -43,8 +43,8 @@ .ds cpuThreadsMax 100 .ds deduplicationDefault enabled .ds emulate512Default disabled -.ds hashZoneThreadsDefault 2 -.ds hashZoneThreadsMin 1 +.ds hashZoneThreadsDefault 1 +.ds hashZoneThreadsMin 0 .ds hashZoneThreadsMax 100 .ds indexMemDefault 0.25 .ds indexMemIntMin 1 @@ -453,8 +453,8 @@ The logical size of the VDO volume. .B Physical size The size of a VDO volume's underlying physical storage. .TP -.B Write policy -The configured value of the write policy (sync or async). +.B Configured write policy +The configured value of the write policy (sync, async or auto). .TP .B VDO Statistics Output of the \fBvdostats\fP utility. diff --git a/vdo.spec b/vdo.spec index 7b37f257..aa44204e 100644 --- a/vdo.spec +++ b/vdo.spec @@ -4,7 +4,7 @@ # Summary: Management tools for Virtual Data Optimizer Name: vdo -Version: 6.1.1.12 +Version: 6.1.1.24 Release: %{spec_release} License: GPLv2 Source: %{name}-%{version}.tgz @@ -30,6 +30,7 @@ BuildRequires: python-devel BuildRequires: systemd BuildRequires: valgrind-devel BuildRequires: zlib-devel +%{?systemd_requires} # Disable an automatic dependency due to a file in examples/nagios. %define __requires_exclude perl @@ -50,13 +51,16 @@ make make install DESTDIR=$RPM_BUILD_ROOT INSTALLOWNER= bindir=%{_bindir} \ defaultdocdir=%{_defaultdocdir} name=%{name} \ python_sitelib=%{python_sitelib} mandir=%{_mandir} \ - unitdir=%{_unitdir} + unitdir=%{_unitdir} presetdir=%{_presetdir} %post -systemctl enable vdo.service || : +%systemd_post vdo.service %preun -systemctl disable vdo.service || : +%systemd_preun vdo.service + +%postun +%systemd_postun_with_restart vdo.service %files #defattr(-,root,root) @@ -162,6 +166,7 @@ systemctl disable vdo.service || : %{python_sitelib}/%{name}/utils/__init__.pyc %{python_sitelib}/%{name}/utils/__init__.pyo %{_unitdir}/vdo.service +%{_presetdir}/97-vdo.preset %dir %{_defaultdocdir}/%{name} %license %{_defaultdocdir}/%{name}/COPYING %dir %{_defaultdocdir}/%{name}/examples @@ -191,7 +196,11 @@ systemctl disable vdo.service || : %changelog -* Sat Feb 17 2018 - J. corwin Coburn - 6.1.1.12-1 -- Added support for 4.15 kernels. -- Modified spec files to support building on more distros. -- Removed unused code from the UDS module. +* Thu Mar 22 2018 - J. corwin Coburn - 6.1.1.24-1 +- Modified spec files to work with the Fedora copr repository. +- Removed obsolete nagios module. +- Fixed prerun handling of loaded kernel modules +- Modified spec files to use systemd macros +- Updated the vdo.8 man page +- Improved some error messages +