master - lvconvert: Improve message for raid without -m.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=46c8d6bb8ae91e...
Commit: 46c8d6bb8ae91ee67c8633496cc6c3d92bb4f3ce
Parent: eb22f7c8f7351a38fc4447f56ff588f497037c23
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Nov 30 22:36:05 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Nov 30 22:36:05 2015 +0000
lvconvert: Improve message for raid without -m.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0096d1e..d2bdb58 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.137 -
=====================================
+ Avoid misleading error with -m is omitted with lvconvert to raid types.
Version 2.02.136 - 28th November 2015
=====================================
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 72be45b..b309b9e 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -242,9 +242,9 @@ static int _check_conversion_type(struct cmd_context *cmd, const char *type_str)
if (!type_str || !*type_str)
return 1;
- if (!strcmp(type_str, "mirror")) {
+ if (!strcmp(type_str, "mirror") || !strncmp(type_str, "raid", 4)) {
if (!arg_count(cmd, mirrors_ARG)) {
- log_error("--type mirror requires -m/--mirrors");
+ log_error("Mirror and raid conversions require -m/--mirrors");
return 0;
}
return 1;
7 years, 6 months
master - lvmcache: new function to check if VG is foreign
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eb22f7c8f7351a...
Commit: eb22f7c8f7351a38fc4447f56ff588f497037c23
Parent: 05ac8367980afb0b660fc312b228337e256a38e8
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Nov 30 11:54:56 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Nov 30 11:54:56 2015 -0600
lvmcache: new function to check if VG is foreign
When not using lvmetad, this uses the system_id field in
the cached vginfo structs that are populated during a scan.
When using lvmetad, this requests the VG from lvmetad, and
checks the system_id field in the returned metadata.
---
lib/cache/lvmcache.c | 14 ++++++++++++++
lib/cache/lvmcache.h | 1 +
lib/cache/lvmetad.c | 26 ++++++++++++++++++++++++++
lib/cache/lvmetad.h | 3 +++
4 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 6c86a40..985ff43 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -2402,3 +2402,17 @@ void lvmcache_get_max_name_lengths(struct cmd_context *cmd,
}
}
+int lvmcache_vg_is_foreign(struct cmd_context *cmd, const char *vgname, const char *vgid)
+{
+ struct lvmcache_vginfo *vginfo;
+ int ret = 0;
+
+ if (lvmetad_active())
+ return lvmetad_vg_is_foreign(cmd, vgname, vgid);
+
+ if ((vginfo = lvmcache_vginfo_from_vgid(vgid)))
+ ret = !is_system_id_allowed(cmd, vginfo->system_id);
+
+ return ret;
+}
+
diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h
index ed1b916..b968a12 100644
--- a/lib/cache/lvmcache.h
+++ b/lib/cache/lvmcache.h
@@ -194,5 +194,6 @@ int lvmcache_contains_lock_type_sanlock(struct cmd_context *cmd);
void lvmcache_get_max_name_lengths(struct cmd_context *cmd,
unsigned *pv_max_name_len, unsigned *vg_max_name_len);
+int lvmcache_vg_is_foreign(struct cmd_context *cmd, const char *vgname, const char *vgid);
#endif
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 78844c4..6d9a2f7 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -1808,3 +1808,29 @@ void lvmetad_validate_global_cache(struct cmd_context *cmd, int force)
_update_changed_pvs_in_udev(cmd, &pvc_before, &pvc_after);
}
}
+
+int lvmetad_vg_is_foreign(struct cmd_context *cmd, const char *vgname, const char *vgid)
+{
+ daemon_reply reply;
+ struct dm_config_node *top;
+ const char *system_id = NULL;
+ char uuid[64];
+ int ret;
+
+ if (!id_write_format((const struct id*)vgid, uuid, sizeof(uuid)))
+ return_0;
+
+ reply = _lvmetad_send("vg_lookup",
+ "uuid = %s", uuid,
+ "name = %s", vgname,
+ NULL);
+
+ if ((top = dm_config_find_node(reply.cft->root, "metadata")))
+ system_id = dm_config_find_str(top, "metadata/system_id", NULL);
+
+ ret = !is_system_id_allowed(cmd, system_id);
+
+ daemon_reply_destroy(reply);
+ return ret;
+}
+
diff --git a/lib/cache/lvmetad.h b/lib/cache/lvmetad.h
index af0d562..2c0b134 100644
--- a/lib/cache/lvmetad.h
+++ b/lib/cache/lvmetad.h
@@ -169,6 +169,8 @@ int lvmetad_pvscan_foreign_vgs(struct cmd_context *cmd, activation_handler handl
int lvmetad_vg_clear_outdated_pvs(struct volume_group *vg);
void lvmetad_validate_global_cache(struct cmd_context *cmd, int force);
+int lvmetad_vg_is_foreign(struct cmd_context *cmd, const char *vgname, const char *vgid);
+
# else /* LVMETAD_SUPPORT */
# define lvmetad_init(cmd) do { } while (0)
@@ -197,6 +199,7 @@ void lvmetad_validate_global_cache(struct cmd_context *cmd, int force);
# define lvmetad_pvscan_foreign_vgs(cmd, handler) (0)
# define lvmetad_vg_clear_outdated_pvs(vg) (1)
# define lvmetad_validate_global_cache(cmd, force) do { } while (0)
+# define lvmetad_vg_is_foreign(cmd, vgname, vgid) (0)
# endif /* LVMETAD_SUPPORT */
7 years, 6 months
master - system_id: refactor check for allowed system_id
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=05ac8367980afb...
Commit: 05ac8367980afb0b660fc312b228337e256a38e8
Parent: d3ca18e489d48cc7c7b2a877b95b5a9a324e8e30
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Nov 30 11:46:55 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Nov 30 11:46:55 2015 -0600
system_id: refactor check for allowed system_id
Refactor the code that checks for an allowable system_id
so that it can be used from other places.
---
lib/metadata/metadata-exported.h | 2 +
lib/metadata/metadata.c | 49 ++++++++++++++++++++++++-------------
2 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index f009687..8242db1 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1238,4 +1238,6 @@ int validate_vg_rename_params(struct cmd_context *cmd,
int is_lockd_type(const char *lock_type);
+int is_system_id_allowed(struct cmd_context *cmd, const char *system_id);
+
#endif
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 7ee928d..bf030d3 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4854,39 +4854,53 @@ static int _access_vg_lock_type(struct cmd_context *cmd, struct volume_group *vg
return 1;
}
-static int _access_vg_systemid(struct cmd_context *cmd, struct volume_group *vg)
+int is_system_id_allowed(struct cmd_context *cmd, const char *system_id)
{
/*
- * LVM1 VGs must not be accessed if a new-style LVM2 system ID is set.
+ * A VG without a system_id can be accessed by anyone.
*/
- if (cmd->system_id && systemid_on_pvs(vg)) {
- log_error("Cannot access VG %s with LVM1 system ID %s when host system ID is set.",
- vg->name, vg->lvm1_system_id);
- return 0;
- }
+ if (!system_id || !system_id[0])
+ return 1;
/*
- * A VG without a system_id can be accessed by anyone.
+ * Allowed if the host and VG system_id's match.
*/
- if (!vg->system_id || !vg->system_id[0])
+ if (cmd->system_id && !strcmp(cmd->system_id, system_id))
return 1;
/*
- * A few commands allow read-only access to foreign VGs.
+ * Allowed if a host's extra system_id matches.
*/
- if (cmd->include_foreign_vgs)
+ if (cmd->system_id && _allow_extra_system_id(cmd, system_id))
return 1;
/*
- * A host can access a VG with a matching system_id.
+ * Not allowed if the host does not have a system_id
+ * and the VG does, or if the host and VG's system_id's
+ * do not match.
*/
- if (cmd->system_id && !strcmp(vg->system_id, cmd->system_id))
- return 1;
+ return 0;
+}
+
+static int _access_vg_systemid(struct cmd_context *cmd, struct volume_group *vg)
+{
/*
- * A host can access a VG if the VG's system_id is in extra_system_ids list.
+ * LVM1 VGs must not be accessed if a new-style LVM2 system ID is set.
*/
- if (cmd->system_id && _allow_extra_system_id(cmd, vg->system_id))
+ if (cmd->system_id && systemid_on_pvs(vg)) {
+ log_error("Cannot access VG %s with LVM1 system ID %s when host system ID is set.",
+ vg->name, vg->lvm1_system_id);
+ return 0;
+ }
+
+ /*
+ * A few commands allow read-only access to foreign VGs.
+ */
+ if (cmd->include_foreign_vgs)
+ return 1;
+
+ if (is_system_id_allowed(cmd, vg->system_id))
return 1;
/*
@@ -4901,7 +4915,8 @@ static int _access_vg_systemid(struct cmd_context *cmd, struct volume_group *vg)
}
/*
- * A host without a system_id cannot access a VG with a system_id.
+ * Print an error when reading a VG that has a system_id
+ * and the host system_id is unknown.
*/
if (!cmd->system_id || cmd->unknown_system_id) {
log_error("Cannot access VG %s with system ID %s with unknown local system ID.",
7 years, 6 months
master - lvmcache: include system_id in vginfo cache
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d3ca18e489d48c...
Commit: d3ca18e489d48cc7c7b2a877b95b5a9a324e8e30
Parent: 1f357532bb8d6094bffecde48ad8d4b8e4fc430c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Nov 30 11:32:17 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Nov 30 11:32:17 2015 -0600
lvmcache: include system_id in vginfo cache
Save system_id just like creation_host and lock_type
strings in vginfo cache.
---
lib/cache/lvmcache.c | 36 ++++++++++++++++++++++++++++++------
lib/cache/lvmcache.h | 1 +
lib/format_text/import_vsn1.c | 7 ++++++-
3 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 8ab1a31..6c86a40 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -56,6 +56,7 @@ struct lvmcache_vginfo {
char _padding[7];
struct lvmcache_vginfo *next; /* Another VG with same name? */
char *creation_host;
+ char *system_id;
char *lock_type;
uint32_t mda_checksum;
size_t mda_size;
@@ -1448,7 +1449,8 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
}
static int _lvmcache_update_vgstatus(struct lvmcache_info *info, uint32_t vgstatus,
- const char *creation_host, const char *lock_type)
+ const char *creation_host, const char *lock_type,
+ const char *system_id)
{
if (!info || !info->vginfo)
return 1;
@@ -1482,20 +1484,41 @@ static int _lvmcache_update_vgstatus(struct lvmcache_info *info, uint32_t vgstat
set_lock_type:
if (!lock_type)
- goto out;
+ goto set_system_id;
if (info->vginfo->lock_type && !strcmp(lock_type, info->vginfo->lock_type))
- goto out;
+ goto set_system_id;
if (info->vginfo->lock_type)
dm_free(info->vginfo->lock_type);
if (!(info->vginfo->lock_type = dm_strdup(lock_type))) {
- log_error("cache creation host alloc failed for %s",
- lock_type);
+ log_error("cache lock_type alloc failed for %s", lock_type);
+ return 0;
+ }
+
+ log_debug_cache("lvmcache: %s: VG %s: Set lock_type to %s.",
+ dev_name(info->dev), info->vginfo->vgname, lock_type);
+
+set_system_id:
+
+ if (!system_id)
+ goto out;
+
+ if (info->vginfo->system_id && !strcmp(system_id, info->vginfo->system_id))
+ goto out;
+
+ if (info->vginfo->system_id)
+ dm_free(info->vginfo->system_id);
+
+ if (!(info->vginfo->system_id = dm_strdup(system_id))) {
+ log_error("cache system_id alloc failed for %s", system_id);
return 0;
}
+ log_debug_cache("lvmcache: %s: VG %s: Set system_id to %s.",
+ dev_name(info->dev), info->vginfo->vgname, system_id);
+
out:
return 1;
}
@@ -1561,7 +1584,7 @@ int lvmcache_update_vgname_and_id(struct lvmcache_info *info, struct lvmcache_vg
if (!_lvmcache_update_vgname(info, vgname, vgid, vgsummary->vgstatus,
vgsummary->creation_host, info->fmt) ||
!_lvmcache_update_vgid(info, info->vginfo, vgid) ||
- !_lvmcache_update_vgstatus(info, vgsummary->vgstatus, vgsummary->creation_host, vgsummary->lock_type) ||
+ !_lvmcache_update_vgstatus(info, vgsummary->vgstatus, vgsummary->creation_host, vgsummary->lock_type, vgsummary->system_id) ||
!_lvmcache_update_vg_mda_info(info, vgsummary->mda_checksum, vgsummary->mda_size))
return_0;
@@ -1577,6 +1600,7 @@ int lvmcache_update_vg(struct volume_group *vg, unsigned precommitted)
.vgname = vg->name,
.vgstatus = vg->status,
.vgid = vg->id,
+ .system_id = vg->system_id,
.lock_type = vg->lock_type
};
diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h
index ccf3eb4..ed1b916 100644
--- a/lib/cache/lvmcache.h
+++ b/lib/cache/lvmcache.h
@@ -55,6 +55,7 @@ struct lvmcache_vgsummary {
struct id vgid;
uint64_t vgstatus;
char *creation_host;
+ const char *system_id;
const char *lock_type;
uint32_t mda_checksum;
size_t mda_size;
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index 879aae7..6aa227b 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -1042,6 +1042,7 @@ static int _read_vgname(const struct format_type *fmt, const struct dm_config_tr
{
const struct dm_config_node *vgn;
struct dm_pool *mem = fmt->cmd->mem;
+ const char *str;
int old_suppress;
old_suppress = log_suppress(2);
@@ -1073,7 +1074,11 @@ static int _read_vgname(const struct format_type *fmt, const struct dm_config_tr
return 0;
}
- dm_config_get_str(vgn, "lock_type", &vgsummary->lock_type);
+ if (dm_config_get_str(vgn, "system_id", &str))
+ vgsummary->system_id = dm_pool_strdup(mem, str);
+
+ if (dm_config_get_str(vgn, "lock_type", &str))
+ vgsummary->lock_type = dm_pool_strdup(mem, str);
return 1;
}
7 years, 6 months
master - lvmetad: include both vgid and vgname in lookup request
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1f357532bb8d60...
Commit: 1f357532bb8d6094bffecde48ad8d4b8e4fc430c
Parent: cd4d2cff97dc4388080a06cb416861d9139d9d09
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Nov 24 14:47:53 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Nov 30 10:57:30 2015 -0600
lvmetad: include both vgid and vgname in lookup request
When the command already knows both the vgid and vgname,
it should send both to lvmetad for a more exact request,
and it can save lvmetad the work of a name lookup.
---
lib/cache/lvmetad.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index dced80a..78844c4 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -520,18 +520,29 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
if (vgid) {
if (!id_write_format((const struct id*)vgid, uuid, sizeof(uuid)))
return_NULL;
- log_debug_lvmetad("Asking lvmetad for VG %s (%s)", uuid, vgname ? : "name unknown");
+ }
+
+ if (vgid && vgname) {
+ log_debug_lvmetad("Asking lvmetad for VG %s %s", uuid, vgname);
+ reply = _lvmetad_send("vg_lookup",
+ "uuid = %s", uuid,
+ "name = %s", vgname,
+ NULL);
+ diag_name = uuid;
+
+ } else if (vgid) {
+ log_debug_lvmetad("Asking lvmetad for VG vgid %s", uuid);
reply = _lvmetad_send("vg_lookup", "uuid = %s", uuid, NULL);
diag_name = uuid;
- } else {
- if (!vgname) {
- log_error(INTERNAL_ERROR "VG name required (VGID not available)");
- reply = _lvmetad_send("vg_lookup", "name = %s", "MISSING", NULL);
- goto out;
- }
+
+ } else if (vgname) {
log_debug_lvmetad("Asking lvmetad for VG %s", vgname);
reply = _lvmetad_send("vg_lookup", "name = %s", vgname, NULL);
diag_name = vgname;
+
+ } else {
+ log_error(INTERNAL_ERROR "VG name required (VGID not available)");
+ goto out;
}
if (_lvmetad_handle_reply(reply, "lookup VG", diag_name, &found) && found) {
7 years, 6 months
v2_02_136 annotated tag has been created
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3a73164f53486e...
Commit: 3a73164f53486e5c75a34f420c120ad2703ddcf8
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2015-11-28 01:28 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2015-11-28 01:28 +0000
annotated tag: v2_02_136 has been created
at 3a73164f53486e5c75a34f420c120ad2703ddcf8 (tag)
tagging b4a3aaf910fc2216635c443deed5c26c535ab742 (commit)
replaces v2_02_135
Release 2.02.136.
Another development release. Do not ship this release.
36 files changed, 613 insertions(+), 529 deletions(-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlZZAysACgkQIoGRwVZ+LBfh5wCfSVEnKWytXE0BvDHgkGEfiCiP
o8QAoIUBRoj6Te+eYC/mI5bYj4qK1sto
=wsdv
-----END PGP SIGNATURE-----
Alasdair G Kergon (2):
post-release
pre-release
David Teigland (1):
man lvmcache: include chunk size
Peter Rajnoha (1):
lvmconfig: add --sinceversion for --type new
Zdenek Kabelac (20):
libdm: drop extra space from cache target line
libdm: enhance thin-pool preload
memlock: add more libs on ignore list
thin: work with active thin-pool
cleanup: move towards using direct LV pointers
thin: skip detach preload from pools
cleanup: use display_lvname
tests: data correctness after thin-pool resize
tests: improve teardown
thin: fix previous update of partial tree building
cleanup: rename vg_ondisk to vg_committed
cleanup: change ondisk committed
cleanup: rename lv_ondisk to lv_committed
libdm: const raid params and error for unsupported type
cleanup: avoid allocation for vg_name
cleanup: remove unused code
cleanup: using display_lvname
debug: show LV name where dlid creation failed
cleanup: clean gcc shadow declaration of version warning
tests: make unit testing usable again
7 years, 6 months
master - post-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cd4d2cff97dc43...
Commit: cd4d2cff97dc4388080a06cb416861d9139d9d09
Parent: b4a3aaf910fc2216635c443deed5c26c535ab742
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Sat Nov 28 01:29:00 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Sat Nov 28 01:29:00 2015 +0000
post-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 3 +++
WHATS_NEW_DM | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index cd7f045..759b847 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.136(2)-git (2015-11-28)
+2.02.137(2)-git (2015-11-28)
diff --git a/VERSION_DM b/VERSION_DM
index 57a2b46..04ea29b 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.112-git (2015-11-28)
+1.02.113-git (2015-11-28)
diff --git a/WHATS_NEW b/WHATS_NEW
index 03deb17..0096d1e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,6 @@
+Version 2.02.137 -
+=====================================
+
Version 2.02.136 - 28th November 2015
=====================================
Add new --sinceversion option for lvmconfig --type new.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index fe37db9..9f15242 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.113 -
+=====================================
+
Version 1.02.112 - 28th November 2015
=====================================
Show error message when trying to create unsupported raid type.
7 years, 6 months
master - pre-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b4a3aaf910fc22...
Commit: b4a3aaf910fc2216635c443deed5c26c535ab742
Parent: 1fb8d746d62aa14c5ed18bb917b5b0d447d436ae
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Sat Nov 28 01:25:53 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Sat Nov 28 01:25:53 2015 +0000
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 2 +-
WHATS_NEW_DM | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/VERSION b/VERSION
index 0d41f8a..cd7f045 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.136(2)-git (2015-11-23)
+2.02.136(2)-git (2015-11-28)
diff --git a/VERSION_DM b/VERSION_DM
index b849a41..57a2b46 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.112-git (2015-11-23)
+1.02.112-git (2015-11-28)
diff --git a/WHATS_NEW b/WHATS_NEW
index c3afac3..03deb17 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,4 +1,4 @@
-Version 2.02.136 -
+Version 2.02.136 - 28th November 2015
=====================================
Add new --sinceversion option for lvmconfig --type new.
Fix inactive table loaded for wrapping thin-pool when resizing it.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index a510938..fe37db9 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,4 +1,4 @@
-Version 1.02.112 -
+Version 1.02.112 - 28th November 2015
=====================================
Show error message when trying to create unsupported raid type.
Improve preloading sequence of an active thin-pool target.
7 years, 6 months
master - tests: make unit testing usable again
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1fb8d746d62aa1...
Commit: 1fb8d746d62aa14c5ed18bb917b5b0d447d436ae
Parent: ec647f1d431214264aaa396b6d0ba8e97738f00b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 27 10:54:57 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 27 11:22:21 2015 +0100
tests: make unit testing usable again
Make unit tests usable/compilable with newer header files.
Add 'initial' dmlist_t for list tests.
More will come...
---
test/unit/Makefile.in | 13 +++++++++++--
test/unit/bitset_t.c | 6 +-----
test/unit/config_t.c | 6 +-----
test/unit/dmlist_t.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
test/unit/matcher_t.c | 17 +----------------
test/unit/run.c | 33 ++++++++++++++++++++-------------
test/unit/string_t.c | 7 +------
test/unit/units.h | 32 ++++++++++++++++++++++++++++++++
8 files changed, 116 insertions(+), 47 deletions(-)
diff --git a/test/unit/Makefile.in b/test/unit/Makefile.in
index 62a0077..13d2f3c 100644
--- a/test/unit/Makefile.in
+++ b/test/unit/Makefile.in
@@ -15,7 +15,15 @@ top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
VPATH = $(srcdir)
-UNITS = bitset_t.c matcher_t.c config_t.c string_t.c run.c
+UNITS = \
+ bitset_t.c\
+ config_t.c\
+ dmlist_t.c\
+ matcher_t.c\
+ string_t.c\
+ run.c
+
+include $(top_builddir)/make.tmpl
ifeq ($(MAKECMDGOALS),distclean)
SOURCES = $(UNITS)
@@ -26,13 +34,14 @@ SOURCES = $(UNITS)
TARGETS = run
endif
-include $(top_builddir)/make.tmpl
ifeq ("$(TESTING)", "yes")
LDLIBS += -ldevmapper @CUNIT_LIBS@
CFLAGS += @CUNIT_CFLAGS@
check: unit
+$(TARGETS): $(OBJECTS)
+
unit: $(TARGETS)
@echo Running unit tests
LD_LIBRARY_PATH=$(top_builddir)/libdm ./$(TARGETS)
diff --git a/test/unit/bitset_t.c b/test/unit/bitset_t.c
index 499de32..8ef040d 100644
--- a/test/unit/bitset_t.c
+++ b/test/unit/bitset_t.c
@@ -12,11 +12,7 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "libdevmapper.h"
-#include <CUnit/CUnit.h>
-
-int bitset_init(void);
-int bitset_fini(void);
+#include "units.h"
enum {
NR_BITS = 137
diff --git a/test/unit/config_t.c b/test/unit/config_t.c
index 9a8b693..d2d2926 100644
--- a/test/unit/config_t.c
+++ b/test/unit/config_t.c
@@ -12,11 +12,7 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "libdevmapper.h"
-#include <CUnit/CUnit.h>
-
-int config_init(void);
-int config_fini(void);
+#include "units.h"
static struct dm_pool *mem;
diff --git a/test/unit/dmlist_t.c b/test/unit/dmlist_t.c
new file mode 100644
index 0000000..3930720
--- /dev/null
+++ b/test/unit/dmlist_t.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2015 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * 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
+ */
+
+#include "units.h"
+
+int dmlist_init(void)
+{
+ return 0;
+}
+
+int dmlist_fini(void)
+{
+ return 0;
+}
+
+static void test_dmlist_splice(void)
+{
+ struct dm_list a[10];
+ struct dm_list list1;
+ struct dm_list list2;
+ unsigned i;
+
+ dm_list_init(&list1);
+ dm_list_init(&list2);
+
+ for (i = 0; i < DM_ARRAY_SIZE(a); i++)
+ dm_list_add(&list1, &a[i]);
+
+ dm_list_splice(&list2, &list1);
+ CU_ASSERT_EQUAL(dm_list_size(&list1), 0);
+ CU_ASSERT_EQUAL(dm_list_size(&list2), 10);
+}
+
+CU_TestInfo dmlist_list[] = {
+ { (char*)"dmlist_splice", test_dmlist_splice },
+ //{ (char*)"dmlist", test_strncpy },
+ CU_TEST_INFO_NULL
+};
diff --git a/test/unit/matcher_t.c b/test/unit/matcher_t.c
index 7331a82..7b68554 100644
--- a/test/unit/matcher_t.c
+++ b/test/unit/matcher_t.c
@@ -13,24 +13,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "libdevmapper.h"
-#include "log.h"
+#include "units.h"
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#include <CUnit/CUnit.h>
#include "matcher_data.h"
-int regex_init(void);
-int regex_fini(void);
-
static struct dm_pool *mem = NULL;
int regex_init(void) {
@@ -82,4 +68,3 @@ CU_TestInfo regex_list[] = {
{ (char*)"matching", test_matching },
CU_TEST_INFO_NULL
};
-
diff --git a/test/unit/run.c b/test/unit/run.c
index 482498a..c46266d 100644
--- a/test/unit/run.c
+++ b/test/unit/run.c
@@ -1,29 +1,36 @@
-#include <CUnit/CUnit.h>
+#include "units.h"
#include <CUnit/Basic.h>
-#define DECL(n) \
- extern CU_TestInfo n ## _list[]; \
- int n ## _init(void); \
- int n ## _fini(void);
-#define USE(n) { (char*) #n, n##_init, n##_fini, n##_list }
+#include <stdio.h>
+#include <stdlib.h>
-DECL(bitset);
-DECL(regex);
-DECL(config);
-DECL(string);
+/* Setup SuiteInfo struct in a compatible way across different CUnit versions */
+/* old version of CUnit has used char* for .pName, so using cast here */
+#define USE(n) { \
+ .pName = (char*) #n, \
+ .pInitFunc = n##_init, \
+ .pCleanupFunc = n##_fini, \
+ .pTests = n##_list }
CU_SuiteInfo suites[] = {
USE(bitset),
- USE(regex),
USE(config),
+ USE(dmlist),
+ USE(regex),
USE(string),
CU_SUITE_INFO_NULL
};
int main(int argc, char **argv) {
- CU_initialize_registry();
+ if (CU_initialize_registry() != CUE_SUCCESS) {
+ printf("Initialization of Test Registry failed.\n");
+ return CU_get_error();
+ }
+
CU_register_suites(suites);
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
- return CU_get_number_of_failures() != 0;
+ CU_cleanup_registry();
+
+ return (CU_get_number_of_failures() != 0);
}
diff --git a/test/unit/string_t.c b/test/unit/string_t.c
index df72505..4b1b1bf 100644
--- a/test/unit/string_t.c
+++ b/test/unit/string_t.c
@@ -12,16 +12,11 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "libdevmapper.h"
+#include "units.h"
#include <stdio.h>
#include <string.h>
-#include <CUnit/CUnit.h>
-
-int string_init(void);
-int string_fini(void);
-
static struct dm_pool *mem = NULL;
int string_init(void)
diff --git a/test/unit/units.h b/test/unit/units.h
new file mode 100644
index 0000000..4ae66b9
--- /dev/null
+++ b/test/unit/units.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2015 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * 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
+ */
+
+#ifndef _UNITS_H
+#define _UNITS_H
+
+#include "libdevmapper.h"
+#include <CUnit/CUnit.h>
+
+#define DECL(n) \
+ extern CU_TestInfo n ## _list[];\
+ int n ## _init(void); \
+ int n ## _fini(void);
+
+DECL(bitset);
+DECL(config);
+DECL(dmlist);
+DECL(regex);
+DECL(string);
+
+#endif
7 years, 6 months
master - cleanup: clean gcc shadow declaration of version warning
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ec647f1d431214...
Commit: ec647f1d431214264aaa396b6d0ba8e97738f00b
Parent: 4afe43e1a326d50296b6ad4a7ed836d4b0ae6b26
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 26 21:52:22 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 26 21:52:22 2015 +0100
cleanup: clean gcc shadow declaration of version warning
---
tools/dumpconfig.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c
index 72129c2..85cd619 100644
--- a/tools/dumpconfig.c
+++ b/tools/dumpconfig.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -17,17 +17,17 @@
static int _get_vsn(struct cmd_context *cmd, uint16_t *version_int)
{
- const char *version;
+ const char *vsn;
unsigned int major, minor, patchlevel;
if (arg_count(cmd, atversion_ARG))
- version = arg_str_value(cmd, atversion_ARG, NULL);
+ vsn = arg_str_value(cmd, atversion_ARG, NULL);
else if (arg_count(cmd, sinceversion_ARG))
- version = arg_str_value(cmd, sinceversion_ARG, NULL);
+ vsn = arg_str_value(cmd, sinceversion_ARG, NULL);
else
- version = LVM_VERSION;
+ vsn = LVM_VERSION;
- if (sscanf(version, "%u.%u.%u", &major, &minor, &patchlevel) != 3) {
+ if (sscanf(vsn, "%u.%u.%u", &major, &minor, &patchlevel) != 3) {
log_error("Incorrect version format.");
return 0;
}
7 years, 6 months