openvz: refactor openvzDomainDefineCmd

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2021-12-10 17:11:07 +01:00
parent 0dfb73a511
commit 560de4e5cd

View File

@ -118,15 +118,14 @@ openvzDomObjFromDomain(struct openvz_driver *driver,
static virCommand * static virCommand *
openvzDomainDefineCmd(virDomainDef *vmdef) openvzDomainDefineCmd(virDomainDef *vmdef)
{ {
virCommand *cmd = virCommandNewArgList(VZCTL, g_autoptr(virCommand) cmd = virCommandNewArgList(VZCTL,
"--quiet", "--quiet",
"create", "create",
NULL); NULL);
if (vmdef == NULL) { if (vmdef == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Container is not defined")); _("Container is not defined"));
virCommandFree(cmd);
return NULL; return NULL;
} }
@ -137,7 +136,7 @@ openvzDomainDefineCmd(virDomainDef *vmdef)
virCommandAddArgList(cmd, "--ostemplate", vmdef->fss[0]->src, NULL); virCommandAddArgList(cmd, "--ostemplate", vmdef->fss[0]->src, NULL);
} }
return cmd; return g_steal_pointer(&cmd);
} }