I realize you are just following the existing pattern used in OpenVZ
driver, but this piece of code is horrible.
sprintf'ing into a string, then parsing that string and turning it back
into a list of argv[] strings, with no escaping of special characters,
or quoting. eg if the vm name had a space in it it'll mis-parse it.
In fact,
names of VMs are always numbers in OpenVZ.
Just declare the command argv straight into a char*[], eg
const char *prog[] = {
VZCTL,
"set",
vm->vmdef->name,
"--onboot",
autostart ? "yes" : "no",
"--save"
}
ret = virExec(conn, prog, &pid, -1, &outfd, &errfd)
See the storage_backend_logical.c file for examples of this kind of approach
We should put other uses of convCmdbufExec() on the TODO list for removal
in the future.
Ok. Moreover, many code is needed to rewrite.
Daniel, thanks for review!
fixed patch is attached.