]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_process.c: make qemuValidateCpuCount public
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 14 Nov 2018 19:52:04 +0000 (17:52 -0200)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 15 Nov 2018 20:44:33 +0000 (15:44 -0500)
qemuValidateCpuCount validates the maxCpus value of a domain at
startup time, preventing it to start if the value exceeds a maximum.

This checking is also done at qemu_domain.c, qemuDomainDefValidate.
However, it is done only for x86 (and even then, in a specific
scenario). We want this check to be done for all archs.

To accomplish this, let's first make qemuValidateCpuCount public so
it can be used inside qemuDomainDefValidate. The function was renamed
to qemuProcessValidateCpuCount to be compliant with the other public
methods at qemu_process.h. The method signature was slightly adapted
to fit the const 'def' variable used in qemuDomainDefValidate. This
change has no downside in in its original usage at
qemuProcessStartValidateXML.

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

index d6496c262205dd12a36415037d64cc60fa4d4f10..f249de903a8159d42cc8e43908f6fad457cfb612 100644 (file)
@@ -3898,9 +3898,9 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
 }
 
 
-static int
-qemuValidateCpuCount(virDomainDefPtr def,
-                     virQEMUCapsPtr qemuCaps)
+int
+qemuProcessValidateCpuCount(const virDomainDef *def,
+                            virQEMUCapsPtr qemuCaps)
 {
     unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
 
@@ -5165,7 +5165,7 @@ qemuProcessStartValidateXML(virQEMUDriverPtr driver,
      * If back compat isn't a concern, XML validation should probably
      * be done at parse time.
      */
-    if (qemuValidateCpuCount(vm->def, qemuCaps) < 0)
+    if (qemuProcessValidateCpuCount(vm->def, qemuCaps) < 0)
         return -1;
 
     /* checks below should not be executed when starting a qemu process for a
index 2037467c94624d6c00030f5dee7c62d929c801e1..d3b2baac516cfda1e06fc6cc001e1eb3dbeb6cfe 100644 (file)
@@ -47,6 +47,9 @@ int qemuProcessDestroyMemoryBackingPath(virQEMUDriverPtr driver,
                                         virDomainObjPtr vm,
                                         virDomainMemoryDefPtr mem);
 
+int qemuProcessValidateCpuCount(const virDomainDef *def,
+                                virQEMUCapsPtr qemuCaps);
+
 void qemuProcessReconnectAll(virQEMUDriverPtr driver);
 
 typedef struct _qemuProcessIncomingDef qemuProcessIncomingDef;