mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Factor out generate_log_name_format().
This commit is contained in:
parent
bfd31e94d5
commit
fb9d44daf1
@ -1,6 +1,6 @@
|
|||||||
Version 2.01.15 -
|
Version 2.01.15 -
|
||||||
=================================
|
=================================
|
||||||
Factor out adjusted_mirror_region_size().
|
Factor out adjusted_mirror_region_size() and generate_log_name_format().
|
||||||
Move compose_log_line() into mirror directory.
|
Move compose_log_line() into mirror directory.
|
||||||
Factor out _get_library_path().
|
Factor out _get_library_path().
|
||||||
Don't kill idling clvmd threads.
|
Don't kill idling clvmd threads.
|
||||||
|
@ -579,27 +579,13 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
|||||||
/* FIXME Calculate how many extents needed for the log */
|
/* FIXME Calculate how many extents needed for the log */
|
||||||
|
|
||||||
len = strlen(lv_name) + 32;
|
len = strlen(lv_name) + 32;
|
||||||
if (!(log_name = alloca(len))) {
|
if (!(log_name = alloca(len)) ||
|
||||||
|
!(generate_log_name_format(vg, lv_name, log_name, len))) {
|
||||||
log_error("log_name allocation failed. "
|
log_error("log_name allocation failed. "
|
||||||
"Remove new LV and retry.");
|
"Remove new LV and retry.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lvm_snprintf(log_name, len, "%s_mlog", lv_name) < 0) {
|
|
||||||
log_error("log_name allocation failed. "
|
|
||||||
"Remove new LV and retry.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (find_lv_in_vg(vg, log_name)) {
|
|
||||||
if (lvm_snprintf(log_name, len, "%s_mlog_%%d",
|
|
||||||
lv_name) < 0) {
|
|
||||||
log_error("log_name allocation failed. "
|
|
||||||
"Remove new LV and retry.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(log_lv = lv_create_empty(vg->fid, log_name, NULL,
|
if (!(log_lv = lv_create_empty(vg->fid, log_name, NULL,
|
||||||
VISIBLE_LV | LVM_READ | LVM_WRITE,
|
VISIBLE_LV | LVM_READ | LVM_WRITE,
|
||||||
lp->alloc, 0, vg))) {
|
lp->alloc, 0, vg))) {
|
||||||
|
@ -1058,6 +1058,24 @@ int validate_vg_name(struct cmd_context *cmd, const char *vg_name)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int generate_log_name_format(struct volume_group *vg, const char *lv_name,
|
||||||
|
char *buffer, size_t size)
|
||||||
|
{
|
||||||
|
if (lvm_snprintf(buffer, size, "%s_mlog", lv_name) < 0) {
|
||||||
|
stack;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (find_lv_in_vg(vg, buffer) &&
|
||||||
|
lvm_snprintf(buffer, size, "%s_mlog_%%d",
|
||||||
|
lv_name) < 0) {
|
||||||
|
stack;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Volumes may be zeroed to remove old application data.
|
* Volumes may be zeroed to remove old application data.
|
||||||
*/
|
*/
|
||||||
|
@ -94,6 +94,9 @@ int apply_lvname_restrictions(const char *name);
|
|||||||
|
|
||||||
int validate_vg_name(struct cmd_context *cmd, const char *vg_name);
|
int validate_vg_name(struct cmd_context *cmd, const char *vg_name);
|
||||||
|
|
||||||
|
int generate_log_name_format(struct volume_group *vg, const char *lv_name,
|
||||||
|
char *buffer, size_t size);
|
||||||
|
|
||||||
int zero_lv(struct cmd_context *cmd, struct logical_volume *lv);
|
int zero_lv(struct cmd_context *cmd, struct logical_volume *lv);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user