[lvm-devel] Allow mirror log conversion while inactive
Jonathan Brassow
jbrassow at redhat.com
Mon Jun 23 16:05:26 UTC 2008
brassow
Allow mirror log conversion (disk -> core) while mirror is inactive.
Addresses bug 192865.
Index: LVM2/lib/metadata/mirror.c
===================================================================
--- LVM2.orig/lib/metadata/mirror.c
+++ LVM2/lib/metadata/mirror.c
@@ -1140,6 +1140,7 @@ int remove_mirror_log(struct cmd_context
struct list *removable_pvs)
{
float sync_percent;
+ struct lvinfo info;
/* Unimplemented features */
if (list_size(&lv->segments) != 1) {
@@ -1148,10 +1149,17 @@ int remove_mirror_log(struct cmd_context
}
/* Had disk log, switch to core. */
- if (!lv_mirror_percent(cmd, lv, 0, &sync_percent, NULL)) {
- log_error("Unable to determine mirror sync status.");
+ if (lv_info(cmd, lv, &info, 0, 0) && info.exists) {
+ if (!lv_mirror_percent(cmd, lv, 0, &sync_percent, NULL)) {
+ log_error("Unable to determine mirror sync status.");
+ return 0;
+ }
+ } else if (yes_no_prompt("Converting to core log while inactive will"
+ " require a complete resync of the mirror.\n"
+ "Proceed? [y/n]: "))
+ sync_percent = 0;
+ else
return 0;
- }
if (sync_percent >= 100.0)
init_mirror_in_sync(1);
More information about the lvm-devel
mailing list