File Support-pass-force-to-dump-md.patch of Package drbd-utils.5899

drbdadm : Support pass force option to dump md

At least till v8.9.6, drbdadm dump-md support
"--force" option to dump the metadata (might
stale) while the device still running.

drbdmeta still able to dump but drbdadm 
will show "unrecognized option" 

diff -Naur drbd-utils-9.0.0.orig/user/v9/config_flags.c drbd-utils-9.0.0/user/v9/config_flags.c
--- drbd-utils-9.0.0.orig/user/v9/config_flags.c	2018-01-25 10:49:04.419550855 +0800
+++ drbd-utils-9.0.0/user/v9/config_flags.c	2018-01-25 10:51:53.412986007 +0800
@@ -1081,6 +1081,12 @@
 		{ } },
 };
 
+struct context_def dump_md_ctx = {
+       .fields = {
+		{ .name = "force", .argument_is_optional = true },
+		{ } },
+};
+
 struct context_def adjust_ctx = {
 	.fields = {
 		{ "skip-disk", .argument_is_optional = true },
diff -Naur drbd-utils-9.0.0.orig/user/v9/config_flags.h drbd-utils-9.0.0/user/v9/config_flags.h
--- drbd-utils-9.0.0.orig/user/v9/config_flags.h	2018-01-25 10:49:04.419550855 +0800
+++ drbd-utils-9.0.0/user/v9/config_flags.h	2018-01-25 10:51:37.420850181 +0800
@@ -100,6 +100,7 @@
 extern struct context_def device_options_ctx;
 extern struct context_def invalidate_ctx;
 extern struct context_def create_md_ctx;
+extern struct context_def dump_md_ctx;
 extern struct context_def adjust_ctx;
 extern struct context_def peer_device_options_ctx;
 extern struct context_def handlers_ctx;
diff -Naur drbd-utils-9.0.0.orig/user/v9/drbdadm_main.c drbd-utils-9.0.0/user/v9/drbdadm_main.c
--- drbd-utils-9.0.0.orig/user/v9/drbdadm_main.c	2018-01-25 10:49:04.419550855 +0800
+++ drbd-utils-9.0.0/user/v9/drbdadm_main.c	2018-01-25 10:49:44.659892592 +0800
@@ -357,7 +357,7 @@
 static struct adm_cmd create_md_cmd = {"create-md", adm_create_md, &create_md_ctx, ACF1_MINOR_ONLY };
 static struct adm_cmd show_gi_cmd = {"show-gi", adm_setup_and_meta, ACF1_PEER_DEVICE .disk_required = 1};
 static struct adm_cmd get_gi_cmd = {"get-gi", adm_setup_and_meta, ACF1_PEER_DEVICE .disk_required = 1};
-static struct adm_cmd dump_md_cmd = {"dump-md", adm_drbdmeta, ACF1_MINOR_ONLY };
+static struct adm_cmd dump_md_cmd = {"dump-md", adm_drbdmeta, &dump_md_ctx, ACF1_MINOR_ONLY };
 static struct adm_cmd wipe_md_cmd = {"wipe-md", adm_drbdmeta, ACF1_MINOR_ONLY };
 static struct adm_cmd apply_al_cmd = {"apply-al", adm_drbdmeta, ACF1_MINOR_ONLY };
 static struct adm_cmd forget_peer_cmd = {"forget-peer", adm_forget_peer, ACF1_DISCONNECT };
openSUSE Build Service is sponsored by