[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 06/11] openvz: Need to error check openvzDomainSetVcpusFlagsInternal()



---
Since I'm not only changing one 'virtual cpu' reference to 'vCPU', I
figured I would just post an update.  As you see the message I added
was a cut-n-paste of other messages where similar calls were made. To
be consistent, I changed other references to vCPUs and I changed one
other message as well.

 src/openvz/openvz_driver.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index e12a84b..90c753b 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1,7 +1,7 @@
 /*
  * 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 Shuveb Hussain
  * Copyright (C) 2007 Anoop Joe Cyriac
@@ -1004,7 +1004,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
     if (vm->def->maxvcpus > 0) {
         if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Could not set number of virtual cpu"));
+                           _("Could not set number of vCPUs"));
              goto cleanup;
         }
     }
@@ -1097,7 +1097,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
     if (vm->def->maxvcpus > 0) {
         if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Could not set number of virtual cpu"));
+                           _("Could not set number of vCPUs"));
             goto cleanup;
         }
     }
@@ -1363,11 +1363,16 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
 
     if (nvcpus <= 0) {
         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;
     }
 
-    openvzDomainSetVcpusInternal(vm, nvcpus);
     ret = 0;
 
 cleanup:
-- 
1.7.11.7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]