On 02/09/2017 09:01 AM, Michal Privoznik wrote:
> + if (virAsprintf(&ovs_timeout, "--timeout=%d",
virNetDevOpenvswitchTimeout) < 0)
> + goto cleanup;
>
> cmd = virCommandNew(OVSVSCTL);
>
> - virCommandAddArgList(cmd, "--timeout=5", "--",
"--if-exists", "del-port",
> + virCommandAddArgList(cmd, ovs_timeout, "--", "--if-exists",
"del-port",
> ifname, "--", "add-port", brname,
ifname, NULL);
While this would work we have virCommandAddArgFormat which wraps exactly this:
virCommandNew(OVSVSCTL);
virCommandAddArgFormat(cmd, "--timeout=%u", virNetDevOpenvswitchTimeout);
virCommandAddArgList(cmd, "--", "--if-exists", ..., NULL);
Then we can take the extra step and wrap it in a static function so that --timeout=%u
doesn't have to be copied all over the place.
I will fix this before pushing.
Thanks and the wrapper is a good idea.
ACK with the change I'm suggesting.
Michal
--
Mit freundlichen Grüßen/Kind regards
Boris Fiuczynski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294