master - format_text: properly validate PV size for restore
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=05934d2538b761...
Commit: 05934d2538b76134fe4a5f4ddd7954ff32620b50
Parent: 2cea1c1bd9d432a7544713c49620e4cc2ab56ee6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu May 7 11:08:49 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 8 15:12:35 2015 +0200
format_text: properly validate PV size for restore
Use 64bit arithmentic for PV size calculation (Coverity).
Also remove sector shift for compared PV size, since all
values are already held in sectors.
This fixes validatio of PV size when restoring PV
from vg metadata backup file.
---
WHATS_NEW | 1 +
lib/format_text/format-text.c | 6 +++---
test/shell/pvcreate-restore.sh | 37 +++++++++++++++++++++++++++++++++++++
3 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3b22ec5..24f0c76 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.120 -
===============================
+ Properly validate PV size for pvcreate --restorefile.
Fix check if pvcreate wiped device (2.02.117).
Fix storing of vgid when caching metadata (2.02.118).
Fix recursive lvm-config man page. (2.02.119)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 759ad89..f38628c 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -1603,9 +1603,9 @@ static int _text_pv_initialise(const struct format_type *fmt,
if (rp->extent_count)
pv->pe_count = rp->extent_count;
- if ((pv->pe_start + pv->pe_count * pv->pe_size - 1) > (pv->size << SECTOR_SHIFT)) {
+ if ((pv->pe_start + pv->pe_count * (uint64_t)pv->pe_size - 1) > pv->size) {
log_error("Physical extents end beyond end of device %s.",
- pv_dev_name(pv));
+ pv_dev_name(pv));
return 0;
}
@@ -2172,7 +2172,7 @@ static int _text_pv_add_metadata_area(const struct format_type *fmt,
* LABEL_SCAN_SIZE.
*/
pe_end = pv->pe_count ? (pv->pe_start +
- pv->pe_count * pv->pe_size - 1) << SECTOR_SHIFT
+ pv->pe_count * (uint64_t)pv->pe_size - 1) << SECTOR_SHIFT
: 0;
if (pe_start || pe_start_locked) {
diff --git a/test/shell/pvcreate-restore.sh b/test/shell/pvcreate-restore.sh
new file mode 100644
index 0000000..7331396
--- /dev/null
+++ b/test/shell/pvcreate-restore.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/inittest
+
+aux prepare_vg 4
+
+lvcreate --type snapshot -s -L10 -n $lv1 $vg --virtualsize 2T
+lvcreate --type snapshot -s -L10 -n $lv2 $vg --virtualsize 4T
+lvcreate --type snapshot -s -L10 -n $lv3 $vg --virtualsize 4194300M
+
+aux extend_filter_LVMTEST
+
+vgcreate $vg1 "$DM_DEV_DIR/$vg/$lv2"
+
+vgcfgbackup -f vgback $vg1
+
+UUID=$(get pv_field "$DM_DEV_DIR/$vg/$lv2" uuid)
+pvremove -ff -y "$DM_DEV_DIR/$vg/$lv2"
+
+# too small to fit
+fail pvcreate --restorefile vgback --uuid $UUID "$DM_DEV_DIR/$vg/$lv1"
+
+# still does not fit
+fail pvcreate --restorefile vgback --uuid $UUID "$DM_DEV_DIR/$vg/$lv3"
+
+pvcreate --restorefile vgback --uuid $UUID "$DM_DEV_DIR/$vg/$lv2"
+
+vgremove -ff $vg
9 years
master - pvcreate: fix test for wiping status
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2cea1c1bd9d432...
Commit: 2cea1c1bd9d432a7544713c49620e4cc2ab56ee6
Parent: bf5cb4af8e7722a4b29bff0caf23a1c5a167a360
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu May 7 12:10:20 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 8 13:36:39 2015 +0200
pvcreate: fix test for wiping status
Commit ed420fb6917162ed17af69a9a0ec9ae26e61e209 changed
paramet wiped to be a pointer, but missed to switch
to test pointer dereferenced value and instead always
checked 'pointer'.
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 87ce45c..3b22ec5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.120 -
===============================
+ Fix check if pvcreate wiped device (2.02.117).
Fix storing of vgid when caching metadata (2.02.118).
Fix recursive lvm-config man page. (2.02.119)
Refactor polldaemon interfaces to poll every operation by VG/LV couple
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index a1a31eb..2a5be7d 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1504,7 +1504,7 @@ static int _pvcreate_check(struct cmd_context *cmd, const char *name,
goto out;
}
- if (wiped)
+ if (*wiped)
filter_refresh_needed = scan_needed = 1;
if (sigint_caught())
9 years
master - lvmcache: copy just 32bytes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bf5cb4af8e7722...
Commit: bf5cb4af8e7722a4b29bff0caf23a1c5a167a360
Parent: 87578b5d94a733b4b57b353c2430df32497a87a4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu May 7 11:28:22 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 8 13:31:59 2015 +0200
lvmcache: copy just 32bytes
Copy only bytes which fits.
vginfo->vgid is [ID_LEN + 1]
vgsummary->vgid has only [ID_LEN]
Reported by Coverity.
---
WHATS_NEW | 1 +
lib/cache/lvmcache.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 41f8739..87ce45c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.120 -
===============================
+ Fix storing of vgid when caching metadata (2.02.118).
Fix recursive lvm-config man page. (2.02.119)
Refactor polldaemon interfaces to poll every operation by VG/LV couple
Skip wait after testing in _wait_for_single_lv when polling finished
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 90e7b28..0d13c16 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -2233,7 +2233,8 @@ int lvmcache_lookup_mda(struct lvmcache_vgsummary *vgsummary)
vgsummary->vgname = vginfo->vgname;
vgsummary->creation_host = vginfo->creation_host;
vgsummary->vgstatus = vginfo->status;
- memcpy((char *)&vgsummary->vgid, vginfo->vgid, sizeof(vginfo->vgid));
+ /* vginfo->vgid has 1 extra byte then vgsummary->vgid */
+ memcpy(&vgsummary->vgid, vginfo->vgid, sizeof(vgsummary->vgid));
return 1;
}
9 years
master - man: Fix recursive lvm-config man page.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=87578b5d94a733...
Commit: 87578b5d94a733b4b57b353c2430df32497a87a4
Parent: 6d35c69b06ebe4b51edf277610eb803d23aba11d
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu May 7 12:07:40 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu May 7 12:07:40 2015 +0100
man: Fix recursive lvm-config man page.
---
WHATS_NEW | 1 +
man/lvm-config.8.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 94851aa..41f8739 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.120 -
===============================
+ Fix recursive lvm-config man page. (2.02.119)
Refactor polldaemon interfaces to poll every operation by VG/LV couple
Skip wait after testing in _wait_for_single_lv when polling finished
lvm2app closes locking on lvm_quit().
diff --git a/man/lvm-config.8.in b/man/lvm-config.8.in
index 3d1bec9..5050d77 100644
--- a/man/lvm-config.8.in
+++ b/man/lvm-config.8.in
@@ -1 +1 @@
-.so man8/lvm-config.8
+.so man8/lvmconfig.8
9 years
master - Python: Improve lv property test coverage
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6d35c69b06ebe4...
Commit: 6d35c69b06ebe4b51edf277610eb803d23aba11d
Parent: dc5190de74893ede7d3170b861ce8ae9327ecfae
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue May 5 13:48:52 2015 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed May 6 08:51:05 2015 -0500
Python: Improve lv property test coverage
Improve the python unit test case to cover all of the properties of a LV and
the properties of a LV segment.
In addition we also add a 'tag' to the lv so that we can retrieve it
using the 'lv_tags' property to ensure that this works as expected.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
test/api/python_lvm_unit.py | 56 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/test/api/python_lvm_unit.py b/test/api/python_lvm_unit.py
index e66ebda..6fc1963 100755
--- a/test/api/python_lvm_unit.py
+++ b/test/api/python_lvm_unit.py
@@ -21,7 +21,7 @@ import itertools
import sys
if sys.version_info[0] > 2:
- long = int
+ long = int
# Set of basic unit tests for the python bindings.
#
@@ -309,7 +309,11 @@ class TestLvm(unittest.TestCase):
def _test_prop(self, prop_obj, prop, var_type, settable):
result = prop_obj.getProperty(prop)
- self.assertEqual(type(result[0]), var_type)
+ #If we have no string value we can get a None type back
+ if result[0] is not None:
+ self.assertEqual(type(result[0]), var_type)
+ else:
+ self.assertTrue(str == var_type)
self.assertEqual(type(result[1]), bool)
self.assertTrue(result[1] == settable)
@@ -332,7 +336,53 @@ class TestLvm(unittest.TestCase):
lv_name = 'lv_test'
TestLvm._create_thin_lv(TestLvm._get_pv_device_names(), lv_name)
lv, vg = TestLvm._get_lv(None, lv_name)
- self._test_prop(lv, 'seg_count', long, False)
+
+ lv_seg_properties = [
+ ('chunk_size', long, False), ('devices', str, False),
+ ('discards', str, False), ('region_size', long, False),
+ ('segtype', str, False), ('seg_pe_ranges', str, False),
+ ('seg_size', long, False), ('seg_size_pe', long, False),
+ ('seg_start', long, False), ('seg_start_pe', long, False),
+ ('seg_tags', str, False), ('stripes', long, False),
+ ('stripe_size', long, False), ('thin_count', long, False),
+ ('transaction_id', long, False), ('zero', long, False)]
+
+ lv_properties = [
+ ('convert_lv', str, False), ('copy_percent', long, False),
+ ('data_lv', str, False), ('lv_attr', str, False),
+ ('lv_host', str, False), ('lv_kernel_major', long, False),
+ ('lv_kernel_minor', long, False),
+ ('lv_kernel_read_ahead', long, False),
+ ('lv_major', long, False), ('lv_minor', long, False),
+ ('lv_name', str, False), ('lv_path', str, False),
+ ('lv_profile', str, False), ('lv_read_ahead', long, False),
+ ('lv_size', long, False), ('lv_tags', str, False),
+ ('lv_time', str, False), ('lv_uuid', str, False),
+ ('metadata_lv', str, False), ('mirror_log', str, False),
+ ('lv_modules', str, False), ('move_pv', str, False),
+ ('origin', str, False), ('origin_size', long, False),
+ ('pool_lv', str, False), ('raid_max_recovery_rate', long, False),
+ ('raid_min_recovery_rate', long, False),
+ ('raid_mismatch_count', long, False),
+ ('raid_sync_action', str, False),
+ ('raid_write_behind', long, False), ('seg_count', long, False),
+ ('snap_percent', long, False), ('sync_percent', long, False)]
+
+ # Generic test case, make sure we get what we expect
+ for t in lv_properties:
+ self._test_prop(lv, *t)
+
+ segments = lv.listLVsegs()
+ if segments and len(segments):
+ for s in segments:
+ for t in lv_seg_properties:
+ self._test_prop(s, *t)
+
+ # Test specific cases
+ tag = 'hello_world'
+ lv.addTag(tag)
+ tags = lv.getProperty('lv_tags')
+ self.assertTrue(tag in tags[0])
vg.close()
def test_lv_tags(self):
9 years
master - lvm2app: Correct missing string properties
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dc5190de74893e...
Commit: dc5190de74893ede7d3170b861ce8ae9327ecfae
Parent: e8c11c7df0f1d582494922cbadb717296c02e05b
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon May 4 15:20:55 2015 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed May 6 08:51:04 2015 -0500
lvm2app: Correct missing string properties
Synopsis: STR_LIST needs to be treated as STR for properties.
For any lvm property that was internally 'typed' as a string list we were failing
to return a string in the property API. This was due to the fact that for the
properties to work the value needs to either be evaulated as a string or a
number. This change corrects the macro used to build the memory array of
structures so that the string bitfield is set as needed to ensure that the value
is a string.
https://bugzilla.redhat.com/show_bug.cgi?id=1139920
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
lib/properties/prop_common.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/properties/prop_common.h b/lib/properties/prop_common.h
index 0b1678d..9cc963a 100644
--- a/lib/properties/prop_common.h
+++ b/lib/properties/prop_common.h
@@ -132,6 +132,6 @@ static int _ ## NAME ## _get (const void *obj, struct lvm_property_type *prop) \
#define FIELD_MODIFIABLE 0x00000001
#define FIELD(type, strct, field_type, head, field, width, fn, id, desc, settable) \
- { type, #id, settable, field_type == STR, ((field_type == NUM) || (field_type == BIN) || (field_type == SIZ) || (field_type == PCT) || (field_type == SNUM)), ((field_type == SNUM) || (field_type == PCT)), { .integer = 0 }, _ ## id ## _get, _ ## id ## _set },
+ { type, #id, settable, (field_type == STR || field_type == STR_LIST), ((field_type == NUM) || (field_type == BIN) || (field_type == SIZ) || (field_type == PCT) || (field_type == SNUM)), ((field_type == SNUM) || (field_type == PCT)), { .integer = 0 }, _ ## id ## _get, _ ## id ## _set },
#endif
9 years
master - python: Check for NULL value before constructing string property
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e8c11c7df0f1d5...
Commit: e8c11c7df0f1d582494922cbadb717296c02e05b
Parent: c21f1ba07a4701b0653bc086673be43ede20efc1
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon May 4 15:19:48 2015 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed May 6 08:51:04 2015 -0500
python: Check for NULL value before constructing string property
When retrieving a property value that is a string, if the character pointer in C
was NULL, we would segfault. This change checks for non-null before creating a
python string representation. In the case where the character pointer is NULL
we will return a python 'None' for the value.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
python/liblvm.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/python/liblvm.c b/python/liblvm.c
index f4a7a2d..089abb3 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -877,7 +877,11 @@ static PyObject *get_property(struct lvm_property_value *prop)
PyTuple_SET_ITEM(pytuple, 0, Py_BuildValue("K", prop->value.integer));
}
} else {
- PyTuple_SET_ITEM(pytuple, 0, PYSTRTYPE_FROMSTRING(prop->value.string));
+ if ( prop->value.string ) {
+ PyTuple_SET_ITEM(pytuple, 0, PYSTRTYPE_FROMSTRING(prop->value.string));
+ } else {
+ PyTuple_SET_ITEM(pytuple, 0, Py_None);
+ }
}
if (prop->is_settable)
9 years
master - python: Build correct python value for numerical property
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c21f1ba07a4701...
Commit: c21f1ba07a4701b0653bc086673be43ede20efc1
Parent: 91f737383c7c4be70689c9d6ce809de00dc1485e
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon May 4 14:55:00 2015 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed May 6 08:51:04 2015 -0500
python: Build correct python value for numerical property
With the lvm2app C API adding the ability to determine when a property is
signed we can then use this information to construct the correct representation
of the number for python which will maintain value and sign. Previously, we
only represented the numbers in python as positive integers.
Python long type exceeds the range for unsigned and signed integers, we just
need to use the appropriate parsing code to build correctly.
Python part of the fix for:
https://bugzilla.redhat.com/show_bug.cgi?id=838257
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
python/liblvm.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/python/liblvm.c b/python/liblvm.c
index 6151745..f4a7a2d 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -870,10 +870,15 @@ static PyObject *get_property(struct lvm_property_value *prop)
if (!(pytuple = PyTuple_New(2)))
return NULL;
- if (prop->is_integer)
- PyTuple_SET_ITEM(pytuple, 0, Py_BuildValue("K", prop->value.integer));
- else
+ if (prop->is_integer) {
+ if (prop->is_signed) {
+ PyTuple_SET_ITEM(pytuple, 0, Py_BuildValue("L", prop->value.signed_integer));
+ } else {
+ PyTuple_SET_ITEM(pytuple, 0, Py_BuildValue("K", prop->value.integer));
+ }
+ } else {
PyTuple_SET_ITEM(pytuple, 0, PYSTRTYPE_FROMSTRING(prop->value.string));
+ }
if (prop->is_settable)
setable = Py_True;
9 years
master - lvm2app: Add signed numerical property values
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=91f737383c7c4b...
Commit: 91f737383c7c4be70689c9d6ce809de00dc1485e
Parent: 5bbf083cd1245a2d509dc0ef4fcc8b99a07da10f
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon May 4 14:51:41 2015 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed May 6 08:51:04 2015 -0500
lvm2app: Add signed numerical property values
Currently lvm2app properties have the following structure:
typedef struct lvm_property_value {
uint32_t is_settable:1;
uint32_t is_string:1;
uint32_t is_integer:1;
uint32_t is_valid:1;
uint32_t padding:28;
union {
const char *string;
uint64_t integer;
} value;
} lvm_property_value_t;
which assumes that numerical values were in the range of 0 to 2**64-1. However,
some of the properties were 'signed', like LV major/minor numbers and some
reserved values for properties that represent percentages. Thus when the
values were retrieved they were in two's complement notation. So for a -1
major number the API user would get a value of 18446744073709551615. The
API user could cast the returned value to an int64_t to handle this, but that
requires the API developer to look at the source code and determine when it
should be done.
This change modifies the return property structure to:
typedef struct lvm_property_value {
uint32_t is_settable:1;
uint32_t is_string:1;
uint32_t is_integer:1;
uint32_t is_valid:1;
uint32_t is_signed:1;
uint32_t padding:27;
union {
const char *string;
uint64_t integer;
int64_t signed_integer;
} value;
} lvm_property_value_t;
With this addition the API user can interrogate that the value is numerical,
(is_integer = 1) and subsequently check if it's signed (is_signed = 1) too.
If signed, then the API developer should use the union's signed_integer to
avoid casting.
This change maintains backwards compatibility as the structure size remains
unchanged and integer value remains unchanged. Only the additional bit
taken from the pad is utilized.
Bugzilla reference:
https://bugzilla.redhat.com/show_bug.cgi?id=838257
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
lib/properties/prop_common.h | 5 ++++-
lib/report/columns.h | 8 ++++----
lib/report/properties.c | 3 ++-
lib/report/report.c | 2 ++
liblvm/lvm2app.h | 4 +++-
liblvm/lvm_misc.c | 1 +
liblvm/lvm_prop.c | 2 +-
7 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/lib/properties/prop_common.h b/lib/properties/prop_common.h
index d7d01af..0b1678d 100644
--- a/lib/properties/prop_common.h
+++ b/lib/properties/prop_common.h
@@ -26,9 +26,11 @@ struct lvm_property_type {
unsigned is_settable:1;
unsigned is_string:1;
unsigned is_integer:1;
+ unsigned is_signed:1;
union {
const char *string;
uint64_t integer;
+ int64_t signed_integer;
} value;
int (*get) (const void *obj, struct lvm_property_type *prop);
int (*set) (void *obj, struct lvm_property_type *prop);
@@ -126,9 +128,10 @@ static int _ ## NAME ## _get (const void *obj, struct lvm_property_type *prop) \
#define SIZ 4
#define PCT 5
#define STR_LIST 6
+#define SNUM 7 /* Signed Number */
#define FIELD_MODIFIABLE 0x00000001
#define FIELD(type, strct, field_type, head, field, width, fn, id, desc, settable) \
- { type, #id, settable, field_type == STR, ((field_type == NUM) || (field_type == BIN) || (field_type == SIZ) || (field_type == PCT)), { .integer = 0 }, _ ## id ## _get, _ ## id ## _set },
+ { type, #id, settable, field_type == STR, ((field_type == NUM) || (field_type == BIN) || (field_type == SIZ) || (field_type == PCT) || (field_type == SNUM)), ((field_type == SNUM) || (field_type == PCT)), { .integer = 0 }, _ ## id ## _get, _ ## id ## _set },
#endif
diff --git a/lib/report/columns.h b/lib/report/columns.h
index cf84295..06282c5 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -56,8 +56,8 @@ FIELD(LVS, lv, STR, "Active", lvid, 6, lvactive, lv_active, "Active state of the
FIELD(LVS, lv, BIN, "ActLocal", lvid, 10, lvactivelocally, lv_active_locally, "Set if the LV is active locally.", 0)
FIELD(LVS, lv, BIN, "ActRemote", lvid, 10, lvactiveremotely, lv_active_remotely, "Set if the LV is active remotely.", 0)
FIELD(LVS, lv, BIN, "ActExcl", lvid, 10, lvactiveexclusively, lv_active_exclusively, "Set if the LV is active exclusively.", 0)
-FIELD(LVS, lv, NUM, "Maj", major, 3, int32, lv_major, "Persistent major number or -1 if not persistent.", 0)
-FIELD(LVS, lv, NUM, "Min", minor, 3, int32, lv_minor, "Persistent minor number or -1 if not persistent.", 0)
+FIELD(LVS, lv, SNUM, "Maj", major, 3, int32, lv_major, "Persistent major number or -1 if not persistent.", 0)
+FIELD(LVS, lv, SNUM, "Min", minor, 3, int32, lv_minor, "Persistent minor number or -1 if not persistent.", 0)
FIELD(LVS, lv, SIZ, "Rahead", lvid, 6, lvreadahead, lv_read_ahead, "Read ahead setting in current units.", 0)
FIELD(LVS, lv, SIZ, "LSize", size, 5, size64, lv_size, "Size of LV in current units.", 0)
FIELD(LVS, lv, SIZ, "MSize", lvid, 6, lvmetadatasize, lv_metadata_size, "For thin and cache pools, the size of the LV that holds the metadata.", 0)
@@ -88,8 +88,8 @@ FIELD(LVS, lv, STR, "Time", lvid, 26, lvtime, lv_time, "Creation time of the LV,
FIELD(LVS, lv, STR, "Host", lvid, 10, lvhost, lv_host, "Creation host of the LV, if known.", 0)
FIELD(LVS, lv, STR_LIST, "Modules", lvid, 7, modules, lv_modules, "Kernel device-mapper modules required for this LV.", 0)
-FIELD(LVSINFO, lv, NUM, "KMaj", lvid, 4, lvkmaj, lv_kernel_major, "Currently assigned major number or -1 if LV is not active.", 0)
-FIELD(LVSINFO, lv, NUM, "KMin", lvid, 4, lvkmin, lv_kernel_minor, "Currently assigned minor number or -1 if LV is not active.", 0)
+FIELD(LVSINFO, lv, SNUM, "KMaj", lvid, 4, lvkmaj, lv_kernel_major, "Currently assigned major number or -1 if LV is not active.", 0)
+FIELD(LVSINFO, lv, SNUM, "KMin", lvid, 4, lvkmin, lv_kernel_minor, "Currently assigned minor number or -1 if LV is not active.", 0)
FIELD(LVSINFO, lv, SIZ, "KRahead", lvid, 7, lvkreadahead, lv_kernel_read_ahead, "Currently-in-use read ahead setting in current units.", 0)
FIELD(LVSINFO, lv, STR, "LPerms", lvid, 8, lvpermissions, lv_permissions, "LV permissions.", 0)
FIELD(LVSINFO, lv, BIN, "Suspended", lvid, 10, lvsuspended, lv_suspended, "Set if LV is suspended.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index ea70690..b0a91a7 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -462,7 +462,7 @@ GET_PVSEG_NUM_PROPERTY_FN(pvseg_size, (SECTOR_SIZE * pvseg->len))
struct lvm_property_type _properties[] = {
#include "columns.h"
- { 0, "", 0, 0, 0, { .integer = 0 }, prop_not_implemented_get, prop_not_implemented_set },
+ { 0, "", 0, 0, 0, 0, { .integer = 0 }, prop_not_implemented_get, prop_not_implemented_set },
};
#undef STR
@@ -471,6 +471,7 @@ struct lvm_property_type _properties[] = {
#undef SIZ
#undef PCT
#undef STR_LIST
+#undef SNUM
#undef FIELD
int lvseg_get_property(const struct lv_segment *lvseg,
diff --git a/lib/report/report.c b/lib/report/report.c
index 500bf2b..a107669 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -2057,6 +2057,7 @@ static const struct dm_report_object_type _devtypes_report_types[] = {
#define SIZ DM_REPORT_FIELD_TYPE_SIZE
#define PCT DM_REPORT_FIELD_TYPE_PERCENT
#define STR_LIST DM_REPORT_FIELD_TYPE_STRING_LIST
+#define SNUM DM_REPORT_FIELD_TYPE_NUMBER
#define FIELD(type, strct, sorttype, head, field, width, func, id, desc, writeable) \
{type, sorttype, offsetof(type_ ## strct, field), width, \
#id, head, &_ ## func ## _disp, desc},
@@ -2085,6 +2086,7 @@ static const struct dm_report_field_type _devtypes_fields[] = {
#undef BIN
#undef SIZ
#undef STR_LIST
+#undef SNUM
#undef FIELD
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h
index 3692f9a..1a5bc08 100644
--- a/liblvm/lvm2app.h
+++ b/liblvm/lvm2app.h
@@ -231,10 +231,12 @@ typedef struct lvm_property_value {
uint32_t is_string:1;
uint32_t is_integer:1;
uint32_t is_valid:1;
- uint32_t padding:28;
+ uint32_t is_signed:1;
+ uint32_t padding:27;
union {
const char *string;
uint64_t integer;
+ int64_t signed_integer;
} value;
} lvm_property_value_t;
diff --git a/liblvm/lvm_misc.c b/liblvm/lvm_misc.c
index ff26cdf..431d354 100644
--- a/liblvm/lvm_misc.c
+++ b/liblvm/lvm_misc.c
@@ -88,6 +88,7 @@ struct lvm_property_value get_property(const pv_t pv, const vg_t vg,
v.is_settable = prop.is_settable;
v.is_string = prop.is_string;
v.is_integer = prop.is_integer;
+ v.is_signed = prop.is_signed;
if (v.is_string)
v.value.string = prop.value.string;
if (v.is_integer)
diff --git a/liblvm/lvm_prop.c b/liblvm/lvm_prop.c
index 79ed113..4ea868d 100644
--- a/liblvm/lvm_prop.c
+++ b/liblvm/lvm_prop.c
@@ -41,7 +41,7 @@ SET_PVCREATEPARAMS_NUM_PROPERTY_FN(zero, pvcp->zero)
struct lvm_property_type _lib_properties[] = {
#include "lvm_prop_fields.h"
- { 0, "", 0, 0, 0, { .integer = 0 }, prop_not_implemented_get,
+ { 0, "", 0, 0, 0, 0, { .integer = 0 }, prop_not_implemented_get,
prop_not_implemented_set },
};
9 years
master - tests: do not restart lvmetad when not necessary
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5bbf083cd1245a...
Commit: 5bbf083cd1245a2d509dc0ef4fcc8b99a07da10f
Parent: 9fc6b654f55dfe0d6c1a7fc214f9d35cb505be11
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Wed May 6 15:20:11 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Wed May 6 15:20:11 2015 +0200
tests: do not restart lvmetad when not necessary
overlooked pvmove-restart test during cleanup
---
test/shell/pvmove-restart.sh | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/test/shell/pvmove-restart.sh b/test/shell/pvmove-restart.sh
index e1408bf..1ef9a24 100644
--- a/test/shell/pvmove-restart.sh
+++ b/test/shell/pvmove-restart.sh
@@ -75,10 +75,7 @@ if test -e LOCAL_CLVMD ; then
aux prepare_clvmd
fi
-if test -e LOCAL_LVMETAD ; then
- # Restart lvmetad (kill is built-in)
- aux prepare_lvmetad
-fi
+aux notify_lvmetad "$dev1" "$dev2" "$dev3"
# Only PVs should be left in table...
dmsetup table
9 years