]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_process.c: moving qemuValidateCpuCount to qemu_domain.c
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 14 Nov 2018 19:52:06 +0000 (17:52 -0200)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 15 Nov 2018 21:39:16 +0000 (16:39 -0500)
Previous patch removed the call to qemuProcessValidateCpuCount
from qemuProcessStartValidateXML, in qemu_process.c. The only
caller left is qemuDomainDefValidate, in qemu_domain.c.

Instead of having a public function declared inside qemu_process.c
that isn't used in that file, this patch moves the function to
qemu_domain.c, making in static and renaming it to
qemuDomainValidateCpuCount to be compliant with other static
functions names in the file.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_process.c
src/qemu/qemu_process.h

index cdc88def8c2934bd7165450a6beaecddb6f2e914..fbe63e2e1dc1896501083d309c88793ca850274c 100644 (file)
@@ -3991,6 +3991,29 @@ qemuDomainDefValidateMemory(const virDomainDef *def)
 }
 
 
+static int
+qemuDomainValidateCpuCount(const virDomainDef *def,
+                            virQEMUCapsPtr qemuCaps)
+{
+    unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
+
+    if (virDomainDefGetVcpus(def) == 0) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("Domain requires at least 1 vCPU"));
+        return -1;
+    }
+
+    if (maxCpus > 0 && virDomainDefGetVcpusMax(def) > maxCpus) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Maximum CPUs greater than specified machine "
+                         "type limit %u"), maxCpus);
+        return -1;
+    }
+
+    return 0;
+}
+
+
 static int
 qemuDomainDefValidate(const virDomainDef *def,
                       virCapsPtr caps ATTRIBUTE_UNUSED,
@@ -4085,7 +4108,7 @@ qemuDomainDefValidate(const virDomainDef *def,
         }
     }
 
-    if (qemuProcessValidateCpuCount(def, qemuCaps) < 0)
+    if (qemuDomainValidateCpuCount(def, qemuCaps) < 0)
         goto cleanup;
 
     if (ARCH_IS_X86(def->os.arch) &&
index 262aba0a6ca3903ebaf2cb803ac9ff0d4f944c33..f45c9f651e724f2e8b574b5a0387da18a1a3fe3f 100644 (file)
@@ -3898,29 +3898,6 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
 }
 
 
-int
-qemuProcessValidateCpuCount(const virDomainDef *def,
-                            virQEMUCapsPtr qemuCaps)
-{
-    unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
-
-    if (virDomainDefGetVcpus(def) == 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("Domain requires at least 1 vCPU"));
-        return -1;
-    }
-
-    if (maxCpus > 0 && virDomainDefGetVcpusMax(def) > maxCpus) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Maximum CPUs greater than specified machine "
-                         "type limit %u"), maxCpus);
-        return -1;
-    }
-
-    return 0;
-}
-
-
 static int
 qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
                                 virCPUDataPtr cpu)
index d3b2baac516cfda1e06fc6cc001e1eb3dbeb6cfe..2037467c94624d6c00030f5dee7c62d929c801e1 100644 (file)
@@ -47,9 +47,6 @@ int qemuProcessDestroyMemoryBackingPath(virQEMUDriverPtr driver,
                                         virDomainObjPtr vm,
                                         virDomainMemoryDefPtr mem);
 
-int qemuProcessValidateCpuCount(const virDomainDef *def,
-                                virQEMUCapsPtr qemuCaps);
-
 void qemuProcessReconnectAll(virQEMUDriverPtr driver);
 
 typedef struct _qemuProcessIncomingDef qemuProcessIncomingDef;