Blob Blame History Raw
From 685ec9cefc3c745ad1b342ba790d915adf99946a Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 26 Aug 2014 17:31:21 +0200
Subject: [PATCH] LVM: support negative numbers

Use Rx.relinteger instead of Rx.integer so negative numbers as values
can be read.

(cherry picked from commit ae8da966f6d29fb3977e6004a98a25774928c946)

Conflicts:
	AUTHORS
	NEWS

LVM: handle also /etc/lvm/lvm.conf

The syntax should be the same, so use the lvm lens also for the main
lvm2 configuration file.

(cherry picked from commit 6b15f76f731df1022d1ca8ceec0bced683bccf88)

Conflicts:
	NEWS
---
 AUTHORS                   | 1 +
 lenses/lvm.aug            | 3 ++-
 lenses/tests/test_lvm.aug | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/AUTHORS b/AUTHORS
index 514ad45..36e045e 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -93,3 +93,4 @@ Contributions by:
   Brian Harrington            <bharrington@redhat.com>
   Mathieu Alorent             <malorent@kumy.net>
   Rob Tucker                  <rtucker@mozilla.com>
+  Pino Toscano                <ptoscano@redhat.com>
diff --git a/lenses/lvm.aug b/lenses/lvm.aug
index 1636e9e..40cdc6a 100644
--- a/lenses/lvm.aug
+++ b/lenses/lvm.aug
@@ -26,7 +26,7 @@ module LVM =
 	(* strings can contain backslash-escaped dquotes, but I don't know
 	 * how to get the message across to augeas *)
 	let str = [label "str". Quote.do_dquote (store /([^\"]|\\\\.)*/)]
-	let int = [label "int". store Rx.integer]
+	let int = [label "int". store Rx.relinteger]
 	(* View: flat_literal
 	 * A literal without structure *)
 	let flat_literal = int|str
@@ -69,6 +69,7 @@ module LVM =
 	let filter =
 		  incl "/etc/lvm/archive/*.vg"
 		. incl "/etc/lvm/backup/*"
+		. incl "/etc/lvm/lvm.conf"
 		. Util.stdexcl
 
 	let xfm = transform lns filter
diff --git a/lenses/tests/test_lvm.aug b/lenses/tests/test_lvm.aug
index 869fbfc..8ee2377 100644
--- a/lenses/tests/test_lvm.aug
+++ b/lenses/tests/test_lvm.aug
@@ -24,6 +24,7 @@ VG1 {
 	extent_size = 8192		# 4 Megabytes
 	max_lv = 0
 	max_pv = 0
+	process_priority = -18
 
 	physical_volumes {
 		pv0 {
@@ -150,6 +151,9 @@ test LVM.lns get conf =
 			{ "max_pv"
 				{ "int" = "0" }
 			}
+			{ "process_priority"
+				{ "int" = "-18" }
+			}
 			{}
 			{ "physical_volumes"
 				{ "dict"