master - dev-type: use text format as direct arg for printf
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d079c81ab49648...
Commit: d079c81ab49648fc5506490e34e16244c20fa45f
Parent: 6fa95d17ee85ffd77d4dc90b23cdd024f65c279c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 22 12:57:35 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 22 21:00:54 2013 +0100
dev-type: use text format as direct arg for printf
Put common printf() case into a function and use
the string with text format as direct arg to make
the compile time validation of args easier and
code shorter.
Switch log_error() to log_warn(), since 'return 0'
doesn't cause any failure here.
---
lib/device/dev-type.c | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index a98cf45..f3f29b2 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -445,13 +445,25 @@ out:
#ifdef __linux__
+static int _snprintf_attr(char *buf, size_t buf_size, const char *sysfs_dir,
+ const char *attribute, dev_t dev)
+{
+ if (dm_snprintf(buf, buf_size, "%s/dev/block/%d:%d/%s", sysfs_dir,
+ (int)MAJOR(dev), (int)MINOR(dev),
+ attribute) < 0) {
+ log_warn("dm_snprintf %s failed.", attribute);
+ return 0;
+ }
+
+ return 1;
+}
+
static unsigned long _dev_topology_attribute(struct dev_types *dt,
const char *attribute,
struct device *dev)
{
const char *sysfs_dir = dm_sysfs_dir();
- static const char sysfs_fmt_str[] = "%s/dev/block/%d:%d/%s";
- char path[PATH_MAX+1], buffer[64];
+ char path[PATH_MAX], buffer[64];
FILE *fp;
struct stat info;
dev_t uninitialized_var(primary);
@@ -463,12 +475,8 @@ static unsigned long _dev_topology_attribute(struct dev_types *dt,
if (!sysfs_dir || !*sysfs_dir)
return_0;
- if (dm_snprintf(path, PATH_MAX, sysfs_fmt_str, sysfs_dir,
- (int)MAJOR(dev->dev), (int)MINOR(dev->dev),
- attribute) < 0) {
- log_error("dm_snprintf %s failed", attribute);
- return 0;
- }
+ if (!_snprintf_attr(path, sizeof(path), sysfs_dir, attribute, dev->dev))
+ return_0;
/*
* check if the desired sysfs attribute exists
@@ -484,12 +492,9 @@ static unsigned long _dev_topology_attribute(struct dev_types *dt,
return 0;
/* get attribute from partition's primary device */
- if (dm_snprintf(path, PATH_MAX, sysfs_fmt_str, sysfs_dir,
- (int)MAJOR(primary), (int)MINOR(primary),
- attribute) < 0) {
- log_error("primary dm_snprintf %s failed", attribute);
- return 0;
- }
+ if (!_snprintf_attr(path, sizeof(path), sysfs_dir, attribute, primary))
+ return_0;
+
if (stat(path, &info) == -1) {
if (errno != ENOENT)
log_sys_error("stat", path);
9 years, 4 months
master - dmeventd: move format text to printf
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6fa95d17ee85ff...
Commit: 6fa95d17ee85ffd77d4dc90b23cdd024f65c279c
Parent: 069fa6c49d85f677320ccb1965ef2e59b6829303
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 22 12:54:59 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 22 21:00:51 2013 +0100
dmeventd: move format text to printf
Instead of passing argument with format string to printf(),
put the string as arg directly.
Also move there remains args to make the code shorter.
---
WHATS_NEW_DM | 1 +
daemons/dmeventd/dmeventd.c | 12 +++++-------
daemons/dmeventd/libdevmapper-event.c | 16 ++++++++--------
3 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 24d53af..564419f 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.84 -
====================================
+ Move printf format string directly into dm_asprintf args list.
Catch invalid use of string sort values when reporting numerical fields.
Version 1.02.83 - 13th November 2013
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index bdaf552..e9fc59b 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1110,20 +1110,18 @@ static int _unregister_for_event(struct message_data *message_data)
static int _registered_device(struct message_data *message_data,
struct thread_status *thread)
{
- struct dm_event_daemon_message *msg = message_data->msg;
-
- const char *fmt = "%s %s %s %u";
- const char *id = message_data->id;
- const char *dso = thread->dso_data->dso_name;
- const char *dev = thread->device.uuid;
int r;
+ struct dm_event_daemon_message *msg = message_data->msg;
unsigned events = ((thread->status == DM_THREAD_RUNNING) &&
thread->events) ? thread->events :
thread->events | DM_EVENT_REGISTRATION_PENDING;
dm_free(msg->data);
- if ((r = dm_asprintf(&(msg->data), fmt, id, dso, dev, events)) < 0) {
+ if ((r = dm_asprintf(&(msg->data), "%s %s %s %u",
+ message_data->id,
+ thread->dso_data->dso_name,
+ thread->device.uuid, events)) < 0) {
msg->size = 0;
return -ENOMEM;
}
diff --git a/daemons/dmeventd/libdevmapper-event.c b/daemons/dmeventd/libdevmapper-event.c
index 72f0f92..92e9c1d 100644
--- a/daemons/dmeventd/libdevmapper-event.c
+++ b/daemons/dmeventd/libdevmapper-event.c
@@ -345,9 +345,6 @@ int daemon_talk(struct dm_event_fifos *fifos,
const char *dso_name, const char *dev_name,
enum dm_event_mask evmask, uint32_t timeout)
{
- const char *dso = dso_name ? dso_name : "-";
- const char *dev = dev_name ? dev_name : "-";
- const char *fmt = "%d:%d %s %s %u %" PRIu32;
int msg_size;
memset(msg, 0, sizeof(*msg));
@@ -355,14 +352,17 @@ int daemon_talk(struct dm_event_fifos *fifos,
* Set command and pack the arguments
* into ASCII message string.
*/
- msg->cmd = cmd;
- if (cmd == DM_EVENT_CMD_HELLO)
- fmt = "%d:%d HELLO";
- if ((msg_size = dm_asprintf(&(msg->data), fmt, getpid(), _sequence_nr,
- dso, dev, evmask, timeout)) < 0) {
+ if ((msg_size =
+ ((cmd == DM_EVENT_CMD_HELLO) ?
+ dm_asprintf(&(msg->data), "%d:%d HELLO", getpid(), _sequence_nr) :
+ dm_asprintf(&(msg->data), "%d:%d %s %s %u %" PRIu32,
+ getpid(), _sequence_nr,
+ dso_name ? : "-", dev_name ? : "-", evmask, timeout)))
+ < 0) {
log_error("_daemon_talk: message allocation failed");
return -ENOMEM;
}
+ msg->cmd = cmd;
msg->size = msg_size;
/*
9 years, 4 months
master - activate: modify read_only when dev_manager exists
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=069fa6c49d85f6...
Commit: 069fa6c49d85f677320ccb1965ef2e59b6829303
Parent: 4a061a35c7523d0a1657a52fc179b520d6bcf4d2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 22 10:00:00 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 22 20:58:13 2013 +0100
activate: modify read_only when dev_manager exists
Change opts only when dm has been successfully created.
So on the error path we leave structure unmodified.
---
lib/activate/activate.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 0597409..44dfeb6 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1097,11 +1097,11 @@ static int _lv_preload(struct logical_volume *lv, struct lv_activate_opts *laopt
struct dev_manager *dm;
int old_readonly = laopts->read_only;
- laopts->read_only = _passes_readonly_filter(lv->vg->cmd, lv);
-
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, (lv->status & PVMOVE) ? 0 : 1)))
goto_out;
+ laopts->read_only = _passes_readonly_filter(lv->vg->cmd, lv);
+
if (!(r = dev_manager_preload(dm, lv, laopts, flush_required)))
stack;
9 years, 4 months
master - snapshot: use lv_check_not_in_use
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4a061a35c7523d...
Commit: 4a061a35c7523d0a1657a52fc179b520d6bcf4d2
Parent: 6d196410fc071cfe15638bbde0b3ac8bbbf4be53
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 22 15:27:47 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 22 20:58:11 2013 +0100
snapshot: use lv_check_not_in_use
Instead of plain open_count check, try to use 'smarter'
lv_check_not_in_use() function.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 19 ++++++++-----------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 119463b..9b18ef0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Use lv_check_not_in_use() when testing device in use before merging.
Move test for target present from init_snapshot_merge() to lvconvert.
Check for failure of lvmcache_add_mda() when writing pv.
Check for failure of dev_get_size() when reporting device size.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 6a7281b..a15bd75 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1906,17 +1906,14 @@ static int lvconvert_merge(struct cmd_context *cmd,
* constructor and DM should prevent appropriate devices from
* being open.
*/
- if (lv_info(cmd, origin, 0, &info, 1, 0)) {
- if (info.open_count) {
- log_error("Can't merge over open origin volume");
- merge_on_activate = 1;
- }
- }
- if (lv_info(cmd, lv, 0, &info, 1, 0)) {
- if (info.open_count) {
- log_print_unless_silent("Can't merge when snapshot is open");
- merge_on_activate = 1;
- }
+ if (lv_info(cmd, origin, 0, &info, 1, 0) &&
+ !lv_check_not_in_use(cmd, origin, &info)) {
+ log_print_unless_silent("Can't merge over open origin volume.");
+ merge_on_activate = 1;
+ } else if (lv_info(cmd, lv, 0, &info, 1, 0) &&
+ !lv_check_not_in_use(cmd, lv, &info)) {
+ log_print_unless_silent("Can't merge when snapshot is open.");
+ merge_on_activate = 1;
}
init_snapshot_merge(snap_seg, origin);
9 years, 4 months
master - snapshot: revert and move check to lvconvert
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6d196410fc071c...
Commit: 6d196410fc071cfe15638bbde0b3ac8bbbf4be53
Parent: 3d3b8bfd1c7cc22383580b2723415ddcf9fbe7d7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 22 14:52:35 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 22 20:57:30 2013 +0100
snapshot: revert and move check to lvconvert
Revert 4777eb68728859a0b3651e29c628111ed7c99103 which put
target_present check into init_snapshot_merge(). However
this function is also used when parsing metadata. So we would
get this present test performed even when target is not really
needed. So move this target_present test directly into lvconvert.
---
WHATS_NEW | 1 +
lib/metadata/metadata-exported.h | 2 +-
lib/metadata/snapshot_manip.c | 12 ++----------
tools/lvconvert.c | 8 ++++++--
4 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 41251b8..119463b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Move test for target present from init_snapshot_merge() to lvconvert.
Check for failure of lvmcache_add_mda() when writing pv.
Check for failure of dev_get_size() when reporting device size.
Drop extra unneeded '/' when scanning sysfs directory.
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index ed1ec8d..33c534f 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -880,7 +880,7 @@ struct logical_volume *origin_from_cow(const struct logical_volume *lv);
void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin,
struct logical_volume *cow, uint32_t chunk_size, int merge);
-int init_snapshot_merge(struct lv_segment *snap_seg, struct logical_volume *origin);
+void init_snapshot_merge(struct lv_segment *snap_seg, struct logical_volume *origin);
void clear_snapshot_merge(struct logical_volume *origin);
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index fc1273e..c491918 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -19,7 +19,6 @@
#include "toolcontext.h"
#include "lv_alloc.h"
#include "activate.h"
-#include "segtype.h"
int lv_is_origin(const struct logical_volume *lv)
{
@@ -152,8 +151,8 @@ void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin,
dm_list_add(&origin->snapshot_segs, &seg->origin_list);
}
-int init_snapshot_merge(struct lv_segment *snap_seg,
- struct logical_volume *origin)
+void init_snapshot_merge(struct lv_segment *snap_seg,
+ struct logical_volume *origin)
{
/*
* Even though lv_is_visible(snap_seg->lv) returns 0,
@@ -169,13 +168,6 @@ int init_snapshot_merge(struct lv_segment *snap_seg,
snap_seg->status |= MERGING;
origin->snapshot = snap_seg;
origin->status |= MERGING;
-
- if (snap_seg->segtype->ops->target_present &&
- !snap_seg->segtype->ops->target_present(snap_seg->lv->vg->cmd,
- snap_seg, NULL))
- return 0;
-
- return 1;
}
void clear_snapshot_merge(struct logical_volume *origin)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 92a2022..6a7281b 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1919,10 +1919,14 @@ static int lvconvert_merge(struct cmd_context *cmd,
}
}
- if (!init_snapshot_merge(snap_seg, origin)) {
+ init_snapshot_merge(snap_seg, origin);
+
+ if (snap_seg->segtype->ops->target_present &&
+ !snap_seg->segtype->ops->target_present(snap_seg->lv->vg->cmd,
+ snap_seg, NULL)) {
log_error("Can't initialize snapshot merge. "
"Missing support in kernel?");
- return_0;
+ return 0;
}
/* store vg on disk(s) */
9 years, 4 months
master - pv_write: check for lvmcache_add_mda failure
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3d3b8bfd1c7cc2...
Commit: 3d3b8bfd1c7cc22383580b2723415ddcf9fbe7d7
Parent: a50a297f6e75d650abe9fe084b499a7968cc59ee
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 22 13:25:27 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 22 20:55:09 2013 +0100
pv_write: check for lvmcache_add_mda failure
Add missing test of failing lvmcache_add_mda() call.
---
WHATS_NEW | 1 +
lib/format_text/format-text.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 99f9067..41251b8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Check for failure of lvmcache_add_mda() when writing pv.
Check for failure of dev_get_size() when reporting device size.
Drop extra unneeded '/' when scanning sysfs directory.
Fix undef value if skipped clustered VG ignored for toollib PV seg. (2.02.103)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index e67d24d..275d16f 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -1328,8 +1328,10 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume
mdac->area.size >> SECTOR_SHIFT);
// if fmt is not the same as info->fmt we are in trouble
- lvmcache_add_mda(info, mdac->area.dev,
- mdac->area.start, mdac->area.size, mda_is_ignored(mda));
+ if (!lvmcache_add_mda(info, mdac->area.dev,
+ mdac->area.start, mdac->area.size,
+ mda_is_ignored(mda)))
+ return_0;
}
if (!lvmcache_update_bas(info, pv))
9 years, 4 months
master - report: detect dev_get_size failure
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a50a297f6e75d6...
Commit: a50a297f6e75d650abe9fe084b499a7968cc59ee
Parent: 08d6d81cc24a3c3b780fe25ed49aefc9a9b61586
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 22 13:21:52 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 22 20:54:16 2013 +0100
report: detect dev_get_size failure
Since dev_get_size() may fail, detect this failure.
---
WHATS_NEW | 1 +
lib/report/report.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b7a1e84..99f9067 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Check for failure of dev_get_size() when reporting device size.
Drop extra unneeded '/' when scanning sysfs directory.
Fix undef value if skipped clustered VG ignored for toollib PV seg. (2.02.103)
liblvm/python API Add ability to validate VG/LV names.
diff --git a/lib/report/report.c b/lib/report/report.c
index 9cb2298..20eab4f 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -693,8 +693,11 @@ static int _devsize_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- uint64_t size = 0;
- dev_get_size(*(const struct device **) data, &size);
+ uint64_t size;
+
+ if (!dev_get_size(*(const struct device **) data, &size))
+ return_0;
+
return _size64_disp(rh, mem, field, &size, private);
}
9 years, 4 months
master - filters: drop extra slash from sysfs path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=08d6d81cc24a3c...
Commit: 08d6d81cc24a3c3b780fe25ed49aefc9a9b61586
Parent: 4c1f281b43175e69a73fcc59a9142fd374e8b70c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 21 17:50:12 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 22 20:53:31 2013 +0100
filters: drop extra slash from sysfs path
Sysfs filter was using '/sys//class/block' with double '//' inside.
Remove this extra '/'.
Also simplify code around and use loop to try those paths.
---
WHATS_NEW | 1 +
lib/filters/filter-sysfs.c | 109 +++++++++++++++++++++----------------------
2 files changed, 54 insertions(+), 56 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 647c810..b7a1e84 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Drop extra unneeded '/' when scanning sysfs directory.
Fix undef value if skipped clustered VG ignored for toollib PV seg. (2.02.103)
liblvm/python API Add ability to validate VG/LV names.
liblvm/python API Add ability to create PV with arguments.
diff --git a/lib/filters/filter-sysfs.c b/lib/filters/filter-sysfs.c
index af3ed07..ff94810 100644
--- a/lib/filters/filter-sysfs.c
+++ b/lib/filters/filter-sysfs.c
@@ -23,64 +23,61 @@ static int _locate_sysfs_blocks(const char *sysfs_dir, char *path, size_t len,
unsigned *sysfs_depth)
{
struct stat info;
-
- /*
- * unified classification directory for all kernel subsystems
- *
- * /sys/subsystem/block/devices
- * |-- sda -> ../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
- * |-- sda1 -> ../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1
- * `-- sr0 -> ../../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
- *
- */
- if (dm_snprintf(path, len, "%s/%s", sysfs_dir,
- "subsystem/block/devices") >= 0) {
- if (!stat(path, &info)) {
- *sysfs_depth = 0;
- return 1;
- }
- }
-
- /*
- * block subsystem as a class
- *
- * /sys/class/block
- * |-- sda -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
- * |-- sda1 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1
- * `-- sr0 -> ../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
- *
- */
- if (dm_snprintf(path, len, "%s/%s", sysfs_dir, "class/block") >= 0) {
- if (!stat(path, &info)) {
- *sysfs_depth = 0;
+ unsigned i;
+ static const struct dir_class {
+ const char path[32];
+ int depth;
+ } classes[] = {
+ /*
+ * unified classification directory for all kernel subsystems
+ *
+ * /sys/subsystem/block/devices
+ * |-- sda -> ../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
+ * |-- sda1 -> ../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1
+ * `-- sr0 -> ../../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
+ *
+ */
+ { "subsystem/block/devices", 0 },
+
+ /*
+ * block subsystem as a class
+ *
+ * /sys/class/block
+ * |-- sda -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
+ * |-- sda1 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1
+ * `-- sr0 -> ../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
+ *
+ */
+ { "class/block", 0 },
+
+ /*
+ * old block subsystem layout with nested directories
+ *
+ * /sys/block/
+ * |-- sda
+ * | |-- capability
+ * | |-- dev
+ * ...
+ * | |-- sda1
+ * | | |-- dev
+ * ...
+ * |
+ * `-- sr0
+ * |-- capability
+ * |-- dev
+ * ...
+ *
+ */
+
+ { "block", 1 }
+ };
+
+ for (i = 0; i < DM_ARRAY_SIZE(classes); ++i)
+ if ((dm_snprintf(path, len, "%s%s", sysfs_dir, classes[i].path) >= 0) &&
+ (stat(path, &info) == 0)) {
+ *sysfs_depth = classes[i].depth;
return 1;
}
- }
-
- /*
- * old block subsystem layout with nested directories
- *
- * /sys/block/
- * |-- sda
- * | |-- capability
- * | |-- dev
- * ...
- * | |-- sda1
- * | | |-- dev
- * ...
- * |
- * `-- sr0
- * |-- capability
- * |-- dev
- * ...
- *
- */
- if (dm_snprintf(path, len, "%s/%s", sysfs_dir, "block") >= 0) {
- if (!stat(path, &info)) {
- *sysfs_depth = 1;
- return 1;
- }
- }
return 0;
}
9 years, 4 months
master - toollib: Avoid undefined ignore_vg parameter.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4c1f281b43175e...
Commit: 4c1f281b43175e69a73fcc59a9142fd374e8b70c
Parent: 7c8abb29df2e8cc22c43f67117486e4e717110dd
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Nov 22 18:11:04 2013 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Nov 22 18:11:04 2013 +0000
toollib: Avoid undefined ignore_vg parameter.
Fix process_each_segment_in_pv to always set ret before calling ignore_vg().
---
WHATS_NEW | 1 +
tools/toollib.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e47f0e5..647c810 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Fix undef value if skipped clustered VG ignored for toollib PV seg. (2.02.103)
liblvm/python API Add ability to validate VG/LV names.
liblvm/python API Add ability to create PV with arguments.
liblvm/python API Fail VG reduce when insufficient metadata copies
diff --git a/tools/toollib.c b/tools/toollib.c
index b3bfd1d..90a7cb8 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -510,10 +510,10 @@ int process_each_segment_in_pv(struct cmd_context *cmd,
vg_name = pv_vg_name(pv);
vg = vg_read(cmd, vg_name, NULL, 0);
- if (ignore_vg(vg, vg_name, 0, &ret)) {
+ if (ignore_vg(vg, vg_name, 0, &ret_max)) {
release_vg(vg);
stack;
- return ret;
+ return ret_max;
}
/*
9 years, 4 months
master - liblvm/python API: Additions & fixes
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7c8abb29df2e8c...
Commit: 7c8abb29df2e8cc22c43f67117486e4e717110dd
Parent: 5588a56391dd3ef61d284ea64bcb6da591a3136c
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Nov 19 14:54:18 2013 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Tue Nov 19 14:54:18 2013 -0600
liblvm/python API: Additions & fixes
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
WHATS_NEW | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index bd18c6f..e47f0e5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,8 @@
Version 2.02.105 -
=====================================
+ liblvm/python API Add ability to validate VG/LV names.
+ liblvm/python API Add ability to create PV with arguments.
+ liblvm/python API Fail VG reduce when insufficient metadata copies
Fix install of conf subdir when not building in srcdir.
Add reporting of thin_id device id for thin volumes.
Fix reporting of empty numerical values.
9 years, 4 months