fence_kdump: chained -v flags are not recognized
nrwahl2 opened this issue · 8 comments
Demo:
[root@fastvm-rhel-8-0-23 pacemaker]# fence_kdump -vv -n node2
[debug]: waiting for message from '192.168.22.24'
^C
[root@fastvm-rhel-8-0-23 pacemaker]# fence_kdump -v -v -n node2
[debug]: options {
[debug]: nodename = node2
[debug]: ipport = 7410
[debug]: family = 0
[debug]: count = 0
[debug]: interval = 10
[debug]: timeout = 60
[debug]: verbose = 2
[debug]: }
[debug]: node {
[debug]: name = node2
[debug]: addr = 192.168.22.24
[debug]: port = 7410
[debug]: info = 0x55699847de70
[debug]: }
[debug]: waiting for message from '192.168.22.24'
^C
[root@fastvm-rhel-8-0-23 pacemaker]# fence_kdump -v 2 -n node2
[debug]: options {
[debug]: nodename = node2
[debug]: ipport = 7410
[debug]: family = 0
[debug]: count = 0
[debug]: interval = 10
[debug]: timeout = 60
[debug]: verbose = 1
[debug]: }
[debug]: node {
[debug]: name = node2
[debug]: addr = 192.168.22.24
[debug]: port = 7410
[debug]: info = 0x56176cf95e70
[debug]: }
[debug]: waiting for message from '192.168.22.24'
I assume this is a quirk of getopt
and I'm not sure if there's a way to fix it as long as verbose
takes an optional argument. I don't have time to look further into it right now, so I'm just documenting it here.
That's strange. -vv seems to be working fine for me.
I think the issue is that it's trying to set the verbosity level to "v", which isn't a number and thus gets converted to 0.
Oh. It's fence_kdump. I thought it was the other agents using the library.
Yeah, that might be the issue.
Ah. I see the issue. Shouldnt be hard to fix.
Just use a counter if optarg is NULL:
https://github.com/ClusterLabs/fence-agents/blob/master/agents/kdump/fence_kdump.c#L453-L455
I think the second v
is treated as optarg
.
Yep. Coffee didnt get to my brain yet. So I guess if optarg isnt int we'll have to do a for to count the v's.
I've made a PR that should solve the issue. Tell me if it's adecuate, or if there's any edge cases worth adding logic for.