[PATCH] drbdadm: allow dump/-xml without configured resources

Rasto Levrinc rasto.levrinc at gmail.com
Mon Oct 14 23:32:04 CEST 2013


---
 user/drbdadm_main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/user/drbdadm_main.c b/user/drbdadm_main.c
index 170e71f..5f60d4e 100644
--- a/user/drbdadm_main.c
+++ b/user/drbdadm_main.c
@@ -1012,6 +1012,9 @@ static int adm_dump(struct cfg_ctx *ctx)
        struct d_host_info *host;
        struct d_resource *res = ctx->res;

+       if (res == NULL)
+               return 0;
+
        printI("# resource %s on %s: %s, %s\n",
               esc(res->name), nodeinfo.nodename,
               res->ignore ? "ignored" : "not ignored",
@@ -1042,6 +1045,9 @@ static int adm_dump_xml(struct cfg_ctx *ctx)
        struct d_host_info *host;
        struct d_resource *res = ctx->res;

+       if (res == NULL)
+               return 0;
+
        printI("<resource name=\"%s\" conf-file-line=\"%s:%u\">\n",
                esc_xml(res->name),
                esc_xml(res->config_file), res->start_line);
@@ -4044,7 +4050,7 @@ int main(int argc, char **argv)

        ctx.arg = cmd->name;
        if (cmd->res_name_required) {
-               if (config == NULL) {
+               if (config == NULL && !is_dump) {
                        fprintf(stderr, "no resources defined!\n");
                        exit(E_usage);
                }


>
> As i said, a fairly big list. I hope you can confirm and reproduce these
> issues so they can be fixed

Thanks, the bigger the better,

Rasto

>
> Thanks in advance and keep up the good work on LCMC!
>
> Kind regards,
> Caspar Smit


More information about the drbd-mc mailing list