stable-2.02 - raid: drop internal error
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=719ab4da054b17df767...
Commit: 719ab4da054b17df767a17dddd87d2cc62ec084b
Parent: 2c46c60155a1a22626875b1023ce964216f23f95
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 31 11:47:39 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 31 13:00:01 2019 +0100
raid: drop internal error
Fix some internal error reports and debug trace returns
---
lib/metadata/raid_manip.c | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index bffae60..9030261 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -213,7 +213,7 @@ static int _get_available_removed_sublvs(const struct logical_volume *lv, uint32
if (seg_type(seg, s) != AREA_LV || !(slv = seg_lv(seg, s))) {
log_error(INTERNAL_ERROR "Missing image sub lv in area %" PRIu32 " of LV %s.",
s, display_lvname(lv));
- return_0;
+ return 0;
}
(slv->status & LV_REMOVE_AFTER_RESHAPE) ? (*removed_slvs)++ : (*available_slvs)++;
@@ -619,10 +619,9 @@ static int _lv_update_reload_fns_reset_eliminate_lvs(struct logical_volume *lv,
/* Update and reload to clear out reset flags in the metadata and in the kernel */
log_debug_metadata("Updating metadata mappings for %s.", display_lvname(lv));
- if ((r != 2 || flags_reset) && !(r = (origin_only ? lv_update_and_reload_origin(lv) : lv_update_and_reload(lv)))) {
- log_error(INTERNAL_ERROR "Update of LV %s failed.", display_lvname(lv));
- return 0;
- }
+ if ((r != 2 || flags_reset) &&
+ !(r = (origin_only ? lv_update_and_reload_origin(lv) : lv_update_and_reload(lv))))
+ return_0;
return 1;
}
@@ -1829,7 +1828,7 @@ static int _raid_reshape_add_images(struct logical_volume *lv,
if (new_image_count == old_image_count) {
log_error(INTERNAL_ERROR "No change of image count on LV %s.", display_lvname(lv));
- return_0;
+ return 0;
}
vg = lv->vg;
@@ -1955,7 +1954,7 @@ static int _raid_reshape_remove_images(struct logical_volume *lv,
if (new_image_count == old_image_count) {
log_error(INTERNAL_ERROR "No change of image count on LV %s.", display_lvname(lv));
- return_0;
+ return 0;
}
switch (_reshaped_state(lv, new_image_count, &devs_health, &devs_in_sync)) {
@@ -6380,8 +6379,8 @@ static int _conversion_options_allowed(const struct lv_segment *seg_from,
return_0;
if (dm_snprintf(fmt, sz, "%s%s%s", basic_fmt, (seg_from->segtype == *segtype_to) ? "" : type_fmt, question_fmt) < 0) {
- log_error(INTERNAL_ERROR "dm_snprintf failed.");
- return_0;
+ log_error("dm_snprintf failed.");
+ return 0;
}
if (yes_no_prompt(fmt, lvseg_name(seg_from), display_lvname(seg_from->lv),
@@ -7200,10 +7199,8 @@ int partial_raid_lv_supports_degraded_activation(const struct logical_volume *cl
if (!_lv_may_be_activated_in_degraded_mode(lv, ¬_capable) || not_capable)
return_0;
- if (!for_each_sub_lv(lv, _lv_may_be_activated_in_degraded_mode, ¬_capable)) {
- log_error(INTERNAL_ERROR "for_each_sub_lv failure.");
- return 0;
- }
+ if (!for_each_sub_lv(lv, _lv_may_be_activated_in_degraded_mode, ¬_capable))
+ return_0;
return !not_capable;
}
4 years, 5 months
stable-2.02 - manip: optimize lvs_using_lv
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2c46c60155a1a226268...
Commit: 2c46c60155a1a22626875b1023ce964216f23f95
Parent: 4b7bcf3ed4b5e427984bd7883238e681405edf5f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 31 12:38:56 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 31 13:00:01 2019 +0100
manip: optimize lvs_using_lv
Instead of checking all LVs in a VG - do just a direct copy of LVs
from the existing list ->segs_using_thin_lv.
TODO: maybe it could be better to expose seg_list to /tools...
---
lib/metadata/mirror.c | 33 ++++++++-------------------------
1 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 411079a..4e88f25 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1374,10 +1374,8 @@ struct dm_list *lvs_using_lv(struct cmd_context *cmd, struct volume_group *vg,
struct logical_volume *lv)
{
struct dm_list *lvs;
- struct logical_volume *lv1;
- struct lv_list *lvl, *lvl1;
- struct lv_segment *seg;
- uint32_t s;
+ struct lv_list *lvl;
+ struct seg_list *sl;
if (!(lvs = dm_pool_alloc(cmd->mem, sizeof(*lvs)))) {
log_error("lvs list alloc failed.");
@@ -1386,29 +1384,14 @@ struct dm_list *lvs_using_lv(struct cmd_context *cmd, struct volume_group *vg,
dm_list_init(lvs);
- /* Loop through all LVs except the one supplied */
- dm_list_iterate_items(lvl1, &vg->lvs) {
- lv1 = lvl1->lv;
- if (lv1 == lv)
- continue;
-
+ dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
/* Find whether any segment points at the supplied LV */
- dm_list_iterate_items(seg, &lv1->segments) {
- for (s = 0; s < seg->area_count; s++) {
- if (seg_type(seg, s) != AREA_LV ||
- seg_lv(seg, s) != lv)
- continue;
- if (!(lvl = dm_pool_alloc(cmd->mem, sizeof(*lvl)))) {
- log_error("lv_list alloc failed.");
- return NULL;
- }
- lvl->lv = lv1;
- dm_list_add(lvs, &lvl->list);
- goto next_lv;
- }
+ if (!(lvl = dm_pool_alloc(cmd->mem, sizeof(*lvl)))) {
+ log_error("lv_list alloc failed.");
+ return NULL;
}
- next_lv:
- ;
+ lvl->lv = sl->seg->lv;
+ dm_list_add(lvs, &lvl->list);
}
return lvs;
4 years, 5 months
stable-2.02 - mirror: remove unused code
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4b7bcf3ed4b5e427984...
Commit: 4b7bcf3ed4b5e427984bd7883238e681405edf5f
Parent: cf426744aef84d993b95926b23489f55f9a25838
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 31 12:10:00 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 31 13:00:01 2019 +0100
mirror: remove unused code
---
lib/metadata/mirror.c | 157 -------------------------------------------------
1 files changed, 0 insertions(+), 157 deletions(-)
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 6cd88cb..411079a 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1176,163 +1176,6 @@ int collapse_mirrored_lv(struct logical_volume *lv)
return 1;
}
-#if 0
-/* FIXME: reconfigure_mirror_images: remove this code? */
-static int _get_mirror_fault_policy(struct cmd_context *cmd __attribute__((unused)),
- int log_policy)
-{
- const char *policy = NULL;
-/*
- if (log_policy)
- policy = find_config_tree_str(cmd, activation_mirror_log_fault_policy_CFG);
- else {
- policy = find_config_tree_str(cmd, activation_mirror_image_fault_policy_CFG);
- if (!policy)
- policy = find_config_tree_str(cmd, activation_mirror_device_fault_policy_CFG);
- }
-*/
- if (!strcmp(policy, "remove"))
- return MIRROR_REMOVE;
- else if (!strcmp(policy, "allocate"))
- return MIRROR_ALLOCATE;
- else if (!strcmp(policy, "allocate_anywhere"))
- return MIRROR_ALLOCATE_ANYWHERE;
-
- if (log_policy)
- log_error("Bad activation/mirror_log_fault_policy");
- else
- log_error("Bad activation/mirror_device_fault_policy");
-
- return MIRROR_REMOVE;
-}
-
-static int _get_mirror_log_fault_policy(struct cmd_context *cmd)
-{
- return _get_mirror_fault_policy(cmd, 1);
-}
-
-static int _get_mirror_device_fault_policy(struct cmd_context *cmd)
-{
- return _get_mirror_fault_policy(cmd, 0);
-}
-
-/*
- * replace_mirror_images
- * @mirrored_seg: segment (which may be linear now) to restore
- * @num_mirrors: number of copies we should end up with
- * @replace_log: replace log if not present
- * @in_sync: was the original mirror in-sync?
- *
- * in_sync will be set to 0 if new mirror devices are being added
- * In other words, it is only useful if the log (and only the log)
- * is being restored.
- *
- * Returns: 0 on failure, 1 on reconfig, -1 if no reconfig done
- */
-static int _replace_mirror_images(struct lv_segment *mirrored_seg,
- uint32_t num_mirrors,
- int log_policy, int in_sync)
-{
- int r = -1;
- struct logical_volume *lv = mirrored_seg->lv;
-
- /* FIXME: Use lvconvert rather than duplicating its code */
-
- if (mirrored_seg->area_count < num_mirrors) {
- log_warn("WARNING: Failed to replace mirror device in %s.",
- display_lvname(mirrored_seg->lv);
-
- if ((mirrored_seg->area_count > 1) && !mirrored_seg->log_lv)
- log_warn("WARNING: Use 'lvconvert -m %d %s --corelog' to replace failed devices.",
- num_mirrors - 1, display_lvname(lv));
- else
- log_warn("WARNING: Use 'lvconvert -m %d %s' to replace failed devices.",
- num_mirrors - 1, display_lvname(lv));
- r = 0;
-
- /* REMEMBER/FIXME: set in_sync to 0 if a new mirror device was added */
- in_sync = 0;
- }
-
- /*
- * FIXME: right now, we ignore the allocation policy specified to
- * allocate the new log.
- */
- if ((mirrored_seg->area_count > 1) && !mirrored_seg->log_lv &&
- (log_policy != MIRROR_REMOVE)) {
- log_warn("WARNING: Failed to replace mirror log device in %s.",
- display_lvname(lv));
-
- log_warn("WARNING: Use 'lvconvert -m %d %s' to replace failed devices.",
- mirrored_seg->area_count - 1 , display_lvname(lv));
- r = 0;
- }
-
- return r;
-}
-
-int reconfigure_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors,
- struct dm_list *removable_pvs, unsigned remove_log)
-{
- int r;
- int in_sync;
- int log_policy, dev_policy;
- uint32_t old_num_mirrors = mirrored_seg->area_count;
- int had_log = (mirrored_seg->log_lv) ? 1 : 0;
-
- /* was the mirror in-sync before problems? */
- in_sync = _mirrored_lv_in_sync(mirrored_seg->lv);
-
- /*
- * While we are only removing devices, we can have sync set.
- * Setting this is only useful if we are moving to core log
- * otherwise the disk log will contain the sync information
- */
- init_mirror_in_sync(in_sync);
-
- r = _remove_mirror_images(mirrored_seg->lv, old_num_mirrors - num_mirrors,
- is_mirror_image_removable, removable_pvs,
- remove_log, 0, NULL, 0);
- if (!r)
- /* Unable to remove bad devices */
- return 0;
-
- log_warn("WARNING: Bad device removed from mirror volume %s.",
- display_lvname(mirrored_seg->lv));
-
- log_policy = _get_mirror_log_fault_policy(mirrored_seg->lv->vg->cmd);
- dev_policy = _get_mirror_device_fault_policy(mirrored_seg->lv->vg->cmd);
-
- r = _replace_mirror_images(mirrored_seg,
- (dev_policy != MIRROR_REMOVE) ?
- old_num_mirrors : num_mirrors,
- log_policy, in_sync);
-
- if (!r)
- /* Failed to replace device(s) */
- log_warn("WARNING: Unable to find substitute device for mirror volume %s.",
- display_lvname(mirrored_seg->lv));
- else if (r > 0)
- /* Success in replacing device(s) */
- log_warn("WARNING: Mirror volume %s restored - substitute for failed device found.",
- display_lvname(mirrored_seg->lv));
- else
- /* Bad device removed, but not replaced because of policy */
- if (mirrored_seg->area_count == 1) {
- log_warn("WARNING: Mirror volume %s converted to linear due to device failure.",
- display_lvname(mirrored_seg->lv);
- } else if (had_log && !mirrored_seg->log_lv) {
- log_warn("WARNING: Mirror volume %s disk log removed due to device failure.",
- display_lvname(mirrored_seg->lv));
- }
- /*
- * If we made it here, we at least removed the bad device.
- * Consider this success.
- */
- return 1;
-}
-#endif
-
static int _create_mimage_lvs(struct alloc_handle *ah,
uint32_t num_mirrors,
uint32_t stripes,
4 years, 5 months
stable-2.02 - mirror: directly activate updated mirror
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cf426744aef84d993b9...
Commit: cf426744aef84d993b95926b23489f55f9a25838
Parent: f1be01c7ef21e80d3543b7c54a15ec2b49776c4c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 31 10:05:40 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 31 13:00:01 2019 +0100
mirror: directly activate updated mirror
---
lib/metadata/mirror.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index cd8ce1e..6cd88cb 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -790,7 +790,7 @@ static int _split_mirror_images(struct logical_volume *lv,
act = lv_is_active(lv_lock_holder(lv));
- if (act && (!deactivate_lv(cmd, new_lv) || !_activate_lv_like_model(lv, new_lv))) {
+ if (act && !_activate_lv_like_model(lv, new_lv)) {
log_error("Failed to rename newly split LV in the kernel");
return 0;
}
4 years, 5 months
stable-2.02 - mirror: fix leg splitting
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f1be01c7ef21e80d354...
Commit: f1be01c7ef21e80d3543b7c54a15ec2b49776c4c
Parent: 8b741b3bbac6121f05caa455b31fed0983a30b64
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 31 11:45:28 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 31 12:56:24 2019 +0100
mirror: fix leg splitting
Enhance lv_info with lv_info_with_name_check.
This 'variant' not only check existance if UUID in DM table
but also compares its DM name whether it's matching expected LV name.
Otherwise activation may 'skip' activation with rename in case the
DM UUID already exists, just device is different name.
This change make fairly easier manipulation with i.e. detached mirror
leg which ATM is using same UUID - just the LV name have been changed.
Used code was not able to run 'activation' (and do a rename) and just
skipped the call. So the code used to do a workaround and 'tried'
to deactivate such LV firts - this however work only in non-clvmd case,
as cluster was not having the lock for deactivated LV.
With this extended lv_info code will run 'activation' and will
synchronize the name to match expected LV name.
Patch extends _lv_info() with new paramter 'with_name_check',
which is later translated into 'name_check' argument for
_info_run() which in case of name mismatch evaluates the
check as if device does not exists.
Such call is only used in one place _lv_activate() which then
let activation run. All other invocation of _info() calls
are left intact.
TODO: fix mirror table manipulation (and raid)....
---
lib/activate/activate.c | 40 +++++++++++++++++++++++++---------------
lib/activate/activate.h | 2 ++
lib/activate/dev_manager.c | 28 +++++++++++++++++++---------
lib/activate/dev_manager.h | 2 +-
4 files changed, 47 insertions(+), 25 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index f17be61..fb6f545 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -658,7 +658,7 @@ static int _lv_info(struct cmd_context *cmd, const struct logical_volume *lv,
int use_layer, struct lvinfo *info,
const struct lv_segment *seg,
struct lv_seg_status *seg_status,
- int with_open_count, int with_read_ahead)
+ int with_open_count, int with_read_ahead, int with_name_check)
{
struct dm_info dminfo;
@@ -678,7 +678,7 @@ static int _lv_info(struct cmd_context *cmd, const struct logical_volume *lv,
/* New thin-pool has no layer, but -tpool suffix needs to be queried */
if (!use_layer && lv_is_new_thin_pool(lv)) {
/* Check if there isn't existing old thin pool mapping in the table */
- if (!dev_manager_info(cmd, lv, NULL, 0, 0, &dminfo, NULL, NULL))
+ if (!dev_manager_info(cmd, lv, NULL, 0, 0, 0, &dminfo, NULL, NULL))
return_0;
if (!dminfo.exists)
use_layer = 1;
@@ -691,8 +691,9 @@ static int _lv_info(struct cmd_context *cmd, const struct logical_volume *lv,
if (!dev_manager_info(cmd, lv,
(use_layer) ? lv_layer(lv) : NULL,
- with_open_count, with_read_ahead,
- &dminfo, (info) ? &info->read_ahead : NULL,
+ with_open_count, with_read_ahead, with_name_check,
+ &dminfo,
+ (info) ? &info->read_ahead : NULL,
seg_status))
return_0;
@@ -721,7 +722,7 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la
if (!activation())
return 0;
- return _lv_info(cmd, lv, use_layer, info, NULL, NULL, with_open_count, with_read_ahead);
+ return _lv_info(cmd, lv, use_layer, info, NULL, NULL, with_open_count, with_read_ahead, 0);
}
int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer,
@@ -739,6 +740,15 @@ int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer,
return r;
}
+int lv_info_with_name_check(struct cmd_context *cmd, const struct logical_volume *lv,
+ int use_layer, struct lvinfo *info)
+{
+ if (!activation())
+ return 0;
+
+ return _lv_info(cmd, lv, use_layer, info, NULL, NULL, 0, 0, 1);
+}
+
/*
* Returns 1 if lv_with_info_and_seg_status info structure populated,
* else 0 on failure or if device not active locally.
@@ -766,16 +776,16 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
* STATUS is collected from cache LV */
if (!(lv_seg = get_only_segment_using_this_lv(lv)))
return_0;
- (void) _lv_info(cmd, lv_seg->lv, 1, NULL, lv_seg, &status->seg_status, 0, 0);
+ (void) _lv_info(cmd, lv_seg->lv, 1, NULL, lv_seg, &status->seg_status, 0, 0, 0);
return 1;
}
if (lv_is_thin_pool(lv)) {
/* Always collect status for '-tpool' */
- if (_lv_info(cmd, lv, 1, &status->info, lv_seg, &status->seg_status, 0, 0) &&
+ if (_lv_info(cmd, lv, 1, &status->info, lv_seg, &status->seg_status, 0, 0, 0) &&
(status->seg_status.type == SEG_STATUS_THIN_POOL)) {
/* There is -tpool device, but query 'active' state of 'fake' thin-pool */
- if (!_lv_info(cmd, lv, 0, NULL, NULL, NULL, 0, 0) &&
+ if (!_lv_info(cmd, lv, 0, NULL, NULL, NULL, 0, 0, 0) &&
!status->seg_status.thin_pool->needs_check)
status->info.exists = 0; /* So pool LV is not active */
}
@@ -784,10 +794,10 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
if (lv_is_external_origin(lv)) {
if (!_lv_info(cmd, lv, 0, &status->info, NULL, NULL,
- with_open_count, with_read_ahead))
+ with_open_count, with_read_ahead, 0))
return_0;
- (void) _lv_info(cmd, lv, 1, NULL, lv_seg, &status->seg_status, 0, 0);
+ (void) _lv_info(cmd, lv, 1, NULL, lv_seg, &status->seg_status, 0, 0, 0);
return 1;
}
@@ -800,13 +810,13 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
/* Show INFO for actual origin and grab status for merging origin */
if (!_lv_info(cmd, lv, 0, &status->info, lv_seg,
lv_is_merging_origin(lv) ? &status->seg_status : NULL,
- with_open_count, with_read_ahead))
+ with_open_count, with_read_ahead, 0))
return_0;
if (status->info.exists &&
(status->seg_status.type != SEG_STATUS_SNAPSHOT)) /* Not merging */
/* Grab STATUS from layered -real */
- (void) _lv_info(cmd, lv, 1, NULL, lv_seg, &status->seg_status, 0, 0);
+ (void) _lv_info(cmd, lv, 1, NULL, lv_seg, &status->seg_status, 0, 0, 0);
return 1;
}
@@ -815,7 +825,7 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
olv = origin_from_cow(lv);
if (!_lv_info(cmd, olv, 0, &status->info, first_seg(olv), &status->seg_status,
- with_open_count, with_read_ahead))
+ with_open_count, with_read_ahead, 0))
return_0;
if (status->seg_status.type == SEG_STATUS_SNAPSHOT ||
@@ -836,7 +846,7 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
}
return _lv_info(cmd, lv, 0, &status->info, lv_seg, &status->seg_status,
- with_open_count, with_read_ahead);
+ with_open_count, with_read_ahead, 0);
}
#define OPEN_COUNT_CHECK_RETRIES 25
@@ -2821,7 +2831,7 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
laopts->noscan ? " noscan" : "",
laopts->temporary ? " temporary" : "");
- if (!lv_info(cmd, lv, 0, &info, 0, 0))
+ if (!lv_info_with_name_check(cmd, lv, 0, &info))
goto_out;
/*
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index 524d2bf..7139276 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -134,6 +134,8 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la
struct lvinfo *info, int with_open_count, int with_read_ahead);
int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer,
struct lvinfo *info, int with_open_count, int with_read_ahead);
+int lv_info_with_name_check(struct cmd_context *cmd, const struct logical_volume *lv,
+ int use_layer, struct lvinfo *info);
/*
* Returns 1 if lv_info_and_seg_status structure has been populated,
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index becbf6d..317a2a7 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -240,6 +240,7 @@ static uint32_t _seg_len(const struct lv_segment *seg)
static int _info_run(const char *dlid, struct dm_info *dminfo,
uint32_t *read_ahead,
struct lv_seg_status *seg_status,
+ const char *name_check,
int with_open_count, int with_read_ahead,
uint32_t major, uint32_t minor)
{
@@ -250,6 +251,7 @@ static int _info_run(const char *dlid, struct dm_info *dminfo,
void *target = NULL;
uint64_t target_start, target_length, start, length;
char *target_name, *target_params;
+ const char *dev_name;
if (seg_status) {
dmtask = DM_DEVICE_STATUS;
@@ -263,6 +265,11 @@ static int _info_run(const char *dlid, struct dm_info *dminfo,
with_open_count, with_flush, 0)))
return_0;
+ if (name_check && dminfo->exists &&
+ (dev_name = dm_task_get_name(dmt)) &&
+ (strcmp(name_check, dev_name) != 0))
+ dminfo->exists = 0; /* mismatching name -> device does not exist */
+
if (with_read_ahead && dminfo->exists) {
if (!dm_task_get_read_ahead(dmt, read_ahead))
goto_out;
@@ -779,18 +786,19 @@ static int _original_uuid_format_check_required(struct cmd_context *cmd)
static int _info(struct cmd_context *cmd,
const char *name, const char *dlid,
- int with_open_count, int with_read_ahead,
+ int with_open_count, int with_read_ahead, int with_name_check,
struct dm_info *dminfo, uint32_t *read_ahead,
struct lv_seg_status *seg_status)
{
char old_style_dlid[sizeof(UUID_PREFIX) + 2 * ID_LEN];
const char *suffix, *suffix_position;
+ const char *name_check = (with_name_check) ? name : NULL;
unsigned i = 0;
log_debug_activation("Getting device info for %s [%s].", name, dlid);
/* Check for dlid */
- if (!_info_run(dlid, dminfo, read_ahead, seg_status,
+ if (!_info_run(dlid, dminfo, read_ahead, seg_status, name_check,
with_open_count, with_read_ahead, 0, 0))
return_0;
@@ -806,7 +814,8 @@ static int _info(struct cmd_context *cmd,
(void) strncpy(old_style_dlid, dlid, sizeof(old_style_dlid));
old_style_dlid[sizeof(old_style_dlid) - 1] = '\0';
if (!_info_run(old_style_dlid, dminfo, read_ahead, seg_status,
- with_open_count, with_read_ahead, 0, 0))
+ name_check, with_open_count, with_read_ahead,
+ 0, 0))
return_0;
if (dminfo->exists)
return 1;
@@ -819,7 +828,7 @@ static int _info(struct cmd_context *cmd,
/* Check for dlid before UUID_PREFIX was added */
if (!_info_run(dlid + sizeof(UUID_PREFIX) - 1, dminfo, read_ahead, seg_status,
- with_open_count, with_read_ahead, 0, 0))
+ name_check, with_open_count, with_read_ahead, 0, 0))
return_0;
return 1;
@@ -827,12 +836,12 @@ static int _info(struct cmd_context *cmd,
static int _info_by_dev(uint32_t major, uint32_t minor, struct dm_info *info)
{
- return _info_run(NULL, info, NULL, 0, 0, 0, major, minor);
+ return _info_run(NULL, info, NULL, NULL, NULL, 0, 0, major, minor);
}
int dev_manager_info(struct cmd_context *cmd,
const struct logical_volume *lv, const char *layer,
- int with_open_count, int with_read_ahead,
+ int with_open_count, int with_read_ahead, int with_name_check,
struct dm_info *dminfo, uint32_t *read_ahead,
struct lv_seg_status *seg_status)
{
@@ -845,7 +854,8 @@ int dev_manager_info(struct cmd_context *cmd,
if (!(dlid = build_dm_uuid(cmd->mem, lv, layer)))
goto_out;
- if (!(r = _info(cmd, name, dlid, with_open_count, with_read_ahead,
+ if (!(r = _info(cmd, name, dlid,
+ with_open_count, with_read_ahead, with_name_check,
dminfo, read_ahead, seg_status)))
stack;
out:
@@ -1955,7 +1965,7 @@ static int _add_dev_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
if (!(dlid = build_dm_uuid(dm->track_pending_delete ? dm->cmd->pending_delete_mem : dm->mem, lv, layer)))
return_0;
- if (!_info(dm->cmd, name, dlid, 1, 0, &info, NULL, NULL))
+ if (!_info(dm->cmd, name, dlid, 1, 0, 0, &info, NULL, NULL))
return_0;
/*
@@ -2481,7 +2491,7 @@ static char *_add_error_or_zero_device(struct dev_manager *dm, struct dm_tree *d
seg->lv->name, errid)))
return_NULL;
- if (!_info(dm->cmd, name, dlid, 1, 0, &info, NULL, NULL))
+ if (!_info(dm->cmd, name, dlid, 1, 0, 0, &info, NULL, NULL))
return_NULL;
if (!info.exists) {
diff --git a/lib/activate/dev_manager.h b/lib/activate/dev_manager.h
index 5be417b..20b6a26 100644
--- a/lib/activate/dev_manager.h
+++ b/lib/activate/dev_manager.h
@@ -47,7 +47,7 @@ void dev_manager_exit(void);
*/
int dev_manager_info(struct cmd_context *cmd, const struct logical_volume *lv,
const char *layer,
- int with_open_count, int with_read_ahead,
+ int with_open_count, int with_read_ahead, int with_name_check,
struct dm_info *dminfo, uint32_t *read_ahead,
struct lv_seg_status *seg_status);
4 years, 5 months
stable-2.02 - tests: needs exclusive activation for conversion
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8b741b3bbac6121f05c...
Commit: 8b741b3bbac6121f05caa455b31fed0983a30b64
Parent: 5ee3d6dbdffc47467727d8c89fc91d84aa97189a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 30 09:36:10 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Oct 30 09:36:10 2019 +0100
tests: needs exclusive activation for conversion
For online convertion LVs must be activated localy exclusive as
cache can only work for exclusive activation.
---
test/shell/lvconvert-cache-thin.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvconvert-cache-thin.sh b/test/shell/lvconvert-cache-thin.sh
index 7dda6e6..ad4a03e 100644
--- a/test/shell/lvconvert-cache-thin.sh
+++ b/test/shell/lvconvert-cache-thin.sh
@@ -54,8 +54,8 @@ lvs -a $vg
lvremove -f $vg
# Check conversion of cached LV works as thin-pool
-lvcreate -L10 -n $lv $vg
-lvcreate -L10 -n $lv1 $vg
+lvcreate -aey -L10 -n $lv $vg
+lvcreate -aey -L10 -n $lv1 $vg
lvcreate -H -L10 $vg/$lv
# Stack of cache over cache is unsupported ATM
4 years, 5 months
master - Experimental VDO lvmdbusd support
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8b3cf53e24277177f2c...
Commit: 8b3cf53e24277177f2c04a5d666f86afdab271c6
Parent: 508d1808b07f204ca0ce71d4d505ded82f30d0ce
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Oct 30 10:55:06 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:55:06 2019 -0500
Experimental VDO lvmdbusd support
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 589e7cd..6bf5656 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,6 +1,7 @@
Version 2.03.07 -
===================================
Fix activation order when removing merged snapshot.
+ Experimental VDO support for lvmdbusd.
Version 2.03.06 - 23rd October 2019
===================================
4 years, 6 months
master - lvmdbustest.py: Use local data instead of fetching
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=508d1808b07f204ca0c...
Commit: 508d1808b07f204ca0ce71d4d505ded82f30d0ce
Parent: f91df163e21b283e652bc830b5af49a7bb3cf3fb
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Oct 14 14:33:16 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbustest.py: Use local data instead of fetching
Avoid making more dbus calls to get information we already have. This
also avoids us getting an error where a dbus object representation is
being deleted by another process while we are trying to gather information
about it across the wire.
---
test/dbus/lvmdbustest.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 711b247..522e3ca 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -88,8 +88,12 @@ def _root_pv_name(res, pv_name):
vg_name = pv_name.split('/')[2]
for v in res[VG_INT]:
if v.Vg.Name == vg_name:
- pv = ClientProxy(bus, v.Vg.Pvs[0], interfaces=(PV_INT, ))
- return _root_pv_name(res, pv.Pv.Name)
+ for pv in res[PV_INT]:
+ if pv.object_path in v.Vg.Pvs:
+ return _root_pv_name(res, pv.Pv.Name)
+ return None
+
+
def _prune_lvs(res, interface, vg_object_path):
lvs = [lv for lv in res[interface] if lv.LvCommon.Vg == vg_object_path]
res[interface] = lvs
4 years, 6 months
master - lvmdbusd: Debug msg. improvements.
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1bbf97757736b49065b...
Commit: 1bbf97757736b49065bd6944d36e7a6db6f3aa7e
Parent: 4dcb36aba4160ffe9ae90c93642e717e813e4779
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Oct 11 10:46:22 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbusd: Debug msg. improvements.
---
daemons/lvmdbusd/main.py | 10 +++++-----
daemons/lvmdbusd/manager.py | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index 9988143..b0a82d4 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -44,10 +44,10 @@ def process_request():
try:
req = cfg.worker_q.get(True, 5)
log_debug(
- "Running method: %s with args %s" %
- (str(req.method), str(req.arguments)))
+ "Method start: %s with args %s (callback = %s)" %
+ (str(req.method), str(req.arguments), str(req.cb)))
req.run_cmd()
- log_debug("Method complete ")
+ log_debug("Method complete: %s" % str(req.method))
except queue.Empty:
pass
except Exception:
@@ -159,8 +159,8 @@ def main():
# Using a thread to process requests, we cannot hang the dbus library
# thread that is handling the dbus interface
- thread_list.append(threading.Thread(target=process_request,
- name='process_request'))
+ thread_list.append(
+ threading.Thread(target=process_request, name='process_request'))
# Have a single thread handling updating lvm and the dbus model so we
# don't have multiple threads doing this as the same time
diff --git a/daemons/lvmdbusd/manager.py b/daemons/lvmdbusd/manager.py
index 8de05db..2857e9a 100644
--- a/daemons/lvmdbusd/manager.py
+++ b/daemons/lvmdbusd/manager.py
@@ -107,10 +107,10 @@ class Manager(AutomatedProperties):
rc = cfg.load(log=False)
if rc != 0:
- utils.log_debug('Manager.Refresh - exit %d' % (rc),
+ utils.log_debug('Manager.Refresh - exit %d %d' % (rc, lc),
'bg_black', 'fg_light_red')
else:
- utils.log_debug('Manager.Refresh - exit %d' % (rc))
+ utils.log_debug('Manager.Refresh - exit %d %d' % (rc, lc))
return rc + lc
@dbus.service.method(
4 years, 6 months
master - lvmdbustest.py: Add tests for LV interface
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f961311436bda50b219...
Commit: f961311436bda50b219f6d2909d8602e37148611
Parent: 1bbf97757736b49065bd6944d36e7a6db6f3aa7e
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Oct 11 10:49:10 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbustest.py: Add tests for LV interface
Add tests for all the different LV types with the standard LV dbus
interface. These tests shook out a couple of new bugs.
---
test/dbus/lvmdbustest.py | 207 ++++++++++++++++++++++++++++++++++------------
1 files changed, 154 insertions(+), 53 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index f8842ef..64a126a 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -58,8 +58,11 @@ if pv_device_list:
testlib.validate_introspection = False
-def vg_n():
- return g_prefix + rs(8, '_vg')
+def vg_n(prefix=None):
+ name = rs(8, '_vg')
+ if prefix:
+ name = prefix + name
+ return name
def lv_n(suffix=None):
@@ -315,12 +318,12 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(rc is not None and len(rc) > 0)
self._check_consistency()
- def _vg_create(self, pv_paths=None):
+ def _vg_create(self, pv_paths=None, vg_prefix=None):
if not pv_paths:
- pv_paths = [self.objs[PV_INT][0].object_path]
+ pv_paths = self._all_pv_object_paths()
- vg_name = vg_n()
+ vg_name = vg_n(prefix=vg_prefix)
vg_path = self.handle_return(
self.objs[MANAGER_INT][0].Manager.VgCreate(
@@ -721,7 +724,7 @@ class TestDbusService(unittest.TestCase):
vg = self._vg_create(self._all_pv_object_paths()).Vg
if size is None:
- size = mib(4)
+ size = mib(8)
lv = self._test_lv_create(
vg.LvCreateLinear,
@@ -732,16 +735,16 @@ class TestDbusService(unittest.TestCase):
self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
return lv
+ def _create_thin_pool_lv(self):
+ return self._create_lv(True)
+
def test_lv_create_rounding(self):
self._create_lv(size=(mib(2) + 13))
def test_lv_create_thin_pool(self):
- self._create_lv(True)
-
- def test_lv_rename(self):
- # Rename a regular LV
- lv = self._create_lv()
+ self._create_thin_pool_lv()
+ def _rename_lv_test(self, lv):
path = self._lookup(lv.LvCommon.Name)
prev_path = path
@@ -755,6 +758,16 @@ class TestDbusService(unittest.TestCase):
self._check_consistency()
self.assertTrue(prev_path == path, "%s != %s" % (prev_path, path))
+ lv.update()
+ self.assertTrue(
+ lv.LvCommon.Name == new_name,
+ "%s != %s" % (lv.LvCommon.Name, new_name))
+
+ def test_lv_rename(self):
+ # Rename a regular LV
+ lv = self._create_lv()
+ self._rename_lv_test(lv)
+
def test_lv_thinpool_rename(self):
# Rename a thin pool
tp = self._create_lv(True)
@@ -804,26 +817,34 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(rc == '/')
self._check_consistency()
- def test_lv_remove(self):
- lv = self._create_lv().Lv
+ def _lv_remove(self, lv):
rc = self.handle_return(
- lv.Remove(
+ lv.Lv.Remove(
dbus.Int32(g_tmo),
EOD))
self.assertTrue(rc == '/')
self._check_consistency()
- def test_lv_snapshot(self):
- lv_p = self._create_lv()
+ def test_lv_remove(self):
+ lv = self._create_lv()
+ self._lv_remove(lv)
+
+ def _take_lv_snapshot(self, lv_p):
ss_name = 'ss_' + lv_p.LvCommon.Name
- rc = self.handle_return(lv_p.Lv.Snapshot(
+ ss_obj_path = self.handle_return(lv_p.Lv.Snapshot(
dbus.String(ss_name),
dbus.UInt64(0),
dbus.Int32(g_tmo),
EOD))
- self.assertTrue(rc != '/')
+ self.assertTrue(ss_obj_path != '/')
+ return ClientProxy(
+ self.bus, ss_obj_path, interfaces=(LV_COMMON_INT, LV_INT))
+
+ def test_lv_snapshot(self):
+ lv_p = self._create_lv()
+ self._take_lv_snapshot(lv_p)
# noinspection PyUnresolvedReferences,PyUnusedLocal
def _wait_for_job(self, j_path):
@@ -866,21 +887,23 @@ class TestDbusService(unittest.TestCase):
dbus.Int32(g_tmo), EOD), vg, LV_BASE_INT)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
- def test_lv_resize(self):
+ def _test_lv_resize(self, lv):
+ # Can't resize cache or thin pool volumes or vdo pool lv
+ if lv.LvCommon.Attr[0] == 'C' or lv.LvCommon.Attr[0] == 't' or \
+ lv.LvCommon.Attr[0] == 'd':
+ return
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
+ vg = ClientProxy(self.bus, lv.LvCommon.Vg, interfaces=(VG_INT,)).Vg
- vg = self._vg_create(pv_paths).Vg
- lv = self._create_lv(vg=vg, size=mib(16))
+ start_size = lv.LvCommon.SizeBytes
+
+ # Vdo are fairly big and need large re-size amounts.
+ if start_size > mib(4) * 3:
+ delta = mib(4)
+ else:
+ delta = 16384
- for size in \
- [
- lv.LvCommon.SizeBytes + 4194304,
- lv.LvCommon.SizeBytes - 4194304,
- lv.LvCommon.SizeBytes + 2048,
- lv.LvCommon.SizeBytes - 2048]:
+ for size in [start_size + delta, start_size - delta]:
pv_in_use = [i[0] for i in lv.LvCommon.Devices]
# Select a PV in the VG that isn't in use
@@ -915,6 +938,16 @@ class TestDbusService(unittest.TestCase):
# We are testing re-sizing to same size too...
self.assertTrue(lv.LvCommon.SizeBytes <= prev)
+ def test_lv_resize(self):
+
+ pv_paths = [
+ self.objs[PV_INT][0].object_path, self.objs[PV_INT][1].object_path]
+
+ vg = self._vg_create(pv_paths).Vg
+ lv = self._create_lv(vg=vg, size=mib(16))
+
+ self._test_lv_resize(lv)
+
def test_lv_resize_same(self):
vg = self._vg_create(self._all_pv_object_paths()).Vg
lv = self._create_lv(vg=vg)
@@ -945,10 +978,7 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(
pv_path_move != new_pv, "%s == %s" % (pv_path_move, new_pv))
- def test_lv_activate_deactivate(self):
- lv_p = self._create_lv()
- lv_p.update()
-
+ def _test_activate_deactivate(self, lv_p):
self.handle_return(lv_p.Lv.Deactivate(
dbus.UInt64(0), dbus.Int32(g_tmo), EOD))
lv_p.update()
@@ -960,7 +990,17 @@ class TestDbusService(unittest.TestCase):
lv_p.update()
self.assertTrue(lv_p.LvCommon.Active)
- self._check_consistency()
+
+ # Vdo property "IndexState" when getting activated goes from
+ # "opening" -> "online" after we have returned from the activate call
+ # thus when we try to check the consistency we fail as the property
+ # is changing on it's own and not because the lvmdbusd failed to
+ # refresh it's own state. One solution is to not expose IndexState as
+ # a property.
+ # TODO Expose method to determine if Lv is partaking in VDO.
+ vg = ClientProxy(self.bus, lv_p.LvCommon.Vg, interfaces=(VG_INT,))
+ if "vdo" not in vg.Vg.Name:
+ self._check_consistency()
# Try control flags
for i in range(0, 5):
@@ -973,6 +1013,10 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(lv_p.LvCommon.Active)
self._check_consistency()
+ def test_lv_activate_deactivate(self):
+ lv_p = self._create_lv()
+ self._test_activate_deactivate(lv_p)
+
def test_move(self):
lv = self._create_lv()
@@ -1157,15 +1201,13 @@ class TestDbusService(unittest.TestCase):
vg.update()
self.assertTrue([] == vg.Tags)
- def test_lv_tags(self):
- vg = self._vg_create().Vg
- lv = self._create_lv(vg=vg)
-
+ def _test_lv_tags(self, lv):
t = ['Testing', 'tags']
self.handle_return(
lv.Lv.TagsAdd(
dbus.Array(t, 's'), dbus.Int32(g_tmo), EOD))
+ self._check_consistency()
lv.update()
self.assertTrue(t == lv.LvCommon.Tags)
@@ -1174,9 +1216,15 @@ class TestDbusService(unittest.TestCase):
dbus.Array(t, 's'),
dbus.Int32(g_tmo),
EOD))
+ self._check_consistency()
lv.update()
self.assertTrue([] == lv.LvCommon.Tags)
+ def test_lv_tags(self):
+ vg = self._vg_create().Vg
+ lv = self._create_lv(vg=vg)
+ self._test_lv_tags(lv)
+
def test_vg_allocation_policy_set(self):
vg = self._vg_create().Vg
@@ -1192,7 +1240,7 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(prop)
def test_vg_max_pv(self):
- vg = self._vg_create().Vg
+ vg = self._vg_create([self.objs[PV_INT][0].object_path]).Vg
for p in [0, 1, 10, 100, 100, 1024, 2 ** 32 - 1]:
rc = self.handle_return(
vg.MaxPvSet(
@@ -1441,10 +1489,10 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(
'/com/redhat/lvmdbus1/CachePool' in cache_pool.object_path)
- def _create_cache_lv(self):
+ def _create_cache_lv(self, return_all=False):
vg, cache_pool = self._create_cache_pool()
- lv_to_cache = self._create_lv(size=mib(8), vg=vg)
+ lv_to_cache = self._create_lv(size=mib(32), vg=vg)
c_lv_path = self.handle_return(
cache_pool.CachePool.CacheLv(
@@ -1454,12 +1502,15 @@ class TestDbusService(unittest.TestCase):
intf = (LV_COMMON_INT, LV_INT, CACHE_LV_INT)
cached_lv = ClientProxy(self.bus, c_lv_path, interfaces=intf)
- return vg, cache_pool, cached_lv
+
+ if return_all:
+ return vg, cache_pool, cached_lv
+ return cached_lv
def test_cache_lv_create(self):
for destroy_cache in [True, False]:
- vg, _, cached_lv = self._create_cache_lv()
+ vg, _, cached_lv = self._create_cache_lv(True)
uncached_lv_path = self.handle_return(
cached_lv.CachedLv.DetachCachePool(
dbus.Boolean(destroy_cache),
@@ -1484,7 +1535,7 @@ class TestDbusService(unittest.TestCase):
self.assertEqual(len(cur_objs[CACHE_LV_INT]), 2)
self._check_consistency()
- _, _, cached_lv = self._create_cache_lv()
+ cached_lv = self._create_cache_lv()
verify_cache_lv_count()
new_name = 'renamed_' + cached_lv.LvCommon.Name
@@ -1796,11 +1847,11 @@ class TestDbusService(unittest.TestCase):
pool_name = lv_n("_vdo_pool")
lv_name = lv_n()
- vg_proxy = self._vg_create()
+ vg_proxy = self._vg_create(vg_prefix="vdo_")
vdo_pool_object_path = self.handle_return(
vg_proxy.VgVdo.CreateVdoPoolandLv(
pool_name, lv_name,
- dbus.UInt64(mib(4096)),
+ dbus.UInt64(mib(4096)), # Appears to be minimum size
dbus.UInt64(mib(8192)),
dbus.Int32(g_tmo),
EOD))
@@ -1810,11 +1861,20 @@ class TestDbusService(unittest.TestCase):
vdo_pool_object_path,
self._lookup("%s/%s" % (vg_proxy.Vg.Name, pool_name)))
- vdo_lv = self._lookup("%s/%s" % (vg_proxy.Vg.Name, lv_name))
- self.assertNotEqual(vdo_lv, "/")
- intf = (LV_COMMON_INT, LV_INT, VDOPOOL_INT)
- pool_lv = ClientProxy(self.bus, vdo_lv, interfaces=intf)
- return vg_proxy, pool_lv
+ vdo_pool_path = self._lookup("%s/%s" % (vg_proxy.Vg.Name, pool_name))
+ self.assertNotEqual(vdo_pool_path, "/")
+ intf = [LV_COMMON_INT, LV_INT]
+ vdo_lv_obj_path = self._lookup("%s/%s" % (vg_proxy.Vg.Name, lv_name))
+ vdo_lv = ClientProxy(self.bus, vdo_lv_obj_path, interfaces=intf)
+ intf.append(VDOPOOL_INT)
+ vdo_pool_lv = ClientProxy(self.bus, vdo_pool_path, interfaces=intf)
+ return vg_proxy, vdo_pool_lv, vdo_lv
+
+ def _create_vdo_lv(self):
+ return self._create_vdo_pool_and_lv()[2]
+
+ def _vdo_pool_lv(self):
+ return self._create_vdo_pool_and_lv()[1]
def test_vdo_pool_create(self):
# Basic vdo sanity testing
@@ -1825,9 +1885,50 @@ class TestDbusService(unittest.TestCase):
# the operation when if finds an existing vdo signature, which likely
# shouldn't exist.
for _ in range(0, 2):
- vg, _ = self._create_vdo_pool_and_lv()
+ vg, _, _ = self._create_vdo_pool_and_lv()
self.handle_return(vg.Vg.Remove(dbus.Int32(g_tmo), EOD))
+ def _test_lv_method_interface(self, lv):
+ self._rename_lv_test(lv)
+ self._test_activate_deactivate(lv)
+ self._test_lv_tags(lv)
+ self._test_lv_resize(lv)
+
+ def _test_lv_method_interface_sequence(
+ self, lv, test_ss=True, remove_lv=True):
+ self._test_lv_method_interface(lv)
+
+ # We can't take a snapshot of a pool lv (not yet).
+ if test_ss:
+ ss_lv = self._take_lv_snapshot(lv)
+ self._test_lv_method_interface(ss_lv)
+ self._lv_remove(ss_lv)
+
+ if remove_lv:
+ self._lv_remove(lv)
+
+ def test_lv_interface_plain_lv(self):
+ self._test_lv_method_interface_sequence(self._create_lv())
+
+ def test_lv_interface_vdo_lv(self):
+ if not self.vdo:
+ raise unittest.SkipTest('vdo not supported')
+ self._test_lv_method_interface_sequence(self._create_vdo_lv())
+
+ def test_lv_interface_cache_lv(self):
+ self._test_lv_method_interface_sequence(
+ self._create_cache_lv(), remove_lv=False)
+
+ def test_lv_interface_thin_pool_lv(self):
+ self._test_lv_method_interface_sequence(
+ self._create_thin_pool_lv(), test_ss=False)
+
+ def test_lv_interface_vdo_pool_lv(self):
+ if not self.vdo:
+ raise unittest.SkipTest('vdo not supported')
+ self._test_lv_method_interface_sequence(
+ self._vdo_pool_lv(), test_ss=False)
+
class AggregateResults(object):
4 years, 6 months