mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-11 09:18:25 +03:00
lvconvert waits for initial completion by default
This commit is contained in:
parent
38857ba29e
commit
09b98a45df
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.30 -
|
Version 2.02.30 -
|
||||||
===================================
|
===================================
|
||||||
|
lvconvert waits for completion of initial sync by default.
|
||||||
Refactor vgcreate for parameter validation and add tests.
|
Refactor vgcreate for parameter validation and add tests.
|
||||||
Add new convert_lv field to lvs output.
|
Add new convert_lv field to lvs output.
|
||||||
Print warning when lvm tools are running as non-root.
|
Print warning when lvm tools are running as non-root.
|
||||||
|
@ -24,7 +24,8 @@ struct lvconvert_params {
|
|||||||
const char *lv_name;
|
const char *lv_name;
|
||||||
const char *lv_name_full;
|
const char *lv_name_full;
|
||||||
const char *vg_name;
|
const char *vg_name;
|
||||||
int wait_daemon;
|
int wait_completion;
|
||||||
|
int need_polling;
|
||||||
|
|
||||||
uint32_t chunk_size;
|
uint32_t chunk_size;
|
||||||
uint32_t region_size;
|
uint32_t region_size;
|
||||||
@ -116,6 +117,9 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!arg_count(cmd, background_ARG))
|
||||||
|
lp->wait_completion = 1;
|
||||||
|
|
||||||
if (arg_count(cmd, snapshot_ARG))
|
if (arg_count(cmd, snapshot_ARG))
|
||||||
lp->snapshot = 1;
|
lp->snapshot = 1;
|
||||||
|
|
||||||
@ -374,7 +378,7 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l
|
|||||||
/* If called with no argument, try collapsing the resync layers */
|
/* If called with no argument, try collapsing the resync layers */
|
||||||
if (!arg_count(cmd, mirrors_ARG) && !arg_count(cmd, mirrorlog_ARG) &&
|
if (!arg_count(cmd, mirrors_ARG) && !arg_count(cmd, mirrorlog_ARG) &&
|
||||||
!arg_count(cmd, corelog_ARG)) {
|
!arg_count(cmd, corelog_ARG)) {
|
||||||
lp->wait_daemon = 1;
|
lp->need_polling = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,6 +480,8 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l
|
|||||||
corelog ? 0U : 1U, lp->pvh, lp->alloc,
|
corelog ? 0U : 1U, lp->pvh, lp->alloc,
|
||||||
MIRROR_BY_LV))
|
MIRROR_BY_LV))
|
||||||
return_0;
|
return_0;
|
||||||
|
if (lp->wait_completion)
|
||||||
|
lp->need_polling = 1;
|
||||||
goto commit_changes;
|
goto commit_changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,7 +555,7 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l
|
|||||||
MIRROR_BY_LV))
|
MIRROR_BY_LV))
|
||||||
return_0;
|
return_0;
|
||||||
lv->status |= CONVERTING;
|
lv->status |= CONVERTING;
|
||||||
lp->wait_daemon = 1;
|
lp->need_polling = 1;
|
||||||
} else {
|
} else {
|
||||||
/* Reduce number of mirrors */
|
/* Reduce number of mirrors */
|
||||||
if (!lv_remove_mirrors(cmd, lv, existing_mirrors - lp->mirrors,
|
if (!lv_remove_mirrors(cmd, lv, existing_mirrors - lp->mirrors,
|
||||||
@ -584,7 +590,7 @@ commit_changes:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lp->wait_daemon)
|
if (!lp->need_polling)
|
||||||
log_print("Logical volume %s converted.", lv->name);
|
log_print("Logical volume %s converted.", lv->name);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -740,13 +746,13 @@ int lvconvert(struct cmd_context * cmd, int argc, char **argv)
|
|||||||
error:
|
error:
|
||||||
unlock_vg(cmd, lp.vg_name);
|
unlock_vg(cmd, lp.vg_name);
|
||||||
|
|
||||||
if (ret == ECMD_PROCESSED && lp.wait_daemon) {
|
if (ret == ECMD_PROCESSED && lp.need_polling) {
|
||||||
if (!lv_info(cmd, lvl->lv, &info, 1, 0) || !info.exists) {
|
if (!lv_info(cmd, lvl->lv, &info, 1, 0) || !info.exists) {
|
||||||
log_print("Conversion starts after activation");
|
log_print("Conversion starts after activation");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = lvconvert_poll(cmd, lp.lv_name_full,
|
ret = lvconvert_poll(cmd, lp.lv_name_full,
|
||||||
arg_count(cmd, background_ARG) ? 1U : 0);
|
lp.wait_completion ? 0 : 1U);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user