提交 40ef77cd 编写于 作者: J John Ferlan

openvz: Need to error check openvzDomainSetVcpusFlagsInternal()

上级 7f945217
/* /*
* openvz_driver.c: core driver methods for managing OpenVZ VEs * openvz_driver.c: core driver methods for managing OpenVZ VEs
* *
* Copyright (C) 2010-2012 Red Hat, Inc. * Copyright (C) 2010-2013 Red Hat, Inc.
* Copyright (C) 2006, 2007 Binary Karma * Copyright (C) 2006, 2007 Binary Karma
* Copyright (C) 2006 Shuveb Hussain * Copyright (C) 2006 Shuveb Hussain
* Copyright (C) 2007 Anoop Joe Cyriac * Copyright (C) 2007 Anoop Joe Cyriac
...@@ -1004,7 +1004,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml) ...@@ -1004,7 +1004,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
if (vm->def->maxvcpus > 0) { if (vm->def->maxvcpus > 0) {
if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) { if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Could not set number of virtual cpu")); _("Could not set number of vCPUs"));
goto cleanup; goto cleanup;
} }
} }
...@@ -1100,7 +1100,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml, ...@@ -1100,7 +1100,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
if (vm->def->maxvcpus > 0) { if (vm->def->maxvcpus > 0) {
if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) { if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Could not set number of virtual cpu")); _("Could not set number of vCPUs"));
goto cleanup; goto cleanup;
} }
} }
...@@ -1366,11 +1366,16 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, ...@@ -1366,11 +1366,16 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
if (nvcpus <= 0) { if (nvcpus <= 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("VCPUs should be >= 1")); _("Number of vCPUs should be >= 1"));
goto cleanup;
}
if (openvzDomainSetVcpusInternal(vm, nvcpus) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Could not set number of vCPUs"));
goto cleanup; goto cleanup;
} }
openvzDomainSetVcpusInternal(vm, nvcpus);
ret = 0; ret = 0;
cleanup: cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册