1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

vdo: fix vdoformat when -V is specified

The previous patch improved read of pipe when lvm2 was looking
for default logical size, but we clearly must read pipe also
for -V case, when the logical size is already defined.
This commit is contained in:
Zdenek Kabelac 2020-02-10 15:41:30 +01:00
parent 8f794f2095
commit 3716aa848e

View File

@ -316,19 +316,19 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
return 0;
}
if (!*logical_size)
while (!feof(f) && fgets(buf, sizeof(buf), f)) {
/* TODO: Watch out for locales */
while (!feof(f) && fgets(buf, sizeof(buf), f)) {
/* TODO: Watch out for locales */
if (!*logical_size)
if (sscanf(buf, "Logical blocks defaulted to " FMTu64 " blocks", &lb) == 1) {
*logical_size = lb * DM_VDO_BLOCK_SIZE;
log_verbose("Available VDO logical blocks " FMTu64 " (%s).",
lb, display_size(data_lv->vg->cmd, *logical_size));
}
if ((dpath = strchr(buf, '\n')))
*dpath = 0; /* cut last '\n' away */
if (buf[0])
log_print(" %s", buf); /* Print vdo_format messages */
}
if ((dpath = strchr(buf, '\n')))
*dpath = 0; /* cut last '\n' away */
if (buf[0])
log_print(" %s", buf); /* Print vdo_format messages */
}
if (!pipe_close(&pdata)) {
log_error("Command %s failed.", argv[0]);